677ebf76f4c63944234321e7338e842f2aaf79f3
[openwrt/svn-archive/archive.git] / target / linux / xburst / patches-2.6.35 / 012-serial.patch
1 From d9d3dc9a5a28b2bbb82fedca63aadae8ca540e94 Mon Sep 17 00:00:00 2001
2 From: Lars-Peter Clausen <lars@metafoo.de>
3 Date: Sat, 19 Jun 2010 04:08:16 +0000
4 Subject: [PATCH] MIPS: JZ4740: Add serial support
5
6 The JZ4740 UART interface is almost 16550 compatible.
7 The UART module needs to be enabled by setting a bit in the FCR register
8 and it has support for receive timeout interrupts. Instead of adding yet
9 another machine specific quirk to the 8250 serial driver we provide a
10 serial_out implementation which sets the required additional flags.
11
12 Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
13 Cc: linux-mips@linux-mips.org
14 Cc: linux-kernel@vger.kernel.org
15 Patchwork: https://patchwork.linux-mips.org/patch/1403/
16 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
17 ---
18 arch/mips/jz4740/serial.c | 33 +++++++++++++++++++++++++++++++++
19 arch/mips/jz4740/serial.h | 20 ++++++++++++++++++++
20 2 files changed, 53 insertions(+), 0 deletions(-)
21 create mode 100644 arch/mips/jz4740/serial.c
22 create mode 100644 arch/mips/jz4740/serial.h
23
24 --- /dev/null
25 +++ b/arch/mips/jz4740/serial.c
26 @@ -0,0 +1,33 @@
27 +/*
28 + * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
29 + * JZ4740 serial support
30 + *
31 + * This program is free software; you can redistribute it and/or modify it
32 + * under the terms of the GNU General Public License as published by the
33 + * Free Software Foundation; either version 2 of the License, or (at your
34 + * option) any later version.
35 + *
36 + * You should have received a copy of the GNU General Public License along
37 + * with this program; if not, write to the Free Software Foundation, Inc.,
38 + * 675 Mass Ave, Cambridge, MA 02139, USA.
39 + *
40 + */
41 +
42 +#include <linux/io.h>
43 +#include <linux/serial_core.h>
44 +#include <linux/serial_reg.h>
45 +
46 +void jz4740_serial_out(struct uart_port *p, int offset, int value)
47 +{
48 + switch (offset) {
49 + case UART_FCR:
50 + value |= 0x10; /* Enable uart module */
51 + break;
52 + case UART_IER:
53 + value |= (value & 0x4) << 2;
54 + break;
55 + default:
56 + break;
57 + }
58 + writeb(value, p->membase + (offset << p->regshift));
59 +}
60 --- /dev/null
61 +++ b/arch/mips/jz4740/serial.h
62 @@ -0,0 +1,20 @@
63 +/*
64 + * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
65 + * JZ4740 serial support
66 + *
67 + * This program is free software; you can redistribute it and/or modify it
68 + * under the terms of the GNU General Public License as published by the
69 + * Free Software Foundation; either version 2 of the License, or (at your
70 + * option) any later version.
71 + *
72 + * You should have received a copy of the GNU General Public License along
73 + * with this program; if not, write to the Free Software Foundation, Inc.,
74 + * 675 Mass Ave, Cambridge, MA 02139, USA.
75 + *
76 + */
77 +
78 +#ifndef __MIPS_JZ4740_SERIAL_H__
79 +
80 +void jz4740_serial_out(struct uart_port *p, int offset, int value);
81 +
82 +#endif