Linux Tegra architecture development
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Kartik Rajput <kkartik@nvidia.com>
Cc: gregkh@linuxfoundation.org, jirislaby@kernel.org,
	robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
	thierry.reding@gmail.com, jonathanh@nvidia.com,
	hvilleneuve@dimonoff.com, arnd@kernel.org,
	geert+renesas@glider.be, robert.marko@sartura.hr,
	schnelle@linux.ibm.com, linux-kernel@vger.kernel.org,
	linux-serial@vger.kernel.org, devicetree@vger.kernel.org,
	linux-tegra@vger.kernel.org
Subject: Re: [PATCH 2/2] serial: tegra-utc: Add driver for Tegra UART Trace Controller (UTC)
Date: Wed, 29 Jan 2025 09:07:07 +0200	[thread overview]
Message-ID: <Z5nTm9UniwCgGNOY@smile.fi.intel.com> (raw)
In-Reply-To: <20250128064633.12381-3-kkartik@nvidia.com>

On Tue, Jan 28, 2025 at 12:16:33PM +0530, Kartik Rajput wrote:
> The Tegra264 SoC supports the UART Trace Controller (UTC), which allows
> multiple firmware clients (up to 16) to share a single physical UART.
> Each client is provided with its own interrupt and has access to a
> 128-character wide FIFO for both transmit (TX) and receive (RX)
> operations.
> 
> Add tegra-utc driver to support Tegra UART Trace Controller (UTC)
> client.

...

> +static int tegra_utc_probe(struct platform_device *pdev)
> +{
> +	struct device_node *np = pdev->dev.of_node;
> +	struct tegra_utc_port *tup;
> +	int index;
> +	int ret;
> +
> +	index = of_alias_get_id(np, "serial");
> +	if (index < 0) {
> +		dev_err(&pdev->dev, "failed to get alias id, err %d\n", index);
> +		return index;
> +	}

Can we please use uart_read_port_properties() instead of open-coding everything
again and again?

> +	tup = devm_kzalloc(&pdev->dev, sizeof(struct tegra_utc_port), GFP_KERNEL);
> +	if (!tup)
> +		return -ENOMEM;
> +
> +	ret = of_property_read_u32(np, "current-speed", &tup->baudrate);

Why not clock-frequency? But if needed, add this to the above mentioned API as
I know more than one driver may utilise this.


> +	if (ret) {
> +		dev_err(&pdev->dev, "missing current-speed device-tree property\n");

With

	struct device *dev = &pdev-dev;

this and other lines will be neater.

> +		return ret;

		return dev_err_probe(...);

> +	}
> +
> +	ret = of_property_read_u32(np, "nvidia,utc-fifo-threshold", &tup->fifo_threshold);
> +	if (ret) {
> +		dev_err(&pdev->dev, "missing nvidia,fifo-threshold device-tree property\n");
> +		return ret;
> +	}
> +
> +	tup->irq = platform_get_irq(pdev, 0);
> +	if (tup->irq < 0) {

> +		dev_err(&pdev->dev, "failed to get interrupt\n");

Dup. This error report is done by the above API.

> +		return tup->irq;
> +	}

> +	tup->soc = of_device_get_match_data(&pdev->dev);

> +	tup->tx_base = devm_platform_ioremap_resource_byname(pdev, "tx");
> +	if (IS_ERR(tup->tx_base))
> +		return PTR_ERR(tup->tx_base);
> +
> +	tup->rx_base = devm_platform_ioremap_resource_byname(pdev, "rx");
> +	if (IS_ERR(tup->rx_base))
> +		return PTR_ERR(tup->rx_base);
> +
> +	tegra_utc_setup_port(&pdev->dev, tup, index);
> +	platform_set_drvdata(pdev, tup);
> +
> +	return tegra_utc_register_port(tup);
> +}

...

> +static const struct of_device_id tegra_utc_of_match[] = {
> +	{ .compatible = "nvidia,tegra264-utc", .data = &tegra264_utc_soc },
> +	{},

No comma for the terminator line.

> +};

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2025-01-29  7:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-28  6:46 [PATCH 0/2] Add support for Tegra UART Trace Controller (UTC) client Kartik Rajput
2025-01-28  6:46 ` [PATCH 1/2] dt-bindings: serial: Add bindings for nvidia,tegra264-utc Kartik Rajput
2025-01-28  7:52   ` Krzysztof Kozlowski
2025-01-29  7:30     ` Kartik Rajput
2025-01-29 14:52       ` Thierry Reding
2025-01-28  6:46 ` [PATCH 2/2] serial: tegra-utc: Add driver for Tegra UART Trace Controller (UTC) Kartik Rajput
2025-01-29  7:07   ` Andy Shevchenko [this message]
2025-01-29  8:04     ` Kartik Rajput
2025-01-29 10:11       ` andriy.shevchenko

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=Z5nTm9UniwCgGNOY@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=arnd@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=gregkh@linuxfoundation.org \
    --cc=hvilleneuve@dimonoff.com \
    --cc=jirislaby@kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=kkartik@nvidia.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=robert.marko@sartura.hr \
    --cc=robh@kernel.org \
    --cc=schnelle@linux.ibm.com \
    --cc=thierry.reding@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