summaryrefslogtreecommitdiffstats
path: root/drivers/memory
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2018-05-14 04:27:47 -0400
committerOlof Johansson <olof@lixom.net>2018-05-14 04:27:47 -0400
commit71fe67e0e23446074e61a10e1fec21dd297d49fa (patch)
treee2802ac4800ee69227da6c4b184dd620ed709f9b /drivers/memory
parent10d8713429d345867fc8998d6193b233c0cab28c (diff)
parent1e0a601437a6111ecf384df010812c53cada6497 (diff)
Merge tag 'soc_drivers_for_4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux-keystone into next/drivers
ARM: SOC driver update for 4.18 - AEMIF driver update to support board files and remove need of mach-davinci aemif code - Use percpu counters for qmss datapath stats - License update for TI SCI * tag 'soc_drivers_for_4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux-keystone: firmware: ti_sci: Switch to SPDX Licensing soc: ti: knav_qmss: Use percpu instead atomic for stats counter memory: aemif: add support for board files memory: aemif: don't rely on kbuild for driver's name Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'drivers/memory')
-rw-r--r--drivers/memory/ti-aemif.c60
1 files changed, 39 insertions, 21 deletions
diff --git a/drivers/memory/ti-aemif.c b/drivers/memory/ti-aemif.c
index 2744b1b91b57..31112f622b88 100644
--- a/drivers/memory/ti-aemif.c
+++ b/drivers/memory/ti-aemif.c
@@ -339,9 +339,6 @@ static int aemif_probe(struct platform_device *pdev)
339 struct aemif_platform_data *pdata; 339 struct aemif_platform_data *pdata;
340 struct of_dev_auxdata *dev_lookup; 340 struct of_dev_auxdata *dev_lookup;
341 341
342 if (np == NULL)
343 return 0;
344
345 aemif = devm_kzalloc(dev, sizeof(*aemif), GFP_KERNEL); 342 aemif = devm_kzalloc(dev, sizeof(*aemif), GFP_KERNEL);
346 if (!aemif) 343 if (!aemif)
347 return -ENOMEM; 344 return -ENOMEM;
@@ -363,8 +360,10 @@ static int aemif_probe(struct platform_device *pdev)
363 360
364 aemif->clk_rate = clk_get_rate(aemif->clk) / MSEC_PER_SEC; 361 aemif->clk_rate = clk_get_rate(aemif->clk) / MSEC_PER_SEC;
365 362
366 if (of_device_is_compatible(np, "ti,da850-aemif")) 363 if (np && of_device_is_compatible(np, "ti,da850-aemif"))
367 aemif->cs_offset = 2; 364 aemif->cs_offset = 2;
365 else if (pdata)
366 aemif->cs_offset = pdata->cs_offset;
368 367
369 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 368 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
370 aemif->base = devm_ioremap_resource(dev, res); 369 aemif->base = devm_ioremap_resource(dev, res);
@@ -373,15 +372,23 @@ static int aemif_probe(struct platform_device *pdev)
373 goto error; 372 goto error;
374 } 373 }
375 374
376 /* 375 if (np) {
377 * For every controller device node, there is a cs device node that 376 /*
378 * describe the bus configuration parameters. This functions iterate 377 * For every controller device node, there is a cs device node
379 * over these nodes and update the cs data array. 378 * that describe the bus configuration parameters. This
380 */ 379 * functions iterate over these nodes and update the cs data
381 for_each_available_child_of_node(np, child_np) { 380 * array.
382 ret = of_aemif_parse_abus_config(pdev, child_np); 381 */
383 if (ret < 0) 382 for_each_available_child_of_node(np, child_np) {
384 goto error; 383 ret = of_aemif_parse_abus_config(pdev, child_np);
384 if (ret < 0)
385 goto error;
386 }
387 } else if (pdata && pdata->num_abus_data > 0) {
388 for (i = 0; i < pdata->num_abus_data; i++, aemif->num_cs++) {
389 aemif->cs_data[i].cs = pdata->abus_data[i].cs;
390 aemif_get_hw_params(pdev, i);
391 }
385 } 392 }
386 393
387 for (i = 0; i < aemif->num_cs; i++) { 394 for (i = 0; i < aemif->num_cs; i++) {
@@ -394,14 +401,25 @@ static int aemif_probe(struct platform_device *pdev)
394 } 401 }
395 402
396 /* 403 /*
397 * Create a child devices explicitly from here to 404 * Create a child devices explicitly from here to guarantee that the
398 * guarantee that the child will be probed after the AEMIF timing 405 * child will be probed after the AEMIF timing parameters are set.
399 * parameters are set.
400 */ 406 */
401 for_each_available_child_of_node(np, child_np) { 407 if (np) {
402 ret = of_platform_populate(child_np, NULL, dev_lookup, dev); 408 for_each_available_child_of_node(np, child_np) {
403 if (ret < 0) 409 ret = of_platform_populate(child_np, NULL,
404 goto error; 410 dev_lookup, dev);
411 if (ret < 0)
412 goto error;
413 }
414 } else {
415 for (i = 0; i < pdata->num_sub_devices; i++) {
416 pdata->sub_devices[i].dev.parent = dev;
417 ret = platform_device_register(&pdata->sub_devices[i]);
418 if (ret) {
419 dev_warn(dev, "Error register sub device %s\n",
420 pdata->sub_devices[i].name);
421 }
422 }
405 } 423 }
406 424
407 return 0; 425 return 0;
@@ -422,7 +440,7 @@ static struct platform_driver aemif_driver = {
422 .probe = aemif_probe, 440 .probe = aemif_probe,
423 .remove = aemif_remove, 441 .remove = aemif_remove,
424 .driver = { 442 .driver = {
425 .name = KBUILD_MODNAME, 443 .name = "ti-aemif",
426 .of_match_table = of_match_ptr(aemif_of_match), 444 .of_match_table = of_match_ptr(aemif_of_match),
427 }, 445 },
428}; 446};