Skip to content

Commit abfecb3

Browse files
committed
Merge tag 'tty-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty / serial driver updates from Greg KH: "Here is the big set of tty and serial driver updates for 5.16-rc1. Nothing major in here at all, just lots of tiny serial and tty driver updates for various reported things, and some good cleanups. These include: - more good tty api cleanups from Jiri - stm32 serial driver updates - softlockup fix for non-preempt systems under high serial load - rpmsg serial driver update - 8250 drivers updates and fixes - n_gsm line discipline fixes and updates as people are finally starting to use it. All of these have been in linux-next for a while now with no reported issues" * tag 'tty-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (86 commits) tty: Fix extra "not" in TTY_DRIVER_REAL_RAW description serial: cpm_uart: Protect udbg definitions by CONFIG_SERIAL_CPM_CONSOLE tty: rpmsg: Define tty name via constant string literal tty: rpmsg: Add pr_fmt() to prefix messages tty: rpmsg: Use dev_err_probe() in ->probe() tty: rpmsg: Unify variable used to keep an error code tty: rpmsg: Assign returned id to a local variable serial: stm32: push DMA RX data before suspending serial: stm32: terminate / restart DMA transfer at suspend / resume serial: stm32: rework RX dma initialization and release serial: 8250_pci: Remove empty stub pci_quatech_exit() serial: 8250_pci: Replace custom pci_match_id() implementation serial: xilinx_uartps: Fix race condition causing stuck TX serial: sunzilog: Mark sunzilog_putchar() __maybe_unused Revert "tty: hvc: pass DMA capable memory to put_chars()" Revert "virtio-console: remove unnecessary kmemdup()" serial: 8250_pci: Replace dev_*() by pci_*() macros serial: 8250_pci: Get rid of redundant 'else' keyword serial: 8250_pci: Refactor the loop in pci_ite887x_init() tty: add rpmsg driver ...
2 parents 95faf6b + cc8d7b4 commit abfecb3

66 files changed

Lines changed: 1667 additions & 860 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Documentation/devicetree/bindings/serial/8250_omap.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ required:
8686
- reg
8787
- interrupts
8888

89-
additionalProperties: false
89+
unevaluatedProperties: false
9090

9191
if:
9292
properties:

Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt

Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/serial/brcm,bcm6345-uart.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: BCM63xx UART
8+
9+
maintainers:
10+
- Rafał Miłecki <rafal@milecki.pl>
11+
12+
allOf:
13+
- $ref: serial.yaml#
14+
15+
properties:
16+
compatible:
17+
const: brcm,bcm6345-uart
18+
19+
reg:
20+
maxItems: 1
21+
22+
interrupts:
23+
maxItems: 1
24+
25+
clocks:
26+
maxItems: 1
27+
28+
clock-names:
29+
const: refclk
30+
31+
unevaluatedProperties: false
32+
33+
required:
34+
- reg
35+
- interrupts
36+
- clocks
37+
38+
examples:
39+
- |
40+
serial@14e00520 {
41+
compatible = "brcm,bcm6345-uart";
42+
reg = <0x14e00520 0x18>;
43+
interrupt-parent = <&periph_intc>;
44+
interrupts = <2>;
45+
clocks = <&periph_clk>;
46+
clock-names = "refclk";
47+
};

Documentation/devicetree/bindings/serial/samsung_uart.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ properties:
2626
- samsung,s3c6400-uart
2727
- samsung,s5pv210-uart
2828
- samsung,exynos4210-uart
29+
- samsung,exynos850-uart
2930

3031
reg:
3132
maxItems: 1

Documentation/devicetree/bindings/serial/sprd-uart.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ properties:
1919
- enum:
2020
- sprd,sc9860-uart
2121
- sprd,sc9863a-uart
22+
- sprd,ums512-uart
2223
- const: sprd,sc9836-uart
2324
- const: sprd,sc9836-uart
2425

Documentation/devicetree/bindings/serial/xlnx,opb-uartlite.txt

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/serial/xlnx,opb-uartlite.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Xilinx Axi Uartlite
8+
9+
maintainers:
10+
- Peter Korsgaard <jacmet@sunsite.dk>
11+
12+
properties:
13+
compatible:
14+
contains:
15+
enum:
16+
- xlnx,xps-uartlite-1.00.a
17+
- xlnx,opb-uartlite-1.00.b
18+
19+
reg:
20+
maxItems: 1
21+
22+
interrupts:
23+
maxItems: 1
24+
25+
port-number:
26+
$ref: /schemas/types.yaml#/definitions/uint32
27+
description: Set Uart port number
28+
29+
clocks:
30+
maxItems: 1
31+
32+
clock-names:
33+
const: s_axi_aclk
34+
35+
current-speed:
36+
$ref: /schemas/types.yaml#/definitions/uint32
37+
description:
38+
The fixed baud rate that the device was configured for.
39+
40+
xlnx,data-bits:
41+
enum: [5, 6, 7, 8]
42+
description:
43+
The fixed number of data bits that the device was configured for.
44+
45+
xlnx,use-parity:
46+
$ref: /schemas/types.yaml#/definitions/uint32
47+
enum: [0, 1]
48+
description:
49+
Whether parity checking was enabled when the device was configured.
50+
51+
xlnx,odd-parity:
52+
$ref: /schemas/types.yaml#/definitions/uint32
53+
enum: [0, 1]
54+
description:
55+
Whether odd parity was configured.
56+
57+
required:
58+
- compatible
59+
- reg
60+
- interrupts
61+
- current-speed
62+
- xlnx,data-bits
63+
- xlnx,use-parity
64+
65+
allOf:
66+
- $ref: /schemas/serial.yaml#
67+
- if:
68+
properties:
69+
xlnx,use-parity:
70+
contains:
71+
const: 1
72+
then:
73+
required:
74+
- xlnx,odd-parity
75+
76+
unevaluatedProperties: false
77+
78+
examples:
79+
- |
80+
serial@800c0000 {
81+
compatible = "xlnx,xps-uartlite-1.00.a";
82+
reg = <0x800c0000 0x10000>;
83+
interrupts = <0x0 0x6e 0x1>;
84+
port-number = <0>;
85+
current-speed = <115200>;
86+
xlnx,data-bits = <8>;
87+
xlnx,use-parity = <0>;
88+
};
89+
...

