[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<MN0PR12MB5953AED63BC895B09D90DED7B70C2@MN0PR12MB5953.namprd12.prod.outlook.com>
Date: Sat, 20 Apr 2024 19:04:11 +0000
From: "Pandey, Radhey Shyam" <radhey.shyam.pandey@....com>
To: "Guntupalli, Manikanta" <manikanta.guntupalli@....com>, "git (AMD-Xilinx)"
<git@....com>, "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"jirislaby@...nel.org" <jirislaby@...nel.org>, "robh@...nel.org"
<robh@...nel.org>, "krzk+dt@...nel.org" <krzk+dt@...nel.org>,
"conor+dt@...nel.org" <conor+dt@...nel.org>, "Simek, Michal"
<michal.simek@....com>, "p.zabel@...gutronix.de" <p.zabel@...gutronix.de>,
"laurent.pinchart@...asonboard.com" <laurent.pinchart@...asonboard.com>,
"Gajjar, Parth" <parth.gajjar@....com>, "u.kleine-koenig@...gutronix.de"
<u.kleine-koenig@...gutronix.de>, "tglx@...utronix.de" <tglx@...utronix.de>,
"julien.malik@...eenlabs.fr" <julien.malik@...eenlabs.fr>,
"ruanjinjie@...wei.com" <ruanjinjie@...wei.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-serial@...r.kernel.org" <linux-serial@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org" <linux-arm-kernel@...ts.infradead.org>
CC: "Goud, Srinivas" <srinivas.goud@....com>, "Datta, Shubhrajyoti"
<shubhrajyoti.datta@....com>, "manion05gk@...il.com" <manion05gk@...il.com>,
"Guntupalli, Manikanta" <manikanta.guntupalli@....com>
Subject: RE: [PATCH 3/3] tty: serial: uartps: Add support for uartps
controller reset
> -----Original Message-----
> From: Manikanta Guntupalli <manikanta.guntupalli@....com>
> Sent: Friday, April 19, 2024 5:36 PM
> To: git (AMD-Xilinx) <git@....com>; gregkh@...uxfoundation.org;
> jirislaby@...nel.org; robh@...nel.org; krzk+dt@...nel.org;
> conor+dt@...nel.org; Simek, Michal <michal.simek@....com>;
> p.zabel@...gutronix.de; laurent.pinchart@...asonboard.com; Pandey,
> Radhey Shyam <radhey.shyam.pandey@....com>; Gajjar, Parth
> <parth.gajjar@....com>; u.kleine-koenig@...gutronix.de;
> tglx@...utronix.de; julien.malik@...eenlabs.fr; ruanjinjie@...wei.com;
> linux-kernel@...r.kernel.org; linux-serial@...r.kernel.org;
> devicetree@...r.kernel.org; linux-arm-kernel@...ts.infradead.org
> Cc: Goud, Srinivas <srinivas.goud@....com>; Datta, Shubhrajyoti
> <shubhrajyoti.datta@....com>; manion05gk@...il.com; Guntupalli,
> Manikanta <manikanta.guntupalli@....com>
> Subject: [PATCH 3/3] tty: serial: uartps: Add support for uartps controller
> reset
>
> Add support for an optional reset for the uartps controller using
> the reset driver. If the uartps node contains the "resets" property,
> then cdns_uart_startup performs uartps controller non-pulse out of reset
> and reset in exit path.
>
> Signed-off-by: Manikanta Guntupalli <manikanta.guntupalli@....com>
> ---
> drivers/tty/serial/xilinx_uartps.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/drivers/tty/serial/xilinx_uartps.c
> b/drivers/tty/serial/xilinx_uartps.c
> index de3487206bcb..e45d6993ba05 100644
> --- a/drivers/tty/serial/xilinx_uartps.c
> +++ b/drivers/tty/serial/xilinx_uartps.c
> @@ -25,6 +25,7 @@
> #include <linux/gpio.h>
> #include <linux/gpio/consumer.h>
> #include <linux/delay.h>
> +#include <linux/reset.h>
>
> #define CDNS_UART_TTY_NAME "ttyPS"
> #define CDNS_UART_NAME "xuartps"
> @@ -198,6 +199,7 @@ MODULE_PARM_DESC(rx_timeout, "Rx timeout, 1-
> 255");
> * @gpiod_rts: Pointer to the gpio descriptor
> * @rs485_tx_started: RS485 tx state
> * @tx_timer: Timer for tx
> + * @rstc: Pointer to the reset control
> */
> struct cdns_uart {
> struct uart_port *port;
> @@ -211,6 +213,7 @@ struct cdns_uart {
> struct gpio_desc *gpiod_rts;
> bool rs485_tx_started;
> struct hrtimer tx_timer;
> + struct reset_control *rstc;
> };
> struct cdns_platform_data {
> u32 quirks;
> @@ -948,6 +951,12 @@ static int cdns_uart_startup(struct uart_port *port)
>
> is_brk_support = cdns_uart->quirks & CDNS_UART_RXBS_SUPPORT;
>
> + if (cdns_uart->rstc) {
> + ret = reset_control_deassert(cdns_uart->rstc);
reset_control_deassert already has NULL check , then any need for this additional
if check?
> + if (ret)
> + return ret;
> + }
> +
> uart_port_lock_irqsave(port, &flags);
>
> /* Disable the TX and RX */
> @@ -1721,6 +1730,13 @@ static int cdns_uart_probe(struct platform_device
> *pdev)
> dev_err(&pdev->dev, "clock name 'ref_clk' is
> deprecated.\n");
> }
>
> + cdns_uart_data->rstc =
> devm_reset_control_get_optional_exclusive(&pdev->dev, NULL);
> + if (IS_ERR(cdns_uart_data->rstc)) {
> + rc = PTR_ERR(cdns_uart_data->rstc);
> + dev_err_probe(&pdev->dev, rc, "Cannot get UART reset\n");
> + goto err_out_unregister_driver;
> + }
> +
> rc = clk_prepare_enable(cdns_uart_data->pclk);
> if (rc) {
> dev_err(&pdev->dev, "Unable to enable pclk clock.\n");
> @@ -1881,6 +1897,7 @@ static void cdns_uart_remove(struct
> platform_device *pdev)
> if (console_port == port)
> console_port = NULL;
> #endif
> + reset_control_assert(cdns_uart_data->rstc);
>
> if (!--instances)
> uart_unregister_driver(cdns_uart_data->cdns_uart_driver);
> --
> 2.25.1
Powered by blists - more mailing lists