Skip to content

Commit

Permalink
Merge tag 'tty-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/…
Browse files Browse the repository at this point in the history
…git/gregkh/tty

Pull tty / serial updates from Greg KH:
 "Here is the big set of tty and serial driver changes for 6.8-rc1.

  As usual, Jiri has a bunch of refactoring and cleanups for the tty
  core and drivers in here, along with the usual set of rs485 updates
  (someday this might work properly...)

  Along with those, in here are changes for:

   - sc16is7xx serial driver updates

   - platform driver removal api updates

   - amba-pl011 driver updates

   - tty driver binding updates

   - other small tty/serial driver updates and changes

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'tty-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (197 commits)
  serial: sc16is7xx: refactor EFR lock
  serial: sc16is7xx: reorder code to remove prototype declarations
  serial: sc16is7xx: refactor FIFO access functions to increase commonality
  serial: sc16is7xx: drop unneeded MODULE_ALIAS
  serial: sc16is7xx: replace hardcoded divisor value with BIT() macro
  serial: sc16is7xx: add explicit return for some switch default cases
  serial: sc16is7xx: add macro for max number of UART ports
  serial: sc16is7xx: add driver name to struct uart_driver
  serial: sc16is7xx: use i2c_get_match_data()
  serial: sc16is7xx: use spi_get_device_match_data()
  serial: sc16is7xx: use DECLARE_BITMAP for sc16is7xx_lines bitfield
  serial: sc16is7xx: improve do/while loop in sc16is7xx_irq()
  serial: sc16is7xx: remove obsolete loop in sc16is7xx_port_irq()
  serial: sc16is7xx: set safe default SPI clock frequency
  serial: sc16is7xx: add check for unsupported SPI modes during probe
  serial: sc16is7xx: fix invalid sc16is7xx_lines bitfield in case of probe error
  serial: 8250_exar: Set missing rs485_supported flag
  serial: omap: do not override settings for RS485 support
  serial: core, imx: do not set RS485 enabled if it is not supported
  serial: core: make sure RS485 cannot be enabled when it is not supported
  ...
  • Loading branch information
torvalds committed Jan 18, 2024
2 parents e38f734 + 0c84bea commit bd736f3
Show file tree
Hide file tree
Showing 172 changed files with 1,673 additions and 1,568 deletions.
3 changes: 3 additions & 0 deletions Documentation/admin-guide/devices.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2704,6 +2704,9 @@
...
185 = /dev/ttyNX15 Hilscher netX serial port 15
186 = /dev/ttyJ0 JTAG1 DCC protocol based serial port emulation

If maximum number of uartlite serial ports is more than 4, then the driver
uses dynamic allocation instead of static allocation for major number.
187 = /dev/ttyUL0 Xilinx uartlite - port 0
...
190 = /dev/ttyUL3 Xilinx uartlite - port 3
Expand Down
11 changes: 10 additions & 1 deletion Documentation/admin-guide/sysrq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,19 @@ On other
submit a patch to be included in this section.

On all
Write a character to /proc/sysrq-trigger. e.g.::
Write a single character to /proc/sysrq-trigger.
Only the first character is processed, the rest of the string is
ignored. However, it is not recommended to write any extra characters
as the behavior is undefined and might change in the future versions.
E.g.::

echo t > /proc/sysrq-trigger

Alternatively, write multiple characters prepended by underscore.
This way, all characters will be processed. E.g.::

echo _reisub > /proc/sysrq-trigger

The :kbd:`<command key>` is case sensitive.

What are the 'command' keys?
Expand Down
30 changes: 30 additions & 0 deletions Documentation/devicetree/bindings/serial/arm,dcc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/serial/arm,dcc.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: ARM DCC (Data communication channel) serial emulation

maintainers:
- Michal Simek <[email protected]>

description: |
ARM DCC (Data communication channel) serial emulation interface available
via JTAG can be also used as one of serial line tightly coupled with every
ARM CPU available in the system.
properties:
compatible:
const: arm,dcc

required:
- compatible

additionalProperties: false

