From ea0c4300a6bfe7b3e607c45658968fcb22cb78f4 Mon Sep 17 00:00:00 2001 From: Dennis Kou Date: Tue, 17 Mar 2015 18:35:03 -0700 Subject: tegra: hv_comm: update driver for ivc reset Update the virtual serial driver to implement support for ivc channel resets. Use of ivc under the previous (non-reset) model has been deprecated. Bug 1597821 Change-Id: Icbe2914d66628f0e604808fa8fafa5778edc866b Signed-off-by: Dennis Kou Reviewed-on: http://git-master/r/1314799 Signed-off-by: Bo Kim Reviewed-on: https://git-master.nvidia.com/r/1527785 GVS: Gerrit_Virtual_Submit Reviewed-by: Bharat Nihalani --- drivers/tty/serial/tegra_hv_comm.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/tty/serial/tegra_hv_comm.c b/drivers/tty/serial/tegra_hv_comm.c index 301a53197..5a08c8bfe 100644 --- a/drivers/tty/serial/tegra_hv_comm.c +++ b/drivers/tty/serial/tegra_hv_comm.c @@ -1,7 +1,7 @@ /* * tegra_hv_comm.c: TTY over Tegra HV * - * Copyright (c) 2014 NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2015 NVIDIA CORPORATION. All rights reserved. * * Very loosely based on altera_jtaguart.c * @@ -323,11 +323,14 @@ static irqreturn_t tegra_hv_comm_interrupt(int irq, void *data) spin_lock(&port->lock); - if (pp->rx_en && tegra_hv_ivc_can_read(pp->ivck)) - tegra_hv_comm_rx_chars(pp); + /* until this function returns 0, the channel is unusable */ + if (tegra_hv_ivc_channel_notified(pp->ivck) == 0) { + if (pp->rx_en && tegra_hv_ivc_can_read(pp->ivck)) + tegra_hv_comm_rx_chars(pp); - tegra_hv_comm_tx_chars(pp); - xmit_timer_setup(pp, 0); + tegra_hv_comm_tx_chars(pp); + xmit_timer_setup(pp, 0); + } spin_unlock(&port->lock); @@ -543,6 +546,13 @@ static int tegra_hv_comm_probe(struct platform_device *pdev) port->ops = &tegra_hv_comm_ops; port->flags = UPF_BOOT_AUTOCONF; + /* + * start the channel reset process asynchronously. until the reset + * process completes, any attempt to use the ivc channel will return + * an error (e.g., all transmits will fail.) + */ + tegra_hv_ivc_channel_reset(pp->ivck); + ret = uart_add_one_port(&tegra_hv_comm_driver, port); if (ret != 0) { dev_err(dev, "uart_add_one_port failed\n"); -- cgit v1.2.2