Skip to content

Commit f95bd04

Browse files
brglgregkh
authored andcommitted
memory: aemif: allow passing device lookup table as platform data
TI aemif driver creates its own subnodes of the device tree in order to guarantee that all child devices are probed after the AEMIF timing parameters are configured. Some devices (e.g. da850) use struct of_dev_auxdata for clock lookup but nodes created from within the aemif driver can't access the lookup table. Create a platform data structure that holds a pointer to of_dev_auxdata so that we can use it with of_platform_populate(). Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Acked-by: Sekhar Nori <nsekhar@ti.com> Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ad90a3d commit f95bd04

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

drivers/memory/ti-aemif.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/of.h>
2121
#include <linux/of_platform.h>
2222
#include <linux/platform_device.h>
23+
#include <linux/platform_data/ti-aemif.h>
2324

2425
#define TA_SHIFT 2
2526
#define RHOLD_SHIFT 4
@@ -335,6 +336,8 @@ static int aemif_probe(struct platform_device *pdev)
335336
struct device_node *np = dev->of_node;
336337
struct device_node *child_np;
337338
struct aemif_device *aemif;
339+
struct aemif_platform_data *pdata;
340+
struct of_dev_auxdata *dev_lookup;
338341

339342
if (np == NULL)
340343
return 0;
@@ -343,6 +346,9 @@ static int aemif_probe(struct platform_device *pdev)
343346
if (!aemif)
344347
return -ENOMEM;
345348

349+
pdata = dev_get_platdata(&pdev->dev);
350+
dev_lookup = pdata ? pdata->dev_lookup : NULL;
351+
346352
platform_set_drvdata(pdev, aemif);
347353

348354
aemif->clk = devm_clk_get(dev, NULL);
@@ -390,7 +396,7 @@ static int aemif_probe(struct platform_device *pdev)
390396
* parameters are set.
391397
*/
392398
for_each_available_child_of_node(np, child_np) {
393-
ret = of_platform_populate(child_np, NULL, NULL, dev);
399+
ret = of_platform_populate(child_np, NULL, dev_lookup, dev);
394400
if (ret < 0)
395401
goto error;
396402
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* TI DaVinci AEMIF platform glue.
3+
*
4+
* Copyright (C) 2017 BayLibre SAS
5+
*
6+
* Author:
7+
* Bartosz Golaszewski <bgolaszewski@baylibre.com>
8+
*
9+
* This program is free software; you can redistribute it and/or modify
10+
* it under the terms of the GNU General Public License version 2 as
11+
* published by the Free Software Foundation.
12+
*/
13+
14+
#ifndef __TI_DAVINCI_AEMIF_DATA_H__
15+
#define __TI_DAVINCI_AEMIF_DATA_H__
16+
17+
#include <linux/of_platform.h>
18+
19+
struct aemif_platform_data {
20+
struct of_dev_auxdata *dev_lookup;
21+
};
22+
23+
#endif /* __TI_DAVINCI_AEMIF_DATA_H__ */

0 commit comments

Comments
 (0)