Commit fa4794ff authored by Dmitry Osipenko's avatar Dmitry Osipenko Committed by Krzysztof Kozlowski

memory: tegra20-emc: Continue probing if timings are missing in device-tree

EMC driver will become mandatory after turning it into interconnect
provider because interconnect users, like display controller driver, will
fail to probe using newer device-trees that have interconnect properties.
Thus make EMC driver to probe even if timings are missing in device-tree.
Signed-off-by: default avatarDmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/20201104164923.21238-35-digetx@gmail.comSigned-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
parent 0260979b
...@@ -383,6 +383,11 @@ tegra_emc_find_node_by_ram_code(struct device *dev) ...@@ -383,6 +383,11 @@ tegra_emc_find_node_by_ram_code(struct device *dev)
u32 value, ram_code; u32 value, ram_code;
int err; int err;
if (of_get_child_count(dev->of_node) == 0) {
dev_info(dev, "device-tree doesn't have memory timings\n");
return NULL;
}
if (!of_property_read_bool(dev->of_node, "nvidia,use-ram-code")) if (!of_property_read_bool(dev->of_node, "nvidia,use-ram-code"))
return of_node_get(dev->of_node); return of_node_get(dev->of_node);
...@@ -451,6 +456,9 @@ static long emc_round_rate(unsigned long rate, ...@@ -451,6 +456,9 @@ static long emc_round_rate(unsigned long rate,
struct tegra_emc *emc = arg; struct tegra_emc *emc = arg;
unsigned int i; unsigned int i;
if (!emc->num_timings)
return clk_get_rate(emc->clk);
min_rate = min(min_rate, emc->timings[emc->num_timings - 1].rate); min_rate = min(min_rate, emc->timings[emc->num_timings - 1].rate);
for (i = 0; i < emc->num_timings; i++) { for (i = 0; i < emc->num_timings; i++) {
...@@ -656,36 +664,26 @@ static int tegra_emc_probe(struct platform_device *pdev) ...@@ -656,36 +664,26 @@ static int tegra_emc_probe(struct platform_device *pdev)
struct tegra_emc *emc; struct tegra_emc *emc;
int irq, err; int irq, err;
/* driver has nothing to do in a case of memory timing absence */
if (of_get_child_count(pdev->dev.of_node) == 0) {
dev_info(&pdev->dev,
"EMC device tree node doesn't have memory timings\n");
return 0;
}
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) { if (irq < 0) {
dev_err(&pdev->dev, "please update your device tree\n"); dev_err(&pdev->dev, "please update your device tree\n");
return irq; return irq;
} }
np = tegra_emc_find_node_by_ram_code(&pdev->dev);
if (!np)
return -EINVAL;
emc = devm_kzalloc(&pdev->dev, sizeof(*emc), GFP_KERNEL); emc = devm_kzalloc(&pdev->dev, sizeof(*emc), GFP_KERNEL);
if (!emc) { if (!emc)
of_node_put(np);
return -ENOMEM; return -ENOMEM;
}
emc->clk_nb.notifier_call = tegra_emc_clk_change_notify; emc->clk_nb.notifier_call = tegra_emc_clk_change_notify;
emc->dev = &pdev->dev; emc->dev = &pdev->dev;
err = tegra_emc_load_timings_from_dt(emc, np); np = tegra_emc_find_node_by_ram_code(&pdev->dev);
of_node_put(np); if (np) {
if (err) err = tegra_emc_load_timings_from_dt(emc, np);
return err; of_node_put(np);
if (err)
return err;
}
emc->regs = devm_platform_ioremap_resource(pdev, 0); emc->regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(emc->regs)) if (IS_ERR(emc->regs))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment