diff options
Diffstat (limited to 'Documentation/serial/serial-rs485.txt')
-rw-r--r-- | Documentation/serial/serial-rs485.txt | 50 |
1 files changed, 5 insertions, 45 deletions
diff --git a/Documentation/serial/serial-rs485.txt b/Documentation/serial/serial-rs485.txt index 39dac95422a3..2253b8b45a74 100644 --- a/Documentation/serial/serial-rs485.txt +++ b/Documentation/serial/serial-rs485.txt | |||
@@ -33,50 +33,10 @@ | |||
33 | the values given by the device tree. | 33 | the values given by the device tree. |
34 | 34 | ||
35 | Any driver for devices capable of working both as RS232 and RS485 should | 35 | Any driver for devices capable of working both as RS232 and RS485 should |
36 | provide at least the following ioctls: | 36 | implement the rs485_config callback in the uart_port structure. The |
37 | 37 | serial_core calls rs485_config to do the device specific part in response | |
38 | - TIOCSRS485 (typically associated with number 0x542F). This ioctl is used | 38 | to TIOCSRS485 and TIOCGRS485 ioctls (see below). The rs485_config callback |
39 | to enable/disable RS485 mode from user-space | 39 | receives a pointer to struct serial_rs485. |
40 | |||
41 | - TIOCGRS485 (typically associated with number 0x542E). This ioctl is used | ||
42 | to get RS485 mode from kernel-space (i.e., driver) to user-space. | ||
43 | |||
44 | In other words, the serial driver should contain a code similar to the next | ||
45 | one: | ||
46 | |||
47 | static struct uart_ops atmel_pops = { | ||
48 | /* ... */ | ||
49 | .ioctl = handle_ioctl, | ||
50 | }; | ||
51 | |||
52 | static int handle_ioctl(struct uart_port *port, | ||
53 | unsigned int cmd, | ||
54 | unsigned long arg) | ||
55 | { | ||
56 | struct serial_rs485 rs485conf; | ||
57 | |||
58 | switch (cmd) { | ||
59 | case TIOCSRS485: | ||
60 | if (copy_from_user(&rs485conf, | ||
61 | (struct serial_rs485 *) arg, | ||
62 | sizeof(rs485conf))) | ||
63 | return -EFAULT; | ||
64 | |||
65 | /* ... */ | ||
66 | break; | ||
67 | |||
68 | case TIOCGRS485: | ||
69 | if (copy_to_user((struct serial_rs485 *) arg, | ||
70 | ..., | ||
71 | sizeof(rs485conf))) | ||
72 | return -EFAULT; | ||
73 | /* ... */ | ||
74 | break; | ||
75 | |||
76 | /* ... */ | ||
77 | } | ||
78 | } | ||
79 | |||
80 | 40 | ||
81 | 4. USAGE FROM USER-LEVEL | 41 | 4. USAGE FROM USER-LEVEL |
82 | 42 | ||
@@ -85,7 +45,7 @@ | |||
85 | 45 | ||
86 | #include <linux/serial.h> | 46 | #include <linux/serial.h> |
87 | 47 | ||
88 | /* Driver-specific ioctls: */ | 48 | /* RS485 ioctls: */ |
89 | #define TIOCGRS485 0x542E | 49 | #define TIOCGRS485 0x542E |
90 | #define TIOCSRS485 0x542F | 50 | #define TIOCSRS485 0x542F |
91 | 51 | ||