aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/vexpress-syscfg.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/vexpress-syscfg.c')
-rw-r--r--drivers/misc/vexpress-syscfg.c60
1 files changed, 13 insertions, 47 deletions
diff --git a/drivers/misc/vexpress-syscfg.c b/drivers/misc/vexpress-syscfg.c
index b3a812384a6f..c344483fa7d6 100644
--- a/drivers/misc/vexpress-syscfg.c
+++ b/drivers/misc/vexpress-syscfg.c
@@ -145,7 +145,7 @@ static struct regmap_config vexpress_syscfg_regmap_config = {
145static struct regmap *vexpress_syscfg_regmap_init(struct device *dev, 145static struct regmap *vexpress_syscfg_regmap_init(struct device *dev,
146 void *context) 146 void *context)
147{ 147{
148 struct platform_device *pdev = to_platform_device(dev); 148 int err;
149 struct vexpress_syscfg *syscfg = context; 149 struct vexpress_syscfg *syscfg = context;
150 struct vexpress_syscfg_func *func; 150 struct vexpress_syscfg_func *func;
151 struct property *prop; 151 struct property *prop;
@@ -155,32 +155,18 @@ static struct regmap *vexpress_syscfg_regmap_init(struct device *dev,
155 u32 site, position, dcc; 155 u32 site, position, dcc;
156 int i; 156 int i;
157 157
158 if (dev->of_node) { 158 err = vexpress_config_get_topo(dev->of_node, &site,
159 int err = vexpress_config_get_topo(dev->of_node, &site,
160 &position, &dcc); 159 &position, &dcc);
160 if (err)
161 return ERR_PTR(err);
161 162
162 if (err) 163 prop = of_find_property(dev->of_node,
163 return ERR_PTR(err); 164 "arm,vexpress-sysreg,func", NULL);
164 165 if (!prop)
165 prop = of_find_property(dev->of_node, 166 return ERR_PTR(-EINVAL);
166 "arm,vexpress-sysreg,func", NULL); 167
167 if (!prop) 168 num = prop->length / sizeof(u32) / 2;
168 return ERR_PTR(-EINVAL); 169 val = prop->value;
169
170 num = prop->length / sizeof(u32) / 2;
171 val = prop->value;
172 } else {
173 if (pdev->num_resources != 1 ||
174 pdev->resource[0].flags != IORESOURCE_BUS)
175 return ERR_PTR(-EFAULT);
176
177 site = pdev->resource[0].start;
178 if (site == VEXPRESS_SITE_MASTER)
179 site = vexpress_config_get_master();
180 position = 0;
181 dcc = 0;
182 num = 1;
183 }
184 170
185 /* 171 /*
186 * "arm,vexpress-energy" function used to be described 172 * "arm,vexpress-energy" function used to be described
@@ -207,13 +193,8 @@ static struct regmap *vexpress_syscfg_regmap_init(struct device *dev,
207 for (i = 0; i < num; i++) { 193 for (i = 0; i < num; i++) {
208 u32 function, device; 194 u32 function, device;
209 195
210 if (dev->of_node) { 196 function = be32_to_cpup(val++);
211 function = be32_to_cpup(val++); 197 device = be32_to_cpup(val++);
212 device = be32_to_cpup(val++);
213 } else {
214 function = pdev->resource[0].end;
215 device = pdev->id;
216 }
217 198
218 dev_dbg(dev, "func %p: %u/%u/%u/%u/%u\n", 199 dev_dbg(dev, "func %p: %u/%u/%u/%u/%u\n",
219 func, site, position, dcc, 200 func, site, position, dcc,
@@ -265,17 +246,6 @@ static struct vexpress_config_bridge_ops vexpress_syscfg_bridge_ops = {
265}; 246};
266 247
267 248
268/* Non-DT hack, to be gone... */
269static struct device *vexpress_syscfg_bridge;
270
271int vexpress_syscfg_device_register(struct platform_device *pdev)
272{
273 pdev->dev.parent = vexpress_syscfg_bridge;
274
275 return platform_device_register(pdev);
276}
277
278
279static int vexpress_syscfg_probe(struct platform_device *pdev) 249static int vexpress_syscfg_probe(struct platform_device *pdev)
280{ 250{
281 struct vexpress_syscfg *syscfg; 251 struct vexpress_syscfg *syscfg;
@@ -303,10 +273,6 @@ static int vexpress_syscfg_probe(struct platform_device *pdev)
303 if (IS_ERR(bridge)) 273 if (IS_ERR(bridge))
304 return PTR_ERR(bridge); 274 return PTR_ERR(bridge);
305 275
306 /* Non-DT case */
307 if (!pdev->dev.of_node)
308 vexpress_syscfg_bridge = bridge;
309
310 return 0; 276 return 0;
311} 277}
312 278