Re: [v2, 7/7] tty: serial: msm_geni_serial: Add serial driver support for GENI based QUP
On 2/23/2018 11:06 AM, Guenter Roeck wrote: On Fri, Jan 12, 2018 at 06:05:47PM -0700, Karthikeyan Ramasubramanian wrote: This driver supports GENI based UART Controller in the Qualcomm SOCs. The Qualcomm Generic Interface (GENI) is a programmable module supporting a wide range of serial interfaces including UART. This driver support console operations using FIFO mode of transfer. Signed-off-by: Girish Mahadevan Signed-off-by: Karthikeyan Ramasubramanian Signed-off-by: Sagar Dharia --- drivers/tty/serial/Kconfig| 10 + drivers/tty/serial/Makefile |1 + drivers/tty/serial/qcom_geni_serial.c | 1414 + 3 files changed, 1425 insertions(+) create mode 100644 drivers/tty/serial/qcom_geni_serial.c diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index b788fee..1be30e5 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig @@ -1098,6 +1098,16 @@ config SERIAL_MSM_CONSOLE select SERIAL_CORE_CONSOLE select SERIAL_EARLYCON +config SERIAL_QCOM_GENI + tristate "QCOM on-chip GENI based serial port support" + depends on ARCH_QCOM + select SERIAL_CORE + select SERIAL_CORE_CONSOLE Serial console drivers have to be bool, not tristate. Building a console driver as module doesn't make sense (it is needed before modules are loaded). It also results in a build failure due to a symbol which is not exported. I will mark it as bool. + select SERIAL_EARLYCON + help + Serial driver for Qualcomm Technologies Inc's GENI based QUP + hardware. + config SERIAL_VT8500 bool "VIA VT8500 on-chip serial port support" depends on ARCH_VT8500 diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile index 842d185..64a8d82 100644 --- a/drivers/tty/serial/Makefile +++ b/drivers/tty/serial/Makefile @@ -63,6 +63,7 @@ obj-$(CONFIG_SERIAL_SGI_IOC3) += ioc3_serial.o obj-$(CONFIG_SERIAL_ATMEL) += atmel_serial.o obj-$(CONFIG_SERIAL_UARTLITE) += uartlite.o obj-$(CONFIG_SERIAL_MSM) += msm_serial.o +obj-$(CONFIG_SERIAL_QCOM_GENI) += qcom_geni_serial.o obj-$(CONFIG_SERIAL_NETX) += netx-serial.o obj-$(CONFIG_SERIAL_KS8695) += serial_ks8695.o obj-$(CONFIG_SERIAL_OMAP) += omap-serial.o diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c new file mode 100644 index 000..0dbd329 --- /dev/null +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -0,0 +1,1414 @@ +/* + * Copyright (c) 2017-2018, The Linux foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* UART specific GENI registers */ +#define SE_UART_TX_TRANS_CFG (0x25C) +#define SE_UART_TX_WORD_LEN(0x268) +#define SE_UART_TX_STOP_BIT_LEN(0x26C) +#define SE_UART_TX_TRANS_LEN (0x270) +#define SE_UART_RX_TRANS_CFG (0x280) +#define SE_UART_RX_WORD_LEN(0x28C) +#define SE_UART_RX_STALE_CNT (0x294) +#define SE_UART_TX_PARITY_CFG (0x2A4) +#define SE_UART_RX_PARITY_CFG (0x2A8) + +/* SE_UART_TRANS_CFG */ +#define UART_TX_PAR_EN (BIT(0)) +#define UART_CTS_MASK (BIT(1)) + +/* SE_UART_TX_WORD_LEN */ +#define TX_WORD_LEN_MSK(GENMASK(9, 0)) + +/* SE_UART_TX_STOP_BIT_LEN */ +#define TX_STOP_BIT_LEN_MSK(GENMASK(23, 0)) +#define TX_STOP_BIT_LEN_1 (0) +#define TX_STOP_BIT_LEN_1_5(1) +#define TX_STOP_BIT_LEN_2 (2) + +/* SE_UART_TX_TRANS_LEN */ +#define TX_TRANS_LEN_MSK (GENMASK(23, 0)) + +/* SE_UART_RX_TRANS_CFG */ +#define UART_RX_INS_STATUS_BIT (BIT(2)) +#define UART_RX_PAR_EN (BIT(3)) + +/* SE_UART_RX_WORD_LEN */ +#define RX_WORD_LEN_MASK (GENMASK(9, 0)) + +/* SE_UART_RX_STALE_CNT */ +#define RX_STALE_CNT (GENMASK(23, 0)) + +/* SE_UART_TX_PARITY_CFG/RX_PARITY_CFG */ +#define PAR_CALC_EN(BIT(0)) +#define PAR_MODE_MSK (GENMASK(2, 1)) +#define PAR_MODE_SHFT (1) +#define PAR_EVEN (0x00) +#define PAR_ODD(0x01) +#define PAR_SPACE (0x10) +#define PAR_MARK (0x11) + +/* UART M_CMD OP codes */ +#define UART_START_TX (0x1) +#define UART_START_BREAK (0x4) +#define UART_STOP_BREAK(0x5) +/* UART S_CMD OP codes */ +#define UART_START_READ(0x1) +#
Re: [v2, 7/7] tty: serial: msm_geni_serial: Add serial driver support for GENI based QUP
Hi, On Fri, Jan 12, 2018 at 5:05 PM, Karthikeyan Ramasubramanian wrote: > This driver supports GENI based UART Controller in the Qualcomm SOCs. The > Qualcomm Generic Interface (GENI) is a programmable module supporting a > wide range of serial interfaces including UART. This driver support console > operations using FIFO mode of transfer. > > Signed-off-by: Girish Mahadevan > Signed-off-by: Karthikeyan Ramasubramanian > Signed-off-by: Sagar Dharia > --- > drivers/tty/serial/Kconfig| 10 + > drivers/tty/serial/Makefile |1 + > drivers/tty/serial/qcom_geni_serial.c | 1414 > + > 3 files changed, 1425 insertions(+) > create mode 100644 drivers/tty/serial/qcom_geni_serial.c > > diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig > index b788fee..1be30e5 100644 > --- a/drivers/tty/serial/Kconfig > +++ b/drivers/tty/serial/Kconfig > @@ -1098,6 +1098,16 @@ config SERIAL_MSM_CONSOLE > select SERIAL_CORE_CONSOLE > select SERIAL_EARLYCON > > +config SERIAL_QCOM_GENI > + tristate "QCOM on-chip GENI based serial port support" Should this be bool instead of tristate? Guenter noticed that we'll get link errors if we try building this as a module. Specifically, he noted that the "qcom_geni_serial.c" file refers to "uart_console_device" and "uart_console_device" is not exported (and shouldn't be since a console has to be available before modules are loaded). -Doug -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [v2, 7/7] tty: serial: msm_geni_serial: Add serial driver support for GENI based QUP
On Fri, Jan 12, 2018 at 06:05:47PM -0700, Karthikeyan Ramasubramanian wrote: > This driver supports GENI based UART Controller in the Qualcomm SOCs. The > Qualcomm Generic Interface (GENI) is a programmable module supporting a > wide range of serial interfaces including UART. This driver support console > operations using FIFO mode of transfer. > > Signed-off-by: Girish Mahadevan > Signed-off-by: Karthikeyan Ramasubramanian > Signed-off-by: Sagar Dharia > --- > drivers/tty/serial/Kconfig| 10 + > drivers/tty/serial/Makefile |1 + > drivers/tty/serial/qcom_geni_serial.c | 1414 > + > 3 files changed, 1425 insertions(+) > create mode 100644 drivers/tty/serial/qcom_geni_serial.c > > diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig > index b788fee..1be30e5 100644 > --- a/drivers/tty/serial/Kconfig > +++ b/drivers/tty/serial/Kconfig > @@ -1098,6 +1098,16 @@ config SERIAL_MSM_CONSOLE > select SERIAL_CORE_CONSOLE > select SERIAL_EARLYCON > > +config SERIAL_QCOM_GENI > + tristate "QCOM on-chip GENI based serial port support" > + depends on ARCH_QCOM > + select SERIAL_CORE > + select SERIAL_CORE_CONSOLE Serial console drivers have to be bool, not tristate. Building a console driver as module doesn't make sense (it is needed before modules are loaded). It also results in a build failure due to a symbol which is not exported. > + select SERIAL_EARLYCON > + help > + Serial driver for Qualcomm Technologies Inc's GENI based QUP > + hardware. > + > config SERIAL_VT8500 > bool "VIA VT8500 on-chip serial port support" > depends on ARCH_VT8500 > diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile > index 842d185..64a8d82 100644 > --- a/drivers/tty/serial/Makefile > +++ b/drivers/tty/serial/Makefile > @@ -63,6 +63,7 @@ obj-$(CONFIG_SERIAL_SGI_IOC3) += ioc3_serial.o > obj-$(CONFIG_SERIAL_ATMEL) += atmel_serial.o > obj-$(CONFIG_SERIAL_UARTLITE) += uartlite.o > obj-$(CONFIG_SERIAL_MSM) += msm_serial.o > +obj-$(CONFIG_SERIAL_QCOM_GENI) += qcom_geni_serial.o > obj-$(CONFIG_SERIAL_NETX) += netx-serial.o > obj-$(CONFIG_SERIAL_KS8695) += serial_ks8695.o > obj-$(CONFIG_SERIAL_OMAP) += omap-serial.o > diff --git a/drivers/tty/serial/qcom_geni_serial.c > b/drivers/tty/serial/qcom_geni_serial.c > new file mode 100644 > index 000..0dbd329 > --- /dev/null > +++ b/drivers/tty/serial/qcom_geni_serial.c > @@ -0,0 +1,1414 @@ > +/* > + * Copyright (c) 2017-2018, The Linux foundation. All rights reserved. > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License version 2 and > + * only version 2 as published by the Free Software Foundation. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +/* UART specific GENI registers */ > +#define SE_UART_TX_TRANS_CFG (0x25C) > +#define SE_UART_TX_WORD_LEN (0x268) > +#define SE_UART_TX_STOP_BIT_LEN (0x26C) > +#define SE_UART_TX_TRANS_LEN (0x270) > +#define SE_UART_RX_TRANS_CFG (0x280) > +#define SE_UART_RX_WORD_LEN (0x28C) > +#define SE_UART_RX_STALE_CNT (0x294) > +#define SE_UART_TX_PARITY_CFG(0x2A4) > +#define SE_UART_RX_PARITY_CFG(0x2A8) > + > +/* SE_UART_TRANS_CFG */ > +#define UART_TX_PAR_EN (BIT(0)) > +#define UART_CTS_MASK(BIT(1)) > + > +/* SE_UART_TX_WORD_LEN */ > +#define TX_WORD_LEN_MSK (GENMASK(9, 0)) > + > +/* SE_UART_TX_STOP_BIT_LEN */ > +#define TX_STOP_BIT_LEN_MSK (GENMASK(23, 0)) > +#define TX_STOP_BIT_LEN_1(0) > +#define TX_STOP_BIT_LEN_1_5 (1) > +#define TX_STOP_BIT_LEN_2(2) > + > +/* SE_UART_TX_TRANS_LEN */ > +#define TX_TRANS_LEN_MSK (GENMASK(23, 0)) > + > +/* SE_UART_RX_TRANS_CFG */ > +#define UART_RX_INS_STATUS_BIT (BIT(2)) > +#define UART_RX_PAR_EN (BIT(3)) > + > +/* SE_UART_RX_WORD_LEN */ > +#define RX_WORD_LEN_MASK (GENMASK(9, 0)) > + > +/* SE_UART_RX_STALE_CNT */ > +#define RX_STALE_CNT (GENMASK(23, 0)) > + > +/* SE_UART_TX_PARITY_CFG/RX_PARITY_CFG */ > +#define PAR_CALC_EN (BIT(0)) > +#define PAR_MODE_MSK (GENMASK(2, 1)) > +#define PAR_MODE_SHFT(1) > +#define PAR_EVEN (0x00) > +#define PAR_ODD (0x01) > +#define PAR_SPACE(0x10) > +#define PAR_MARK (0x11) > + > +/* UART M_CMD OP codes */ > +#define UART_START_TX(0x1) >
Re: [v2, 7/7] tty: serial: msm_geni_serial: Add serial driver support for GENI based QUP
On Fri, Jan 12, 2018 at 5:05 PM, Karthikeyan Ramasubramanian wrote: > +static int get_clk_cfg(unsigned long clk_freq, unsigned long *ser_clk) > +{ > + unsigned long root_freq[] = {7372800, 14745600, 1920, 29491200, > + 3200, 4800, 6400, 8000, 9600, 1}; This table should be static const, right? -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html