serial: sc16is7xx
Subsystems (2)
PATCH v4 1/2 serial: sc16is7xx
From: Jon Ringle <[email protected]>
The SC16IS7xx is a slave I2C-bus/SPI interface to a single-channel high performance UART. The SC16IS7xx’s internal register set is backward-compatible with the widely used and widely popular 16C450.
The SC16IS7xx also provides additional advanced features such as auto hardware and software flow control, automatic RS-485 support, and software reset.
--- drivers/tty/serial/Kconfig | 10 + drivers/tty/serial/Makefile | 1 + drivers/tty/serial/sc16is7xx.c | 1305 ++++++++++++++++++++++++++++++++++++++ include/uapi/linux/serial_core.h | 3 + 4 files changed, 1319 insertions(+) create mode 100644 drivers/tty/serial/sc16is7xx.c
drivers/tty/serial/Kconfig +10 -0
@@ -1179,6 +1179,16 @@ config SERIAL_SCCNXP_CONSOLE help Support for console on SCCNXP serial ports. +config SERIAL_SC16IS7XX + tristate "SC16IS7xx serial support" + select SERIAL_CORE + select REGMAP_I2C if I2C + default n + help + This selects support for SC16IS7xx serial ports. + Supported ICs are SC16IS740, SC16IS741, SC16IS750, SC16IS752, + SC16IS760 and SC16IS762. + config SERIAL_BFIN_SPORT tristate "Blackfin SPORT emulate UART" depends on BLACKFIN
drivers/tty/serial/Makefile +1 -0
@@ -49,6 +49,7 @@ obj-$(CONFIG_SERIAL_SB1250_DUART) += sb1250-duart.o obj-$(CONFIG_ETRAX_SERIAL) += crisv10.o obj-$(CONFIG_SERIAL_SC26XX) += sc26xx.o obj-$(CONFIG_SERIAL_SCCNXP) += sccnxp.o +obj-$(CONFIG_SERIAL_SC16IS7XX) += sc16is7xx.o obj-$(CONFIG_SERIAL_JSM) += jsm/ obj-$(CONFIG_SERIAL_TXX9) += serial_txx9.o obj-$(CONFIG_SERIAL_VR41XX) += vr41xx_siu.o
drivers/tty/serial/sc16is7xx.c new file +1305 -0
1,305 lines not on this page · raw message
include/uapi/linux/serial_core.h +3 -0
@@ -238,4 +238,7 @@/* Tilera TILE-Gx UART */ #define PORT_TILEGX 106 +/* SC16IS74xx */ +#define PORT_SC16IS7XX 107 +#endif /* _UAPILINUX_SERIAL_CORE_H */
Signature · 6 lines
1.8.5.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v4 2/2 serial: sc16is7xx: Add bindings documentation for the SC16IS7XX UARTs
From: Jon Ringle <[email protected]>
This patch adds the devicetree documentation for the NXP SC16IS7XX UARTs.
--- .../devicetree/bindings/serial/nxp,sc16is7xx.txt | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt new file +33 -0
@@ -0,0 +1,33 @@ +* NXP SC16IS7xx advanced Universal Asynchronous Receiver-Transmitter (UART) + +Required properties: +- compatible: Should be one of the following: + - "nxp,sc16is740" for NXP SC16IS740, + - "nxp,sc16is741" for NXP SC16IS741, + - "nxp,sc16is750" for NXP SC16IS750, + - "nxp,sc16is752" for NXP SC16IS752, + - "nxp,sc16is760" for NXP SC16IS760, + - "nxp,sc16is762" for NXP SC16IS762. +- reg: I2C address of the SC16IS7xx device. +- interrupt-parent: The phandle for the interrupt controller that + services interrupts for this IC. +- interrupts: Should contain the UART interrupt +- clocks: Reference to the IC source clock. + +Optional properties: +- gpio-controller: Marks the device node as a GPIO controller. +- #gpio-cells: Should be two. The first cell is the GPIO number and + the second cell is used to specify the GPIO polarity: + 0 = active high, + 1 = active low. + +Example: + sc16is750: sc16is750@51 { + compatible = "nxp,sc16is750"; + reg = <0x51>; + clocks = <&clk20m>; + interrupt-parent = <&gpio3>; + interrupts = <7 IRQ_TYPE_EDGE_FALLING>; + gpio-controller; + #gpio-cells = <2>; + };
Signature · 6 lines
1.8.5.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Thu, 3 Apr 2014 00:49:14 -0400 от [email protected]:
Quoted 12 lines
From: Jon Ringle <[email protected]>
The SC16IS7xx is a slave I2C-bus/SPI interface to a single-channel high performance UART. The SC16IS7xx’s internal register set is backward-compatible with the widely used and widely popular 16C450.
The SC16IS7xx also provides additional advanced features such as auto hardware and software flow control, automatic RS-485 support, and software reset.
Signed-off-by Jon Ringle <[email protected]>---
...
drivers/tty/serial/Kconfig config SERIAL_SCCNXP_CONSOLE · line 1186
Quoted 4 lines
drivers/tty/serial/Kconfig +4
-0+ tristate "SC16IS7xx serial support" + select SERIAL_CORE + select REGMAP_I2C if I2C + default n
"n" is already default choice. There is no need to specify this.
...
drivers/tty/serial/sc16is7xx.c line 26
Quoted 2 lines
drivers/tty/serial/sc16is7xx.c new file +2
-0+#include <linux/serial.h> +#include <linux/spi/spi.h>
What a reason to include SPI header?
...
drivers/tty/serial/sc16is7xx.c line 217
Quoted 7 lines
+ * The programmer must program the TCR such that TCR[3:0] > TCR[7:4]. There is
+ * no built-in hardware check to make sure this condition is met. Also, the TCR
+ * must be programmed with this condition before auto RTS or software flow
+ * control is enabled to avoid spurious operation of the device.
+ */drivers/tty/serial/sc16is7xx.c new file +2
-0+#define SC16IS7XX_TCR_RX_HALT (words) (((words / 4) & 0x0f) << 0) +#define SC16IS7XX_TCR_RX_RESUME (words) (((words / 4) & 0x0f) << 4)
"words" on the right side should be framed by brackets.
...
drivers/tty/serial/sc16is7xx.c line 235
Quoted 5 lines
+ * When TLR is used for RX trigger level control, FCR[7:6] should be left at the
+ * default state, that is, ‘00’.
+ */drivers/tty/serial/sc16is7xx.c new file +2
-0+#define SC16IS7XX_TLR_TX_TRIGGER (words) (((words / 4) & 0x0f) << 0) +#define SC16IS7XX_TLR_RX_TRIGGER (words) (((words / 4) & 0x0f) << 4)
Ditto.
...
Quoted 7 lines
drivers/tty/serial/sc16is7xx.c new file +7
-0+static void sc16is7xx_config_rs485 (struct uart_port *port, +struct serial_rs485 *rs485) +{ +struct sc16is7xx_one *one =to_sc16is7xx_one (port, port); + + one->rs485 = *rs485; +
drivers/tty/serial/sc16is7xx.c line 872
Quoted 10 lines
drivers/tty/serial/sc16is7xx.c new file +10
-0+if (one->rs485.flags &SER_RS485_ENABLED ) { +sc16is7xx_port_update (port,SC16IS7XX_EFCR_REG , +SC16IS7XX_EFCR_AUTO_RS485_BIT , +SC16IS7XX_EFCR_AUTO_RS485_BIT ); + }else { +sc16is7xx_port_update (port,SC16IS7XX_EFCR_REG , +SC16IS7XX_EFCR_AUTO_RS485_BIT , +0 ); + } +}
This function will get "unused" warning if TIOCSRS485 and TIOCGRS485 is not defined.
...
Quoted 2 lines
(quoted diff) +2
-0+static int sc16is7xx_startup(struct uart_port *port) +{
...
drivers/tty/serial/sc16is7xx.c line 866
Quoted 3 lines
drivers/tty/serial/sc16is7xx.c new file +3
-0+sc16is7xx_port_update (port,SC16IS7XX_EFCR_REG , +SC16IS7XX_EFCR_AUTO_RS485_BIT , +SC16IS7XX_EFCR_AUTO_RS485_BIT );
You should do not set optional RS485 mode unconditionally. Since IOCTL for RS485 is used, this should be enough.
---