Linux Tegra architecture development
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: webgeek1234@gmail.com, Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>
Cc: linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org
Subject: Re: [PATCH] memory: tegra210-emc: Support Device Tree EMC Tables
Date: Sun, 4 May 2025 15:37:58 +0200	[thread overview]
Message-ID: <0dcf786f-d93a-4526-bdc6-e11d59347f98@kernel.org> (raw)
In-Reply-To: <20250430-tegra210-emc-dt-v1-1-99896fa69341@gmail.com>

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

  reply	other threads:[~2025-05-04 13:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-30 17:52 [PATCH] memory: tegra210-emc: Support Device Tree EMC Tables Aaron Kling via B4 Relay
2025-05-04 13:37 ` Krzysztof Kozlowski [this message]
2025-05-04 15:58   ` Aaron Kling
2025-05-04 16:13     ` Krzysztof Kozlowski
2025-05-04 17:18       ` Aaron Kling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0dcf786f-d93a-4526-bdc6-e11d59347f98@kernel.org \
    --to=krzk@kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=webgeek1234@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox