Re: [PATCH 2/2] serial: tegra-utc: Add driver for Tegra UART Trace Controller (UTC)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks for reviewing the patch Andy!

On Wed, 2025-01-29 at 09:07 +0200, Andy Shevchenko wrote:
> External email: Use caution opening links or attachments
> 
> 
> 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?
> 

Ack. I will use uart_read_port_properties() in v2.

> > +     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.
> 
> 

"current-speed" is to specify the baudrate at which the UTC is
operating. Not sure if "clock-frequency" is the ideal property for this
as we are not configuring any clocks in the driver.

Also, to add this in uart_read_port_properties() would require updating
uart_port stucture to store the baudrate value. Would this be fine?
Asking because I do not see termios related configurations stored in
uart_port structure.

> > +     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(...);
> 

Ack. I will update this in v2.

> > +     }
> > +
> > +     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.
> 

Ack. I will fix this in v2.

> > +             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.
> 
> > +};
> 

Ack. I will fix this in v2.

> --
> With Best Regards,
> Andy Shevchenko
> 
> 

Thanks & Regards,
Kartik




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux