From 1e6128b63597adf97f1865fba7d778a6f8ccb7a0 Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Fri, 7 Feb 2014 18:16:05 +0400 Subject: serial: max310x: Remove init() and exit() callbacks These callbacks were previously used for the IC power initialization. If this initialization will be needed in the future, it should be implemented with the regulator API. Signed-off-by: Alexander Shiyan Signed-off-by: Greg Kroah-Hartman --- include/linux/platform_data/max310x.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'include') diff --git a/include/linux/platform_data/max310x.h b/include/linux/platform_data/max310x.h index dd11dcd1a184..5f4b35d99c2e 100644 --- a/include/linux/platform_data/max310x.h +++ b/include/linux/platform_data/max310x.h @@ -55,10 +55,6 @@ struct max310x_pdata { const int frequency; /* GPIO base number (can be negative) */ const int gpio_base; - /* Called during startup */ - void (*init)(void); - /* Called before finish */ - void (*exit)(void); }; #endif -- cgit From e7b8a3ceff5e5c4e2bd329717976b18ce033d7cd Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Fri, 7 Feb 2014 18:16:07 +0400 Subject: serial: max310x: Add the loopback mode support This patch replaces loopback mode support from platform data to dynamic setup with TIOCMSET ioctl. Signed-off-by: Alexander Shiyan Signed-off-by: Greg Kroah-Hartman --- include/linux/platform_data/max310x.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/linux/platform_data/max310x.h b/include/linux/platform_data/max310x.h index 5f4b35d99c2e..9d5f69b2b57c 100644 --- a/include/linux/platform_data/max310x.h +++ b/include/linux/platform_data/max310x.h @@ -46,7 +46,6 @@ struct max310x_pdata { #define MAX310X_EXT_CLK (0x00000001) /* External clock enable */ /* Flags global to UART port */ const u8 uart_flags[MAX310X_MAX_UARTS]; -#define MAX310X_LOOPBACK (0x00000001) /* Loopback mode enable */ #define MAX310X_ECHO_SUPRESS (0x00000002) /* Enable echo supress */ #define MAX310X_AUTO_DIR_CTRL (0x00000004) /* Enable Auto direction * control (RS-485) -- cgit From d3a8a252e177cfaa2fb04120dd944104e4417bf5 Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Mon, 10 Feb 2014 22:18:31 +0400 Subject: serial: max310x: Migrate to CLK API This patch removes "frequency" parameter from MAX310X platform_data and uses CLK API for getting clock. Clock type (XTAL/OSC) is determined by clk name. Signed-off-by: Alexander Shiyan Signed-off-by: Greg Kroah-Hartman --- include/linux/platform_data/max310x.h | 7 ------- 1 file changed, 7 deletions(-) (limited to 'include') diff --git a/include/linux/platform_data/max310x.h b/include/linux/platform_data/max310x.h index 9d5f69b2b57c..57a0cd46b847 100644 --- a/include/linux/platform_data/max310x.h +++ b/include/linux/platform_data/max310x.h @@ -20,9 +20,7 @@ * Example board initialization data: * * static struct max310x_pdata max3107_pdata = { - * .driver_flags = MAX310X_EXT_CLK, * .uart_flags[0] = MAX310X_ECHO_SUPRESS | MAX310X_AUTO_DIR_CTRL, - * .frequency = 3686400, * .gpio_base = -1, * }; * @@ -41,17 +39,12 @@ /* MAX310X platform data structure */ struct max310x_pdata { - /* Flags global to driver */ - const u8 driver_flags; -#define MAX310X_EXT_CLK (0x00000001) /* External clock enable */ /* Flags global to UART port */ const u8 uart_flags[MAX310X_MAX_UARTS]; #define MAX310X_ECHO_SUPRESS (0x00000002) /* Enable echo supress */ #define MAX310X_AUTO_DIR_CTRL (0x00000004) /* Enable Auto direction * control (RS-485) */ - /* Frequency (extrenal clock or crystal) */ - const int frequency; /* GPIO base number (can be negative) */ const int gpio_base; }; -- cgit From dba29a2894771562d265232ae4b61f0310bab1f5 Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Mon, 10 Feb 2014 22:18:32 +0400 Subject: serial: max310x: Always use dynamic GPIO ID assignment Always register GPIOs and use dynamic GPIO ID assignment. This is no much worth if GPIOs is not used, but helps remove private driver header and add DT support in the future. Additionally, patch adds missing uart_unregister_driver() call if probe() fails. Signed-off-by: Alexander Shiyan Signed-off-by: Greg Kroah-Hartman --- include/linux/platform_data/max310x.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'include') diff --git a/include/linux/platform_data/max310x.h b/include/linux/platform_data/max310x.h index 57a0cd46b847..1140a57e735f 100644 --- a/include/linux/platform_data/max310x.h +++ b/include/linux/platform_data/max310x.h @@ -21,7 +21,6 @@ * * static struct max310x_pdata max3107_pdata = { * .uart_flags[0] = MAX310X_ECHO_SUPRESS | MAX310X_AUTO_DIR_CTRL, - * .gpio_base = -1, * }; * * static struct spi_board_info spi_device_max3107[] = { @@ -45,8 +44,6 @@ struct max310x_pdata { #define MAX310X_AUTO_DIR_CTRL (0x00000004) /* Enable Auto direction * control (RS-485) */ - /* GPIO base number (can be negative) */ - const int gpio_base; }; #endif -- cgit From 55367c620aed6bc27a82bb1763366931d7f2ee66 Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Mon, 10 Feb 2014 22:18:34 +0400 Subject: serial: max310x: Add support for RS-485 mode This patch adds support for RS-485 (TIOCSRS485/TIOCGRS485) IOCTLs. As a result this patch eliminate private driver header. Signed-off-by: Alexander Shiyan Signed-off-by: Greg Kroah-Hartman --- include/linux/platform_data/max310x.h | 49 ----------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 include/linux/platform_data/max310x.h (limited to 'include') diff --git a/include/linux/platform_data/max310x.h b/include/linux/platform_data/max310x.h deleted file mode 100644 index 1140a57e735f..000000000000 --- a/include/linux/platform_data/max310x.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Maxim (Dallas) MAX3107/8/9, MAX14830 serial driver - * - * Copyright (C) 2012 Alexander Shiyan - * - * Based on max3100.c, by Christian Pellegrin - * Based on max3110.c, by Feng Tang - * Based on max3107.c, by Aavamobile - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -#ifndef _MAX310X_H_ -#define _MAX310X_H_ - -/* - * Example board initialization data: - * - * static struct max310x_pdata max3107_pdata = { - * .uart_flags[0] = MAX310X_ECHO_SUPRESS | MAX310X_AUTO_DIR_CTRL, - * }; - * - * static struct spi_board_info spi_device_max3107[] = { - * { - * .modalias = "max3107", - * .irq = IRQ_EINT3, - * .bus_num = 1, - * .chip_select = 1, - * .platform_data = &max3107_pdata, - * }, - * }; - */ - -#define MAX310X_MAX_UARTS 4 - -/* MAX310X platform data structure */ -struct max310x_pdata { - /* Flags global to UART port */ - const u8 uart_flags[MAX310X_MAX_UARTS]; -#define MAX310X_ECHO_SUPRESS (0x00000002) /* Enable echo supress */ -#define MAX310X_AUTO_DIR_CTRL (0x00000004) /* Enable Auto direction - * control (RS-485) - */ -}; - -#endif -- cgit From c957dd494615ccdb36d4892ef9bfd2287502fbfd Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Mon, 17 Feb 2014 15:19:18 +0530 Subject: tty: tty_ldisc.h: Remove duplicate include linux/wait.h was included twice. Signed-off-by: Sachin Kamat Signed-off-by: Greg Kroah-Hartman --- include/linux/tty_ldisc.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h index b8347c207cb8..add26da2faeb 100644 --- a/include/linux/tty_ldisc.h +++ b/include/linux/tty_ldisc.h @@ -126,7 +126,6 @@ #include #include -#include /* -- cgit From 5811712ffbf593d98b6cc56461df5be4e9580245 Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Thu, 20 Feb 2014 10:15:52 -0800 Subject: tty: serial: bcm63xx_uart: define UART_REG_SIZE constant The bcm63xx_uart driver uses RSET_UART_SIZE which is a constant defined for MIPS-based BCM63xx platforms, pull this constant value from the MIPS-specific header and put it in include/linux/serial_bcm63xx.h to make the driver platform agnostic. Signed-off-by: Florian Fainelli Signed-off-by: Greg Kroah-Hartman --- include/linux/serial_bcm63xx.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/linux/serial_bcm63xx.h b/include/linux/serial_bcm63xx.h index 570e964dc899..a80aa1a5bee2 100644 --- a/include/linux/serial_bcm63xx.h +++ b/include/linux/serial_bcm63xx.h @@ -116,4 +116,6 @@ UART_FIFO_PARERR_MASK | \ UART_FIFO_BRKDET_MASK) +#define UART_REG_SIZE 24 + #endif /* _LINUX_SERIAL_BCM63XX_H */ -- cgit From a9c3f68f3cd8d55f809fbdb0c138ed061ea1bd25 Mon Sep 17 00:00:00 2001 From: Peter Hurley Date: Sat, 22 Feb 2014 07:31:21 -0500 Subject: tty: Fix low_latency BUG The user-settable knob, low_latency, has been the source of several BUG reports which stem from flush_to_ldisc() running in interrupt context. Since 3.12, which added several sleeping locks (termios_rwsem and buf->lock) to the input processing path, the frequency of these BUG reports has increased. Note that changes in 3.12 did not introduce this regression; sleeping locks were first added to the input processing path with the removal of the BKL from N_TTY in commit a88a69c91256418c5907c2f1f8a0ec0a36f9e6cc, 'n_tty: Fix loss of echoed characters and remove bkl from n_tty' and later in commit 38db89799bdf11625a831c5af33938dcb11908b6, 'tty: throttling race fix'. Since those changes, executing flush_to_ldisc() in interrupt_context (ie, low_latency set), is unsafe. However, since most devices do not validate if the low_latency setting is appropriate for the context (process or interrupt) in which they receive data, some reports are due to misconfiguration. Further, serial dma devices for which dma fails, resort to interrupt receiving as a backup without resetting low_latency. Historically, low_latency was used to force wake-up the reading process rather than wait for the next scheduler tick. The effect was to trim multiple milliseconds of latency from when the process would receive new data. Recent tests [1] have shown that the reading process now receives data with only 10's of microseconds latency without low_latency set. Remove the low_latency rx steering from tty_flip_buffer_push(); however, leave the knob as an optional hint to drivers that can tune their rx fifos and such like. Cleanup stale code comments regarding low_latency. [1] https://lkml.org/lkml/2014/2/20/434 "Yay.. thats an annoying historical pain in the butt gone." -- Alan Cox Reported-by: Beat Bolli Reported-by: Pavel Roskin Acked-by: David Sterba Cc: Grant Edwards Cc: Stanislaw Gruszka Cc: Hal Murray Cc: # 3.12.x+ Signed-off-by: Peter Hurley Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- include/linux/tty.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/tty.h b/include/linux/tty.h index 90b4fdc8a61f..b90b5c221ff0 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -208,7 +208,7 @@ struct tty_port { wait_queue_head_t delta_msr_wait; /* Modem status change */ unsigned long flags; /* TTY flags ASY_*/ unsigned char console:1, /* port is a console */ - low_latency:1; /* direct buffer flush */ + low_latency:1; /* optional: tune for latency */ struct mutex mutex; /* Locking */ struct mutex buf_mutex; /* Buffer alloc lock */ unsigned char *xmit_buf; /* Optional buffer */ -- cgit From 45af780a0fcac8fbba0ac740a671b2af80bcf189 Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Sat, 22 Feb 2014 16:01:35 +0400 Subject: serial: imx: Remove init() and exit() platform callbacks Signed-off-by: Alexander Shiyan Signed-off-by: Greg Kroah-Hartman --- include/linux/platform_data/serial-imx.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/linux/platform_data/serial-imx.h b/include/linux/platform_data/serial-imx.h index 4adec9b154dd..3cc2e3c40914 100644 --- a/include/linux/platform_data/serial-imx.h +++ b/include/linux/platform_data/serial-imx.h @@ -23,8 +23,6 @@ #define IMXUART_IRDA (1<<1) struct imxuart_platform_data { - int (*init)(struct platform_device *pdev); - void (*exit)(struct platform_device *pdev); unsigned int flags; void (*irda_enable)(int enable); unsigned int irda_inv_rx:1; -- cgit From 26de4f1b2fb45e53a9e8f4f913b9cdf6c294070b Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Tue, 11 Mar 2014 11:11:19 +0100 Subject: serial: sh-sci: Add more register documentation Signed-off-by: Geert Uytterhoeven Acked-by: Simon Horman Acked-by: Laurent Pinchart Signed-off-by: Greg Kroah-Hartman --- include/linux/serial_sci.h | 93 +++++++++++++++++++++++++++++----------------- 1 file changed, 58 insertions(+), 35 deletions(-) (limited to 'include') diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h index 22b3640c9424..6c5e3bb282b0 100644 --- a/include/linux/serial_sci.h +++ b/include/linux/serial_sci.h @@ -10,45 +10,59 @@ #define SCIx_NOT_SUPPORTED (-1) -#define SCSCR_TIE (1 << 7) -#define SCSCR_RIE (1 << 6) -#define SCSCR_TE (1 << 5) -#define SCSCR_RE (1 << 4) -#define SCSCR_REIE (1 << 3) /* not supported by all parts */ -#define SCSCR_TOIE (1 << 2) /* not supported by all parts */ -#define SCSCR_CKE1 (1 << 1) -#define SCSCR_CKE0 (1 << 0) - -/* SCxSR SCI */ -#define SCI_TDRE 0x80 -#define SCI_RDRF 0x40 -#define SCI_ORER 0x20 -#define SCI_FER 0x10 -#define SCI_PER 0x08 -#define SCI_TEND 0x04 +/* SCSMR (Serial Mode Register) */ +#define SCSMR_CHR (1 << 6) /* 7-bit Character Length */ +#define SCSMR_PE (1 << 5) /* Parity Enable */ +#define SCSMR_ODD (1 << 4) /* Odd Parity */ +#define SCSMR_STOP (1 << 3) /* Stop Bit Length */ +#define SCSMR_CKS 0x0003 /* Clock Select */ + +/* Serial Control Register (@ = not supported by all parts) */ +#define SCSCR_TIE (1 << 7) /* Transmit Interrupt Enable */ +#define SCSCR_RIE (1 << 6) /* Receive Interrupt Enable */ +#define SCSCR_TE (1 << 5) /* Transmit Enable */ +#define SCSCR_RE (1 << 4) /* Receive Enable */ +#define SCSCR_REIE (1 << 3) /* Receive Error Interrupt Enable @ */ +#define SCSCR_TOIE (1 << 2) /* Timeout Interrupt Enable @ */ +#define SCSCR_CKE1 (1 << 1) /* Clock Enable 1 */ +#define SCSCR_CKE0 (1 << 0) /* Clock Enable 0 */ +/* SCIFA/SCIFB only */ +#define SCSCR_TDRQE (1 << 15) /* Tx Data Transfer Request Enable */ +#define SCSCR_RDRQE (1 << 14) /* Rx Data Transfer Request Enable */ + +/* SCxSR (Serial Status Register) on SCI */ +#define SCI_TDRE 0x80 /* Transmit Data Register Empty */ +#define SCI_RDRF 0x40 /* Receive Data Register Full */ +#define SCI_ORER 0x20 /* Overrun Error */ +#define SCI_FER 0x10 /* Framing Error */ +#define SCI_PER 0x08 /* Parity Error */ +#define SCI_TEND 0x04 /* Transmit End */ #define SCI_DEFAULT_ERROR_MASK (SCI_PER | SCI_FER) -/* SCxSR SCIF, HSCIF */ -#define SCIF_ER 0x0080 -#define SCIF_TEND 0x0040 -#define SCIF_TDFE 0x0020 -#define SCIF_BRK 0x0010 -#define SCIF_FER 0x0008 -#define SCIF_PER 0x0004 -#define SCIF_RDF 0x0002 -#define SCIF_DR 0x0001 +/* SCxSR (Serial Status Register) on SCIF, HSCIF */ +#define SCIF_ER 0x0080 /* Receive Error */ +#define SCIF_TEND 0x0040 /* Transmission End */ +#define SCIF_TDFE 0x0020 /* Transmit FIFO Data Empty */ +#define SCIF_BRK 0x0010 /* Break Detect */ +#define SCIF_FER 0x0008 /* Framing Error */ +#define SCIF_PER 0x0004 /* Parity Error */ +#define SCIF_RDF 0x0002 /* Receive FIFO Data Full */ +#define SCIF_DR 0x0001 /* Receive Data Ready */ #define SCIF_DEFAULT_ERROR_MASK (SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK) -/* SCSPTR, optional */ -#define SCSPTR_RTSIO (1 << 7) -#define SCSPTR_CTSIO (1 << 5) -#define SCSPTR_SPB2IO (1 << 1) -#define SCSPTR_SPB2DT (1 << 0) +/* SCFCR (FIFO Control Register) */ +#define SCFCR_LOOP (1 << 0) /* Loopback Test */ + +/* SCSPTR (Serial Port Register), optional */ +#define SCSPTR_RTSIO (1 << 7) /* Serial Port RTS Pin Input/Output */ +#define SCSPTR_CTSIO (1 << 5) /* Serial Port CTS Pin Input/Output */ +#define SCSPTR_SPB2IO (1 << 1) /* Serial Port Break Input/Output */ +#define SCSPTR_SPB2DT (1 << 0) /* Serial Port Break Data */ /* HSSRR HSCIF */ -#define HSCIF_SRE 0x8000 +#define HSCIF_SRE 0x8000 /* Sampling Rate Register Enable */ enum { SCIx_PROBE_REGTYPE, @@ -73,10 +87,19 @@ enum { * Not all registers will exist on all parts. */ enum { - SCSMR, SCBRR, SCSCR, SCxSR, - SCFCR, SCFDR, SCxTDR, SCxRDR, - SCLSR, SCTFDR, SCRFDR, SCSPTR, - HSSRR, + SCSMR, /* Serial Mode Register */ + SCBRR, /* Bit Rate Register */ + SCSCR, /* Serial Control Register */ + SCxSR, /* Serial Status Register */ + SCFCR, /* FIFO Control Register */ + SCFDR, /* FIFO Data Count Register */ + SCxTDR, /* Transmit (FIFO) Data Register */ + SCxRDR, /* Receive (FIFO) Data Register */ + SCLSR, /* Line Status Register */ + SCTFDR, /* Transmit FIFO Data Count Register */ + SCRFDR, /* Receive FIFO Data Count Register */ + SCSPTR, /* Serial Port Register */ + HSSRR, /* Sampling Rate Register */ SCIx_NR_REGS, }; -- cgit