examples:
- |
serial {
compatible = "arm,dcc";
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ description: |
https://www.nxp.com/webapp/Download?colCode=S32V234RM.
maintainers:
- Chester Lin <clin@suse.com>
- Chester Lin <chester62515@gmail.com>

allOf:
- $ref: serial.yaml#
Expand Down
29 changes: 24 additions & 5 deletions Documentation/devicetree/bindings/serial/fsl-imx-uart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ title: Freescale i.MX Universal Asynchronous Receiver/Transmitter (UART)
maintainers:
- Fabio Estevam <[email protected]>

allOf:
- $ref: serial.yaml#
- $ref: rs485.yaml#

properties:
compatible:
oneOf:
Expand Down Expand Up @@ -68,7 +64,11 @@ properties:
- const: tx

interrupts:
maxItems: 1
items:
- description: UART RX Interrupt
- description: UART TX Interrupt
- description: UART RTS Interrupt
minItems: 1

wakeup-source: true

Expand Down Expand Up @@ -110,6 +110,25 @@ required:
- clock-names
- interrupts

allOf:
- $ref: serial.yaml#
- $ref: rs485.yaml#

- if:
properties:
compatible:
contains:
const: fsl,imx1-uart
then:
properties:
interrupts:
minItems: 3
maxItems: 3
else:
properties:
interrupts:
maxItems: 1

unevaluatedProperties: false

examples:
Expand Down
13 changes: 13 additions & 0 deletions Documentation/devicetree/bindings/serial/qcom,msm-uartdm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,17 @@ properties:
- const: tx
- const: rx

interconnects:
maxItems: 1

interrupts:
maxItems: 1

operating-points-v2: true

power-domains:
maxItems: 1

qcom,rx-crci:
$ref: /schemas/types.yaml#/definitions/uint32
description:
Expand Down Expand Up @@ -99,7 +107,9 @@ unevaluatedProperties: false

examples:
- |
#include <dt-bindings/interconnect/qcom,msm8996.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/power/qcom-rpmpd.h>
serial@f991e000 {
compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm";
Expand All @@ -109,4 +119,7 @@ examples:
clock-names = "core", "iface";
dmas = <&dma0 0>, <&dma0 1>;
dma-names = "tx", "rx";
power-domains = <&rpmpd MSM8996_VDDCX>;
operating-points-v2 = <&uart_opp_table>;
interconnects = <&pnoc MASTER_BLSP_1 &bimc SLAVE_EBI_CH0>;
};
2 changes: 1 addition & 1 deletion Documentation/devicetree/bindings/serial/renesas,sci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ properties:
oneOf:
- items:
- enum:
- renesas,r9a07g043-sci # RZ/G2UL
- renesas,r9a07g043-sci # RZ/G2UL and RZ/Five
- renesas,r9a07g044-sci # RZ/G2{L,LC}
- renesas,r9a07g054-sci # RZ/V2L
- const: renesas,sci # generic SCI compatible UART
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ maintainers:

allOf:
- $ref: serial.yaml#
- $ref: rs485.yaml#

properties:
compatible:
Expand Down
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/serial/sprd-uart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ properties:
- sprd,sc9860-uart
- sprd,sc9863a-uart
- sprd,ums512-uart
- sprd,ums9620-uart
- const: sprd,sc9836-uart
- const: sprd,sc9836-uart

Expand Down
1 change: 0 additions & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -23185,7 +23185,6 @@ M: Amit Shah <[email protected]>
L: [email protected]
S: Maintained
F: drivers/char/virtio_console.c
F: include/linux/virtio_console.h
F: include/uapi/linux/virtio_console.h

VIRTIO CORE AND NET DRIVERS
Expand Down
34 changes: 15 additions & 19 deletions arch/alpha/kernel/srmcons.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ srmcons_do_receive_chars(struct tty_port *port)
do {
result.as_long = callback_getc(0);
if (result.bits.status < 2) {
tty_insert_flip_char(port, (char)result.bits.c, 0);
tty_insert_flip_char(port, (u8)result.bits.c, 0);
count++;
}
} while((result.bits.status & 1) && (++loops < 10));
Expand Down Expand Up @@ -88,30 +88,27 @@ srmcons_receive_chars(struct timer_list *t)
}

