ar71xx: revert DIR-825-B1 wholeflash image support.
[oweals/openwrt.git] / target / linux / lantiq / patches-3.3 / 0012-tty-support.patch
1 From 3b11721314a100e40634a80062d0d2cce1dc83dc Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Fri, 3 Aug 2012 09:54:27 +0200
4 Subject: [PATCH 12/25] tty support
5
6 ---
7  drivers/tty/serial/lantiq.c |   25 +++++++++++++++++++++----
8  1 files changed, 21 insertions(+), 4 deletions(-)
9
10 diff --git a/drivers/tty/serial/lantiq.c b/drivers/tty/serial/lantiq.c
11 index 96c1cac..82956de 100644
12 --- a/drivers/tty/serial/lantiq.c
13 +++ b/drivers/tty/serial/lantiq.c
14 @@ -107,6 +107,9 @@
15  #define ASCFSTAT_TXFREEMASK    0x3F000000
16  #define ASCFSTAT_TXFREEOFF     24
17  
18 +#define MUXC_SIF_RX_PIN                112
19 +#define MUXC_SIF_TX_PIN                113
20 +
21  static void lqasc_tx_chars(struct uart_port *port);
22  static struct ltq_uart_port *lqasc_port[MAXPORTS];
23  static struct uart_driver lqasc_reg;
24 @@ -114,6 +117,7 @@ static DEFINE_SPINLOCK(ltq_asc_lock);
25  
26  struct ltq_uart_port {
27         struct uart_port        port;
28 +       struct clk              *fpiclk;
29         struct clk              *clk;
30         unsigned int            tx_irq;
31         unsigned int            rx_irq;
32 @@ -316,7 +320,7 @@ lqasc_startup(struct uart_port *port)
33         struct ltq_uart_port *ltq_port = to_ltq_uart_port(port);
34         int retval;
35  
36 -       port->uartclk = clk_get_rate(ltq_port->clk);
37 +       port->uartclk = clk_get_rate(ltq_port->fpiclk);
38  
39         ltq_w32_mask(ASCCLC_DISS | ASCCLC_RMCMASK, (1 << ASCCLC_RMCOFFSET),
40                 port->membase + LTQ_ASC_CLC);
41 @@ -529,6 +533,19 @@ lqasc_request_port(struct uart_port *port)
42                 if (port->membase == NULL)
43                         return -ENOMEM;
44         }
45 +       if (ltq_is_falcon() && (port->line == 1)) {
46 +               struct ltq_uart_port *ltq_port = lqasc_port[pdev->id];
47 +               if (ltq_gpio_request(&pdev->dev, MUXC_SIF_RX_PIN,
48 +                               3, 0, "asc1-rx"))
49 +                       return -EBUSY;
50 +               if (ltq_gpio_request(&pdev->dev, MUXC_SIF_TX_PIN,
51 +                               3, 1, "asc1-tx"))
52 +                       return -EBUSY;
53 +               ltq_port->clk = clk_get(&pdev->dev, NULL);
54 +               if (IS_ERR(ltq_port->clk))
55 +                       return PTR_ERR(ltq_port->clk);
56 +               clk_enable(ltq_port->clk);
57 +       }
58         return 0;
59  }
60  
61 @@ -630,7 +647,7 @@ lqasc_console_setup(struct console *co, char *options)
62  
63         port = &ltq_port->port;
64  
65 -       port->uartclk = clk_get_rate(ltq_port->clk);
66 +       port->uartclk = clk_get_rate(ltq_port->fpiclk);
67  
68         if (options)
69                 uart_parse_options(options, &baud, &parity, &bits, &flow);
70 @@ -686,7 +703,7 @@ lqasc_probe(struct platform_device *pdev)
71         if (lqasc_port[pdev->id] != NULL)
72                 return -EBUSY;
73  
74 -       clk = clk_get(&pdev->dev, "fpi");
75 +       clk = clk_get_fpi();
76         if (IS_ERR(clk)) {
77                 pr_err("failed to get fpi clk\n");
78                 return -ENOENT;
79 @@ -715,7 +732,7 @@ lqasc_probe(struct platform_device *pdev)
80         port->irq       = tx_irq; /* unused, just to be backward-compatibe */
81         port->mapbase   = mmres->start;
82  
83 -       ltq_port->clk   = clk;
84 +       ltq_port->fpiclk = clk;
85  
86         ltq_port->tx_irq = tx_irq;
87         ltq_port->rx_irq = rx_irq;
88 -- 
89 1.7.9.1
90