diff options
author | Ezequiel Garcia <ezequiel.garcia@free-electrons.com> | 2013-07-26 09:17:38 -0400 |
---|---|---|
committer | Jason Cooper <jason@lakedaemon.net> | 2013-08-06 10:09:57 -0400 |
commit | 9b6e4c0a58e24c28bd757c9365824a37e80b751c (patch) | |
tree | 2dbecfc6252725f0a8623a705122e950c7e23971 /drivers | |
parent | ad81f0545ef01ea651886dddac4bef6cec930092 (diff) |
memory: mvebu-devbus: Remove address decoding window workaround
Now that mbus device tree binding has been introduced, remove the address
decoding window management from this driver.
A suitable 'ranges' entry should be added to the devbus-compatible node in
the device tree, as described by the mbus binding documentation.
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Tested-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/memory/mvebu-devbus.c | 64 |
1 files changed, 2 insertions, 62 deletions
diff --git a/drivers/memory/mvebu-devbus.c b/drivers/memory/mvebu-devbus.c index 978e8e3abc5c..94c92482fd8f 100644 --- a/drivers/memory/mvebu-devbus.c +++ b/drivers/memory/mvebu-devbus.c | |||
@@ -208,16 +208,11 @@ static int mvebu_devbus_probe(struct platform_device *pdev) | |||
208 | { | 208 | { |
209 | struct device *dev = &pdev->dev; | 209 | struct device *dev = &pdev->dev; |
210 | struct device_node *node = pdev->dev.of_node; | 210 | struct device_node *node = pdev->dev.of_node; |
211 | struct device_node *parent; | ||
212 | struct devbus *devbus; | 211 | struct devbus *devbus; |
213 | struct resource *res; | 212 | struct resource *res; |
214 | struct clk *clk; | 213 | struct clk *clk; |
215 | unsigned long rate; | 214 | unsigned long rate; |
216 | const __be32 *ranges; | 215 | int err; |
217 | int err, cs; | ||
218 | int addr_cells, p_addr_cells, size_cells; | ||
219 | int ranges_len, tuple_len; | ||
220 | u32 base, size; | ||
221 | 216 | ||
222 | devbus = devm_kzalloc(&pdev->dev, sizeof(struct devbus), GFP_KERNEL); | 217 | devbus = devm_kzalloc(&pdev->dev, sizeof(struct devbus), GFP_KERNEL); |
223 | if (!devbus) | 218 | if (!devbus) |
@@ -248,68 +243,13 @@ static int mvebu_devbus_probe(struct platform_device *pdev) | |||
248 | return err; | 243 | return err; |
249 | 244 | ||
250 | /* | 245 | /* |
251 | * Allocate an address window for this device. | ||
252 | * If the device probing fails, then we won't be able to | ||
253 | * remove the allocated address decoding window. | ||
254 | * | ||
255 | * FIXME: This is only a temporary hack! We need to do this here | ||
256 | * because we still don't have device tree bindings for mbus. | ||
257 | * Once that support is added, we will declare these address windows | ||
258 | * statically in the device tree, and remove the window configuration | ||
259 | * from here. | ||
260 | */ | ||
261 | |||
262 | /* | ||
263 | * Get the CS to choose the window string. | ||
264 | * This is a bit hacky, but it will be removed once the | ||
265 | * address windows are declared in the device tree. | ||
266 | */ | ||
267 | cs = (((unsigned long)devbus->base) % 0x400) / 8; | ||
268 | |||
269 | /* | ||
270 | * Parse 'ranges' property to obtain a (base,size) window tuple. | ||
271 | * This will be removed once the address windows | ||
272 | * are declared in the device tree. | ||
273 | */ | ||
274 | parent = of_get_parent(node); | ||
275 | if (!parent) | ||
276 | return -EINVAL; | ||
277 | |||
278 | p_addr_cells = of_n_addr_cells(parent); | ||
279 | of_node_put(parent); | ||
280 | |||
281 | addr_cells = of_n_addr_cells(node); | ||
282 | size_cells = of_n_size_cells(node); | ||
283 | tuple_len = (p_addr_cells + addr_cells + size_cells) * sizeof(__be32); | ||
284 | |||
285 | ranges = of_get_property(node, "ranges", &ranges_len); | ||
286 | if (ranges == NULL || ranges_len != tuple_len) | ||
287 | return -EINVAL; | ||
288 | |||
289 | base = of_translate_address(node, ranges + addr_cells); | ||
290 | if (base == OF_BAD_ADDR) | ||
291 | return -EINVAL; | ||
292 | size = of_read_number(ranges + addr_cells + p_addr_cells, size_cells); | ||
293 | |||
294 | /* | ||
295 | * Create an mbus address windows. | ||
296 | * FIXME: Remove this, together with the above code, once the | ||
297 | * address windows are declared in the device tree. | ||
298 | */ | ||
299 | err = mvebu_mbus_add_window(devbus_wins[cs], base, size); | ||
300 | if (err < 0) | ||
301 | return err; | ||
302 | |||
303 | /* | ||
304 | * We need to create a child device explicitly from here to | 246 | * We need to create a child device explicitly from here to |
305 | * guarantee that the child will be probed after the timing | 247 | * guarantee that the child will be probed after the timing |
306 | * parameters for the bus are written. | 248 | * parameters for the bus are written. |
307 | */ | 249 | */ |
308 | err = of_platform_populate(node, NULL, NULL, dev); | 250 | err = of_platform_populate(node, NULL, NULL, dev); |
309 | if (err < 0) { | 251 | if (err < 0) |
310 | mvebu_mbus_del_window(base, size); | ||
311 | return err; | 252 | return err; |
312 | } | ||
313 | 253 | ||
314 | return 0; | 254 | return 0; |
315 | } | 255 | } |