Documentation/driver-api/serial/n_gsm.rst

Lines changed: 62 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@ modems connected to a physical serial port.
1212

1313
How to use it
1414
-------------
15-
1. initialize the modem in 0710 mux mode (usually AT+CMUX= command) through
16-
its serial port. Depending on the modem used, you can pass more or less
17-
parameters to this command,
18-
2. switch the serial line to using the n_gsm line discipline by using
19-
TIOCSETD ioctl,
20-
3. configure the mux using GSMIOC_GETCONF / GSMIOC_SETCONF ioctl,
21-
4. obtain base gsmtty number for the used serial port,
15+
1. config initiator
16+
^^^^^^^^^^^^^^^^^^^^^
17+
18+
1.1 initialize the modem in 0710 mux mode (usually AT+CMUX= command) through
19+
its serial port. Depending on the modem used, you can pass more or less
20+
parameters to this command.
21+
1.2 switch the serial line to using the n_gsm line discipline by using
22+
TIOCSETD ioctl.
23+
1.3 configure the mux using GSMIOC_GETCONF / GSMIOC_SETCONF ioctl.
24+
1.4 obtain base gsmtty number for the used serial port.
2225

2326
Major parts of the initialization program :
2427
(a good starting point is util-linux-ng/sys-utils/ldattach.c)::
@@ -70,14 +73,14 @@ Major parts of the initialization program :
7073
daemon(0,0);
7174
pause();
7275

73-
5. use these devices as plain serial ports.
76+
1.5 use these devices as plain serial ports.
7477

7578
for example, it's possible:
7679

7780
- and to use gnokii to send / receive SMS on ttygsm1
7881
- to use ppp to establish a datalink on ttygsm2
7982

80-
6. first close all virtual ports before closing the physical port.
83+
1.6 first close all virtual ports before closing the physical port.
8184

8285
Note that after closing the physical port the modem is still in multiplexing
8386
mode. This may prevent a successful re-opening of the port later. To avoid
@@ -87,6 +90,56 @@ Major parts of the initialization program :
8790

8891
0xf9, 0x03, 0xef, 0x03, 0xc3, 0x16, 0xf9.
8992

93+
2. config requester
94+
^^^^^^^^^^^^^^^^^^^^^
95+
96+
2.1 receive string "AT+CMUX= command" through its serial port,initialize
97+
mux mode config
98+
2.2 switch the serial line to using the n_gsm line discipline by using
99+
TIOCSETD ioctl.
100+
2.3 configure the mux using GSMIOC_GETCONF / GSMIOC_SETCONF ioctl.
101+
2.4 obtain base gsmtty number for the used serial port,
102+
103+
#include <stdio.h>
104+
#include <stdint.h>
105+
#include <linux/gsmmux.h>
106+
#include <linux/tty.h>
107+
#define DEFAULT_SPEED B115200
108+
#define SERIAL_PORT /dev/ttyS0
109+
110+
int ldisc = N_GSM0710;
111+
struct gsm_config c;
112+
struct termios configuration;
113+
uint32_t first;
114+
115+
/* open the serial port */
116+
fd = open(SERIAL_PORT, O_RDWR | O_NOCTTY | O_NDELAY);
117+
118+
/* configure the serial port : speed, flow control ... */
119+
120+
/* get serial data and check "AT+CMUX=command" parameter ... */
121+
122+
/* use n_gsm line discipline */
123+
ioctl(fd, TIOCSETD, &ldisc);
124+
125+
/* get n_gsm configuration */
126+
ioctl(fd, GSMIOC_GETCONF, &c);
127+
/* we are requester and need encoding 0 (basic) */
128+
c.initiator = 0;
129+
c.encapsulation = 0;
130+
/* our modem defaults to a maximum size of 127 bytes */
131+
c.mru = 127;
132+
c.mtu = 127;
133+
/* set the new configuration */
134+
ioctl(fd, GSMIOC_SETCONF, &c);
135+
/* get first gsmtty device node */
136+
ioctl(fd, GSMIOC_GETFIRST, &first);
137+
printf("first muxed line: /dev/gsmtty%i\n", first);
138+
139+
/* and wait for ever to keep the line discipline enabled */
140+
daemon(0,0);
141+
pause();
142+
90143
Additional Documentation
91144
------------------------
92145
More practical details on the protocol and how it's supported by industrial

Documentation/driver-api/serial/tty.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ close() This is called on a terminal when the line
5858
hangup() Called when the tty line is hung up.
5959
The line discipline should cease I/O to the tty.
6060
No further calls into the ldisc code will occur.
61-
The return value is ignored. Can sleep.
61+
Can sleep.
6262

6363
read() (optional) A process requests reading data from
6464
the line. Multiple read calls may occur in parallel

arch/sh/boot/dts/j2_mimas_v2.dts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@
8888
clock-frequency = <125000000>;
8989
compatible = "xlnx,xps-uartlite-1.00.a";
9090
current-speed = <19200>;
91+
xlnx,use-parity = <0>;
92+
xlnx,data-bits = <8>;
9193
device_type = "serial";
9294
interrupts = <0x12>;
9395
port-number = <0>;

0 commit comments

Comments
 (0)