tty: serial: tegra: Add HW loopback support
Pradeep Goudagunta [Wed, 4 Jan 2012 11:10:05 +0000 (16:10 +0530)]
Add HW loopback support for testing purpose.

Bug 845036
Bug 921090

Signed-off-by: Pradeep Goudagunta <pgoudagunta@nvidia.com>

Change-Id: I202781ed0b42c1bed2b9aad9576cf74cb938f9e6
Reviewed-on: http://git-master/r/73149
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>

drivers/tty/serial/tegra_hsuart.c
include/linux/tegra_uart.h

index f94dc24..fecc3cf 100644 (file)
@@ -847,6 +847,7 @@ static int tegra_startup(struct uart_port *u)
        struct tegra_uart_port *t = container_of(u,
                struct tegra_uart_port, uport);
        int ret = 0;
+       struct tegra_uart_platform_data *pdata;
 
        t = container_of(u, struct tegra_uart_port, uport);
        sprintf(t->port_name, "tegra_uart_%d", u->line);
@@ -889,6 +890,9 @@ static int tegra_startup(struct uart_port *u)
        if (ret)
                goto fail;
 
+       pdata = u->dev->platform_data;
+       if (pdata->is_loopback)
+               t->mcr_shadow |= UART_MCR_LOOP;
        dev_dbg(u->dev, "Requesting IRQ %d\n", u->irq);
        msleep(1);
 
index 3d35e21..38912ea 100644 (file)
@@ -32,6 +32,7 @@ struct tegra_uart_platform_data {
        void (*wake_peer)(struct uart_port *);
        struct uart_clk_parent *parent_clk_list;
        int parent_clk_count;
+       bool is_loopback;
 };
 
 int tegra_uart_is_tx_empty(struct uart_port *);