[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0dcf786f-d93a-4526-bdc6-e11d59347f98@kernel.org>
Date: Sun, 4 May 2025 15:37:58 +0200
From: Krzysztof Kozlowski <krzk@...nel.org>
To: webgeek1234@...il.com, Thierry Reding <thierry.reding@...il.com>,
Jonathan Hunter <jonathanh@...dia.com>
Cc: linux-kernel@...r.kernel.org, linux-tegra@...r.kernel.org
Subject: Re: [PATCH] memory: tegra210-emc: Support Device Tree EMC Tables
On 30/04/2025 19:52, Aaron Kling via B4 Relay wrote:
> +#undef EMC_READ_PROP
> +#undef EMC_READ_STRING
> +#undef EMC_READ_PROP_ARRAY
> +
> + return 0;
> +}
> +
> +#define NOMINAL_COMPATIBLE "nvidia,tegra21-emc-table"
> +#define DERATED_COMPATIBLE "nvidia,tegra21-emc-table-derated"
No, you cannot add undocumented compatibles. Missing bindings.
> +static int tegra210_emc_load_timings_from_dt(struct tegra210_emc *emc,
> + struct device_node *node)
> +{
> + struct tegra210_emc_timing *timing;
> + unsigned int num_nominal = 0, num_derated = 0;
> + int err;
> +
> + emc->num_timings = 0;
> + for_each_child_of_node_scoped(node, child) {
> + if (of_device_is_compatible(child, NOMINAL_COMPATIBLE))
> + emc->num_timings++;
> + else if (of_device_is_compatible(child, DERATED_COMPATIBLE))
> + num_derated++;
> + }
> +
> + if (!emc->num_timings || (num_derated && (emc->num_timings != num_derated)))
> + return -EINVAL;
> +
> + emc->nominal = devm_kcalloc(emc->dev, emc->num_timings, sizeof(*timing),
> + GFP_KERNEL);
> + if (!emc->nominal)
> + return -ENOMEM;
> +
> + if (num_derated) {
> + num_derated = 0;
> + emc->derated = devm_kcalloc(emc->dev, emc->num_timings, sizeof(*timing),
> + GFP_KERNEL);
> + if (!emc->derated)
> + return -ENOMEM;
> + }
> +
> + for_each_child_of_node_scoped(node, child) {
> + if (of_device_is_compatible(child, NOMINAL_COMPATIBLE))
> + timing = &emc->nominal[num_nominal++];
> + else if (of_device_is_compatible(child, DERATED_COMPATIBLE))
> + timing = &emc->derated[num_derated++];
> + else
> + continue;
> +
> + err = load_one_timing_from_dt(emc, timing, child);
> + if (err)
> + return err;
> + }
> +
> + return 0;
> +}
> +
> +static int tegra210_emc_parse_dt(struct tegra210_emc *emc)
> +{
> + struct device_node *node, *np = emc->dev->of_node;
> + int ram_code, ret = 0;
> +
> + if (!np) {
> + dev_err(emc->dev, "Unable to find emc node\n");
> + return -ENODEV;
> + }
> +
> + if (of_find_property(np, "nvidia,use-ram-code", NULL)) {
I cannot find the bindings for this. Where is your DTS? Was it tested?
It seems nothing here is documented.
Best regards,
Krzysztof
Powered by blists - more mailing lists