lkml.org 
[lkml]   [2020]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v6 34/52] memory: tegra20-emc: Don't parse emc-stats node
Date
EMC device-tree node now contains new emc-stats sub-node which needs to
be skipped when timing nodes are parsed by EMC driver, otherwise driver
will try to parse the emc-stats as a timing node and will error out.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
drivers/memory/tegra/tegra20-emc.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/memory/tegra/tegra20-emc.c b/drivers/memory/tegra/tegra20-emc.c
index 69ccb3fe5b0b..27242659dfd6 100644
--- a/drivers/memory/tegra/tegra20-emc.c
+++ b/drivers/memory/tegra/tegra20-emc.c
@@ -349,7 +349,10 @@ static int tegra_emc_load_timings_from_dt(struct tegra_emc *emc,
int child_count;
int err;

- child_count = of_get_child_count(node);
+ child = of_find_node_by_name(node, "emc-stats");
+ of_node_put(child);
+
+ child_count = of_get_child_count(node) - (child ? 1 : 0);
if (!child_count) {
dev_err(emc->dev, "no memory timings in DT node: %pOF\n", node);
return -EINVAL;
@@ -364,6 +367,9 @@ static int tegra_emc_load_timings_from_dt(struct tegra_emc *emc,
timing = emc->timings;

for_each_child_of_node(node, child) {
+ if (of_device_is_compatible(child, "nvidia,tegra20-emc-statistics"))
+ continue;
+
err = load_one_timing_from_dt(emc, timing++, child);
if (err) {
of_node_put(child);
@@ -391,7 +397,11 @@ tegra_emc_find_node_by_ram_code(struct device *dev)
u32 value, ram_code;
int err;

- if (of_get_child_count(dev->of_node) == 0) {
+ /* old device-trees don't have emc-stats node */
+ np = of_find_node_by_name(dev->of_node, "emc-stats");
+ of_node_put(np);
+
+ if (of_get_child_count(dev->of_node) == (np ? 1 : 0)) {
dev_info(dev, "device-tree doesn't have memory timings\n");
return NULL;
}
--
2.27.0
\
 
 \ /
  Last update: 2020-10-25 23:21    [W:0.706 / U:0.532 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site