Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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@amd.com>
Link: https://lore.kernel.org/r/20240425062358.1347684-4-manikanta.guntupalli@amd.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Manikanta Guntupalli and committed by
Greg Kroah-Hartman
e3896be2 b4337685

+15
+15
drivers/tty/serial/xilinx_uartps.c
··· 25 25 #include <linux/gpio.h> 26 26 #include <linux/gpio/consumer.h> 27 27 #include <linux/delay.h> 28 + #include <linux/reset.h> 28 29 29 30 #define CDNS_UART_TTY_NAME "ttyPS" 30 31 #define CDNS_UART_NAME "xuartps" ··· 199 198 * @gpiod_rts: Pointer to the gpio descriptor 200 199 * @rs485_tx_started: RS485 tx state 201 200 * @tx_timer: Timer for tx 201 + * @rstc: Pointer to the reset control 202 202 */ 203 203 struct cdns_uart { 204 204 struct uart_port *port; ··· 213 211 struct gpio_desc *gpiod_rts; 214 212 bool rs485_tx_started; 215 213 struct hrtimer tx_timer; 214 + struct reset_control *rstc; 216 215 }; 217 216 struct cdns_platform_data { 218 217 u32 quirks; ··· 950 947 unsigned int status = 0; 951 948 952 949 is_brk_support = cdns_uart->quirks & CDNS_UART_RXBS_SUPPORT; 950 + 951 + ret = reset_control_deassert(cdns_uart->rstc); 952 + if (ret) 953 + return ret; 953 954 954 955 uart_port_lock_irqsave(port, &flags); 955 956 ··· 1728 1721 dev_err(&pdev->dev, "clock name 'ref_clk' is deprecated.\n"); 1729 1722 } 1730 1723 1724 + cdns_uart_data->rstc = devm_reset_control_get_optional_exclusive(&pdev->dev, NULL); 1725 + if (IS_ERR(cdns_uart_data->rstc)) { 1726 + rc = PTR_ERR(cdns_uart_data->rstc); 1727 + dev_err_probe(&pdev->dev, rc, "Cannot get UART reset\n"); 1728 + goto err_out_unregister_driver; 1729 + } 1730 + 1731 1731 rc = clk_prepare_enable(cdns_uart_data->pclk); 1732 1732 if (rc) { 1733 1733 dev_err(&pdev->dev, "Unable to enable pclk clock.\n"); ··· 1895 1881 if (console_port == port) 1896 1882 console_port = NULL; 1897 1883 #endif 1884 + reset_control_assert(cdns_uart_data->rstc); 1898 1885 1899 1886 if (!--instances) 1900 1887 uart_unregister_driver(cdns_uart_data->cdns_uart_driver);