Skip to content

Commit e3896be

Browse files
Manikanta Guntupalligregkh
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b433768 commit e3896be

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

drivers/tty/serial/xilinx_uartps.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <linux/gpio.h>
2626
#include <linux/gpio/consumer.h>
2727
#include <linux/delay.h>
28+
#include <linux/reset.h>
2829

2930
#define CDNS_UART_TTY_NAME "ttyPS"
3031
#define CDNS_UART_NAME "xuartps"
@@ -198,6 +199,7 @@ MODULE_PARM_DESC(rx_timeout, "Rx timeout, 1-255");
198199
* @gpiod_rts: Pointer to the gpio descriptor
199200
* @rs485_tx_started: RS485 tx state
200201
* @tx_timer: Timer for tx
202+
* @rstc: Pointer to the reset control
201203
*/
202204
struct cdns_uart {
203205
struct uart_port *port;
@@ -211,6 +213,7 @@ struct cdns_uart {
211213
struct gpio_desc *gpiod_rts;
212214
bool rs485_tx_started;
213215
struct hrtimer tx_timer;
216+
struct reset_control *rstc;
214217
};
215218
struct cdns_platform_data {
216219
u32 quirks;
@@ -948,6 +951,10 @@ static int cdns_uart_startup(struct uart_port *port)
948951

949952
is_brk_support = cdns_uart->quirks & CDNS_UART_RXBS_SUPPORT;
950953

954+
ret = reset_control_deassert(cdns_uart->rstc);
955+
if (ret)
956+
return ret;
957+
951958
uart_port_lock_irqsave(port, &flags);
952959

953960
/* Disable the TX and RX */
@@ -1721,6 +1728,13 @@ static int cdns_uart_probe(struct platform_device *pdev)
17211728
dev_err(&pdev->dev, "clock name 'ref_clk' is deprecated.\n");
17221729
}
17231730

1731+
cdns_uart_data->rstc = devm_reset_control_get_optional_exclusive(&pdev->dev, NULL);
1732+
if (IS_ERR(cdns_uart_data->rstc)) {
1733+
rc = PTR_ERR(cdns_uart_data->rstc);
1734+
dev_err_probe(&pdev->dev, rc, "Cannot get UART reset\n");
1735+
goto err_out_unregister_driver;
1736+
}
1737+
17241738
rc = clk_prepare_enable(cdns_uart_data->pclk);
17251739
if (rc) {
17261740
dev_err(&pdev->dev, "Unable to enable pclk clock.\n");
@@ -1881,6 +1895,7 @@ static void cdns_uart_remove(struct platform_device *pdev)
18811895
if (console_port == port)
18821896
console_port = NULL;
18831897
#endif
1898+
reset_control_assert(cdns_uart_data->rstc);
18841899

18851900
if (!--instances)
18861901
uart_unregister_driver(cdns_uart_data->cdns_uart_driver);

0 commit comments

Comments
 (0)