aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-01-07 17:39:20 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-07 17:39:20 -0500
commit56b85f32d530d09d6805488ad00775d4e0e3baab (patch)
treee7fbe69e338ef775d3b2dd822aa915d259b4bc94 /Documentation
parent3e5b08cbbf78bedd316904ab0cf3b27119433ee5 (diff)
parent568389c257fa7d74ce36c2f78bad31965fded4cf (diff)
Merge branch 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6
* 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6: (36 commits) serial: apbuart: Fixup apbuart_console_init() TTY: Add tty ioctl to figure device node of the system console. tty: add 'active' sysfs attribute to tty0 and console device drivers: serial: apbuart: Handle OF failures gracefully Serial: Avoid unbalanced IRQ wake disable during resume tty: fix typos/errors in tty_driver.h comments pch_uart : fix warnings for 64bit compile 8250: fix uninitialized FIFOs ip2: fix compiler warning on ip2main_pci_tbl specialix: fix compiler warning on specialix_pci_tbl rocket: fix compiler warning on rocket_pci_ids 8250: add a UPIO_DWAPB32 for 32 bit accesses 8250: use container_of() instead of casting serial: omap-serial: Add support for kernel debugger serial: fix pch_uart kconfig & build drivers: char: hvc: add arm JTAG DCC console support RS485 documentation: add 16C950 UART description serial: ifx6x60: fix memory leak serial: ifx6x60: free IRQ on error Serial: EG20T: add PCH_UART driver ... Fixed up conflicts in drivers/serial/apbuart.c with evil merge that makes the code look fairly sane (unlike either side).
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/ABI/testing/sysfs-tty19
-rw-r--r--Documentation/filesystems/proc.txt24
-rw-r--r--Documentation/serial/00-INDEX2
-rw-r--r--Documentation/serial/serial-rs485.txt120
4 files changed, 165 insertions, 0 deletions
diff --git a/Documentation/ABI/testing/sysfs-tty b/Documentation/ABI/testing/sysfs-tty
new file mode 100644
index 000000000000..b138b663bf54
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-tty
@@ -0,0 +1,19 @@
1What: /sys/class/tty/console/active
2Date: Nov 2010
3Contact: Kay Sievers <kay.sievers@vrfy.org>
4Description:
5 Shows the list of currently configured
6 console devices, like 'tty1 ttyS0'.
7 The last entry in the file is the active
8 device connected to /dev/console.
9 The file supports poll() to detect virtual
10 console switches.
11
12What: /sys/class/tty/tty0/active
13Date: Nov 2010
14Contact: Kay Sievers <kay.sievers@vrfy.org>
15Description:
16 Shows the currently active virtual console
17 device, like 'tty1'.
18 The file supports poll() to detect virtual
19 console switches.
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index e73df2722ff3..9471225212c4 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -1181,6 +1181,30 @@ Table 1-12: Files in /proc/fs/ext4/<devname>
1181 mb_groups details of multiblock allocator buddy cache of free blocks 1181 mb_groups details of multiblock allocator buddy cache of free blocks
1182.............................................................................. 1182..............................................................................
1183 1183
11842.0 /proc/consoles
1185------------------
1186Shows registered system console lines.
1187
1188To see which character device lines are currently used for the system console
1189/dev/console, you may simply look into the file /proc/consoles:
1190
1191 > cat /proc/consoles
1192 tty0 -WU (ECp) 4:7
1193 ttyS0 -W- (Ep) 4:64
1194
1195The columns are:
1196
1197 device name of the device
1198 operations R = can do read operations
1199 W = can do write operations
1200 U = can do unblank
1201 flags E = it is enabled
1202 C = it is prefered console
1203 B = it is primary boot console
1204 p = it is used for printk buffer
1205 b = it is not a TTY but a Braille device
1206 a = it is safe to use when cpu is offline
1207 major:minor major and minor number of the device separated by a colon
1184 1208
1185------------------------------------------------------------------------------ 1209------------------------------------------------------------------------------
1186Summary 1210Summary
diff --git a/Documentation/serial/00-INDEX b/Documentation/serial/00-INDEX
index 07dcdb0d2a36..e09468ad3cb1 100644
--- a/Documentation/serial/00-INDEX
+++ b/Documentation/serial/00-INDEX
@@ -14,6 +14,8 @@ riscom8.txt
14 - notes on using the RISCom/8 multi-port serial driver. 14 - notes on using the RISCom/8 multi-port serial driver.
15rocket.txt 15rocket.txt
16 - info on the Comtrol RocketPort multiport serial driver. 16 - info on the Comtrol RocketPort multiport serial driver.
17serial-rs485.txt
18 - info about RS485 structures and support in the kernel.
17specialix.txt 19specialix.txt
18 - info on hardware/driver for specialix IO8+ multiport serial card. 20 - info on hardware/driver for specialix IO8+ multiport serial card.
19stallion.txt 21stallion.txt
diff --git a/Documentation/serial/serial-rs485.txt b/Documentation/serial/serial-rs485.txt
new file mode 100644
index 000000000000..a4932387bbfb
--- /dev/null
+++ b/Documentation/serial/serial-rs485.txt
@@ -0,0 +1,120 @@
1 RS485 SERIAL COMMUNICATIONS
2
31. INTRODUCTION
4
5 EIA-485, also known as TIA/EIA-485 or RS-485, is a standard defining the
6 electrical characteristics of drivers and receivers for use in balanced
7 digital multipoint systems.
8 This standard is widely used for communications in industrial automation
9 because it can be used effectively over long distances and in electrically
10 noisy environments.
11
122. HARDWARE-RELATED CONSIDERATIONS
13
14 Some CPUs/UARTs (e.g., Atmel AT91 or 16C950 UART) contain a built-in
15 half-duplex mode capable of automatically controlling line direction by
16 toggling RTS or DTR signals. That can be used to control external
17 half-duplex hardware like an RS485 transceiver or any RS232-connected
18 half-duplex devices like some modems.
19
20 For these microcontrollers, the Linux driver should be made capable of
21 working in both modes, and proper ioctls (see later) should be made
22 available at user-level to allow switching from one mode to the other, and
23 vice versa.
24
253. DATA STRUCTURES ALREADY AVAILABLE IN THE KERNEL
26
27 The Linux kernel provides the serial_rs485 structure (see [1]) to handle
28 RS485 communications. This data structure is used to set and configure RS485
29 parameters in the platform data and in ioctls.
30
31 Any driver for devices capable of working both as RS232 and RS485 should
32 provide at least the following ioctls:
33
34 - TIOCSRS485 (typically associated with number 0x542F). This ioctl is used
35 to enable/disable RS485 mode from user-space
36
37 - TIOCGRS485 (typically associated with number 0x542E). This ioctl is used
38 to get RS485 mode from kernel-space (i.e., driver) to user-space.
39
40 In other words, the serial driver should contain a code similar to the next
41 one:
42
43 static struct uart_ops atmel_pops = {
44 /* ... */
45 .ioctl = handle_ioctl,
46 };
47
48 static int handle_ioctl(struct uart_port *port,
49 unsigned int cmd,
50 unsigned long arg)
51 {
52 struct serial_rs485 rs485conf;
53
54 switch (cmd) {
55 case TIOCSRS485:
56 if (copy_from_user(&rs485conf,
57 (struct serial_rs485 *) arg,
58 sizeof(rs485conf)))
59 return -EFAULT;
60
61 /* ... */
62 break;
63
64 case TIOCGRS485:
65 if (copy_to_user((struct serial_rs485 *) arg,
66 ...,
67 sizeof(rs485conf)))
68 return -EFAULT;
69 /* ... */
70 break;
71
72 /* ... */
73 }
74 }
75
76
774. USAGE FROM USER-LEVEL
78
79 From user-level, RS485 configuration can be get/set using the previous
80 ioctls. For instance, to set RS485 you can use the following code:
81
82 #include <linux/serial.h>
83
84 /* Driver-specific ioctls: */
85 #define TIOCGRS485 0x542E
86 #define TIOCSRS485 0x542F
87
88 /* Open your specific device (e.g., /dev/mydevice): */
89 int fd = open ("/dev/mydevice", O_RDWR);
90 if (fd < 0) {
91 /* Error handling. See errno. */
92 }
93
94 struct serial_rs485 rs485conf;
95
96 /* Set RS485 mode: */
97 rs485conf.flags |= SER_RS485_ENABLED;
98
99 /* Set rts delay before send, if needed: */
100 rs485conf.flags |= SER_RS485_RTS_BEFORE_SEND;
101 rs485conf.delay_rts_before_send = ...;
102
103 /* Set rts delay after send, if needed: */
104 rs485conf.flags |= SER_RS485_RTS_AFTER_SEND;
105 rs485conf.delay_rts_after_send = ...;
106
107 if (ioctl (fd, TIOCSRS485, &rs485conf) < 0) {
108 /* Error handling. See errno. */
109 }
110
111 /* Use read() and write() syscalls here... */
112
113 /* Close the device when finished: */
114 if (close (fd) < 0) {
115 /* Error handling. See errno. */
116 }
117
1185. REFERENCES
119
120 [1] include/linux/serial.h