tty: serial: sc16is7xx
PATCH v2 1/1 tty: 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 | 1254 ++++++++++++++++++++++++++++++++++++++ include/uapi/linux/serial_core.h | 3 + 4 files changed, 1268 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 +1254 -0
1,254 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
Hi,
Quoted 5 lines · On Thu, Mar 20, 2014 at 10:05:33AM -0400, [email protected] wrote:
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.
So couldn't this be just a probe driver for 8250?
drivers/tty/serial/sc16is7xx.c line 42
Quoted 11 lines
drivers/tty/serial/sc16is7xx.c new file +11
-0+/* SC16IS7XX register definitions */ +#define SC16IS7XX_RHR_REG (0x00)/* RX FIFO */ +#define SC16IS7XX_THR_REG (0x00)/* TX FIFO */ +#define SC16IS7XX_IER_REG (0x01)/* Interrupt enable */ +#define SC16IS7XX_IIR_REG (0x02)/* Interrupt Identification */ +#define SC16IS7XX_FCR_REG (0x02)/* FIFO control */ +#define SC16IS7XX_LCR_REG (0x03)/* Line Control */ +#define SC16IS7XX_MCR_REG (0x04)/* Modem Control */ +#define SC16IS7XX_LSR_REG (0x05)/* Line Status */ +#define SC16IS7XX_MSR_REG (0x06)/* Modem Status */ +#define SC16IS7XX_SPR_REG (0x07)/* Scratch Pad */
At least there should not be any need to redefine those register or their bits. Just include serial_reg.h.
Thanks,
Signature · 5 lines
heikki -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines · Heikki Krogerus
Hi,
Quoted 5 lines · On Thu, Mar 20, 2014 at 10:05:33AM -0400, [email protected] wrote:
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.
So couldn't this be just a probe driver for 8250?
8250 UART has a MMIO-access, but this driver communicate through I2C bus (and potentially SPI bus, if anyone cares to add that support, which should be fairly easy to do). This is completely different handling.
To achieve acceptable throughput, it is necessary to use threaded irq and also bulk i2c transfers for RX and TX using regmap_raw_{read,write}() to optimize the use of the i2c bus.
This is not a good fit for 8250.
Quoted 15 lines
drivers/tty/serial/sc16is7xx.c line 42
Quoted 12 lines
drivers/tty/serial/sc16is7xx.c new file +11
-0+/* SC16IS7XX register definitions */ +#define SC16IS7XX_RHR_REG (0x00)/* RX FIFO */ +#define SC16IS7XX_THR_REG (0x00)/* TX FIFO */ +#define SC16IS7XX_IER_REG (0x01)/* Interrupt enable */ +#define SC16IS7XX_IIR_REG (0x02)/* Interrupt Identification */ +#define SC16IS7XX_FCR_REG (0x02)/* FIFO control */ +#define SC16IS7XX_LCR_REG (0x03)/* Line Control */ +#define SC16IS7XX_MCR_REG (0x04)/* Modem Control */ +#define SC16IS7XX_LSR_REG (0x05)/* Line Status */ +#define SC16IS7XX_MSR_REG (0x06)/* Modem Status */ +#define SC16IS7XX_SPR_REG (0x07)/* Scratch Pad */ At least there should not be any need to redefine those register or their bits. Just include
serial_reg.h.
I started off doing that, but got frustrated enough by incompatibilities between the register bit definitions that I abandoned that and decided to make the driver self contained regarding the register and bit definitions. For example:
serial_reg.h defines:
#define UART_MCR_TCRTLR 0x40 /* Access TCR/TLR (TI16C752, EFR[4]=1) */
but this is wrong for sc16is7xx. I need:
#define SC16IS7XX_MCR_TCRTLR_BIT (1 << 2) /* TCR/TLR register enable */
Jon
Quoted 10 lines · On Fri, 21 Mar 2014 10:26:09 +0200 Heikki Krogerus…
Hi,
Quoted 5 lines · On Thu, Mar 20, 2014 at 10:05:33AM -0400…
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.
So couldn't this be just a probe driver for 8250?
That was my first thought but if you look at 8250 and its locking assumptions it is a very poor fit. Better for now it is separate I think.
Alan
--
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