/* called with callback_lock held */
static int
srmcons_do_write(struct tty_port *port, const char *buf, int count)
static void
srmcons_do_write(struct tty_port *port, const u8 *buf, size_t count)
{
static char str_cr[1] = "\r";
long c, remaining = count;
size_t c;
srmcons_result result;
char *cur;
int need_cr;

for (cur = (char *)buf; remaining > 0; ) {
need_cr = 0;
while (count > 0) {
bool need_cr = false;
/*
* Break it up into reasonable size chunks to allow a chance
* for input to get in
*/
for (c = 0; c < min_t(long, 128L, remaining) && !need_cr; c++)
if (cur[c] == '\n')
need_cr = 1;
for (c = 0; c < min_t(size_t, 128U, count) && !need_cr; c++)
if (buf[c] == '\n')
need_cr = true;

while (c > 0) {
result.as_long = callback_puts(0, cur, c);
result.as_long = callback_puts(0, buf, c);
c -= result.bits.c;
remaining -= result.bits.c;
cur += result.bits.c;
count -= result.bits.c;
buf += result.bits.c;

/*
* Check for pending input iff a tty port was provided
Expand All @@ -121,12 +118,11 @@ srmcons_do_write(struct tty_port *port, const char *buf, int count)
}

while (need_cr) {
result.as_long = callback_puts(0, str_cr, 1);
result.as_long = callback_puts(0, "\r", 1);
if (result.bits.c > 0)
need_cr = 0;
need_cr = false;
}
}
return count;
}

static ssize_t
Expand All @@ -135,7 +131,7 @@ srmcons_write(struct tty_struct *tty, const u8 *buf, size_t count)
unsigned long flags;

spin_lock_irqsave(&srmcons_callback_lock, flags);
srmcons_do_write(tty->port, (const char *) buf, count);
srmcons_do_write(tty->port, buf, count);
spin_unlock_irqrestore(&srmcons_callback_lock, flags);

return count;
Expand Down
4 changes: 2 additions & 2 deletions arch/m68k/emu/nfcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ static int stderr_id;
static struct tty_port nfcon_tty_port;
static struct tty_driver *nfcon_tty_driver;

static void nfputs(const char *str, unsigned int count)
static void nfputs(const u8 *str, size_t count)
{
char buf[68];
u8 buf[68];
unsigned long phys = virt_to_phys(buf);

buf[64] = 0;
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/include/asm/hvconsole.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
* Vio firmware always attempts to fetch MAX_VIO_GET_CHARS chars. The 'count'
* parm is included to conform to put_chars() function pointer template
*/
extern int hvc_get_chars(uint32_t vtermno, char *buf, int count);
extern int hvc_put_chars(uint32_t vtermno, const char *buf, int count);
extern ssize_t hvc_get_chars(uint32_t vtermno, u8 *buf, size_t count);
extern ssize_t hvc_put_chars(uint32_t vtermno, const u8 *buf, size_t count);

/* Provided by HVC VIO */
void hvc_vio_init_early(void);
Expand Down
18 changes: 10 additions & 8 deletions arch/powerpc/include/asm/hvsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,32 +64,34 @@ struct hvsi_priv {
unsigned int inbuf_len; /* data in input buffer */
unsigned char inbuf[HVSI_INBUF_SIZE];
unsigned int inbuf_cur; /* Cursor in input buffer */
unsigned int inbuf_pktlen; /* packet length from cursor */
size_t inbuf_pktlen; /* packet length from cursor */
atomic_t seqno; /* packet sequence number */
unsigned int opened:1; /* driver opened */
unsigned int established:1; /* protocol established */
unsigned int is_console:1; /* used as a kernel console device */
unsigned int mctrl_update:1; /* modem control updated */
unsigned short mctrl; /* modem control */
struct tty_struct *tty; /* tty structure */
int (*get_chars)(uint32_t termno, char *buf, int count);
int (*put_chars)(uint32_t termno, const char *buf, int count);
ssize_t (*get_chars)(uint32_t termno, u8 *buf, size_t count);
ssize_t (*put_chars)(uint32_t termno, const u8 *buf, size_t count);
uint32_t termno;
};

/* hvsi lib functions */
struct hvc_struct;
extern void hvsilib_init(struct hvsi_priv *pv,
int (*get_chars)(uint32_t termno, char *buf, int count),
int (*put_chars)(uint32_t termno, const char *buf,
int count),
ssize_t (*get_chars)(uint32_t termno, u8 *buf,
size_t count),
ssize_t (*put_chars)(uint32_t termno, const u8 *buf,
size_t count),
int termno, int is_console);
extern int hvsilib_open(struct hvsi_priv *pv, struct hvc_struct *hp);
extern void hvsilib_close(struct hvsi_priv *pv, struct hvc_struct *hp);
extern int hvsilib_read_mctrl(struct hvsi_priv *pv);
extern int hvsilib_write_mctrl(struct hvsi_priv *pv, int dtr);
extern void hvsilib_establish(struct hvsi_priv *pv);
extern int hvsilib_get_chars(struct hvsi_priv *pv, char *buf, int count);
extern int hvsilib_put_chars(struct hvsi_priv *pv, const char *buf, int count);
extern ssize_t hvsilib_get_chars(struct hvsi_priv *pv, u8 *buf, size_t count);
extern ssize_t hvsilib_put_chars(struct hvsi_priv *pv, const u8 *buf,
size_t count);

#endif /* _HVSI_H */
8 changes: 5 additions & 3 deletions arch/powerpc/include/asm/opal.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,11 @@ extern int early_init_dt_scan_recoverable_ranges(unsigned long node,
const char *uname, int depth, void *data);
void __init opal_configure_cores(void);

extern int opal_get_chars(uint32_t vtermno, char *buf, int count);
extern int opal_put_chars(uint32_t vtermno, const char *buf, int total_len);
extern int opal_put_chars_atomic(uint32_t vtermno, const char *buf, int total_len);
extern ssize_t opal_get_chars(uint32_t vtermno, u8 *buf, size_t count);
extern ssize_t opal_put_chars(uint32_t vtermno, const u8 *buf,
size_t total_len);
extern ssize_t opal_put_chars_atomic(uint32_t vtermno, const u8 *buf,
size_t total_len);
extern int opal_flush_chars(uint32_t vtermno, bool wait);
extern int opal_flush_console(uint32_t vtermno);

Expand Down
14 changes: 8 additions & 6 deletions arch/powerpc/platforms/powernv/opal.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ static int __init opal_message_init(struct device_node *opal_node)
return 0;
}

int opal_get_chars(uint32_t vtermno, char *buf, int count)
ssize_t opal_get_chars(uint32_t vtermno, u8 *buf, size_t count)
{
s64 rc;
__be64 evt, len;
Expand All @@ -441,10 +441,11 @@ int opal_get_chars(uint32_t vtermno, char *buf, int count)
return 0;
}

static int __opal_put_chars(uint32_t vtermno, const char *data, int total_len, bool atomic)
static ssize_t __opal_put_chars(uint32_t vtermno, const u8 *data,
size_t total_len, bool atomic)
{
unsigned long flags = 0 /* shut up gcc */;
int written;
ssize_t written;
__be64 olen;
s64 rc;

Expand Down Expand Up @@ -484,7 +485,7 @@ static int __opal_put_chars(uint32_t vtermno, const char *data, int total_len, b
if (atomic) {
/* Should not happen */
pr_warn("atomic console write returned partial "
"len=%d written=%d\n", total_len, written);
"len=%zu written=%zd\n", total_len, written);
}
if (!written)
written = -EAGAIN;
Expand All @@ -497,7 +498,7 @@ static int __opal_put_chars(uint32_t vtermno, const char *data, int total_len, b
return written;
}

int opal_put_chars(uint32_t vtermno, const char *data, int total_len)
ssize_t opal_put_chars(uint32_t vtermno, const u8 *data, size_t total_len)
{
return __opal_put_chars(vtermno, data, total_len, false);
}
Expand All @@ -508,7 +509,8 @@ int opal_put_chars(uint32_t vtermno, const char *data, int total_len)
* true at the moment because console space can race with OPAL's console
* writes.
*/
int opal_put_chars_atomic(uint32_t vtermno, const char *data, int total_len)
ssize_t opal_put_chars_atomic(uint32_t vtermno, const u8 *data,
size_t total_len)
{
return __opal_put_chars(vtermno, data, total_len, true);
}
Expand Down
Loading

0 comments on commit bd736f3

Please sign in to comment.