summaryrefslogtreecommitdiff
path: root/drivers/tty/serial
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/serial')
-rw-r--r--drivers/tty/serial/8250/8250_early.c3
-rw-r--r--drivers/tty/serial/8250/8250_mtk.c13
-rw-r--r--drivers/tty/serial/8250/8250_omap.c48
-rw-r--r--drivers/tty/serial/8250/8250_pci.c2
-rw-r--r--drivers/tty/serial/8250/serial_cs.c9
-rw-r--r--drivers/tty/serial/Kconfig20
-rw-r--r--drivers/tty/serial/Makefile1
-rw-r--r--drivers/tty/serial/amba-pl011.c2
-rw-r--r--drivers/tty/serial/earlycon.c6
-rw-r--r--drivers/tty/serial/fsl_linflexuart.c19
-rw-r--r--drivers/tty/serial/ifx6x60.c3
-rw-r--r--drivers/tty/serial/imx.c115
-rw-r--r--drivers/tty/serial/jsm/jsm_cls.c4
-rw-r--r--drivers/tty/serial/jsm/jsm_tty.c2
-rw-r--r--drivers/tty/serial/lpc32xx_hs.c3
-rw-r--r--drivers/tty/serial/max310x.c57
-rw-r--r--drivers/tty/serial/meson_uart.c8
-rw-r--r--drivers/tty/serial/msm_serial.c5
-rw-r--r--drivers/tty/serial/mxs-auart.c21
-rw-r--r--drivers/tty/serial/pmac_zilog.h8
-rw-r--r--drivers/tty/serial/pnx8xxx_uart.c858
-rw-r--r--drivers/tty/serial/serial-tegra.c7
-rw-r--r--drivers/tty/serial/serial_core.c4
-rw-r--r--drivers/tty/serial/serial_mctrl_gpio.c2
-rw-r--r--drivers/tty/serial/sifive.c3
-rw-r--r--drivers/tty/serial/stm32-usart.c6
-rw-r--r--drivers/tty/serial/uartlite.c4
-rw-r--r--drivers/tty/serial/xilinx_uartps.c1
28 files changed, 159 insertions, 1075 deletions
diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c
index 70d7826788f5..c171ce6db691 100644
--- a/drivers/tty/serial/8250/8250_early.c
+++ b/drivers/tty/serial/8250/8250_early.c
@@ -204,9 +204,6 @@ OF_EARLYCON_DECLARE(omap8250, "ti,omap4-uart", early_omap8250_setup);
#ifdef CONFIG_SERIAL_8250_RT288X
-unsigned int au_serial_in(struct uart_port *p, int offset);
-void au_serial_out(struct uart_port *p, int offset, int value);
-
static int __init early_au_setup(struct earlycon_device *dev, const char *opt)
{
dev->port.serial_in = au_serial_in;
diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
index fa876e2c13e5..f7d3023f860f 100644
--- a/drivers/tty/serial/8250/8250_mtk.c
+++ b/drivers/tty/serial/8250/8250_mtk.c
@@ -572,15 +572,22 @@ static int mtk8250_probe(struct platform_device *pdev)
pm_runtime_enable(&pdev->dev);
err = mtk8250_runtime_resume(&pdev->dev);
if (err)
- return err;
+ goto err_pm_disable;
data->line = serial8250_register_8250_port(&uart);
- if (data->line < 0)
- return data->line;
+ if (data->line < 0) {
+ err = data->line;
+ goto err_pm_disable;
+ }
data->rx_wakeup_irq = platform_get_irq_optional(pdev, 1);
return 0;
+
+err_pm_disable:
+ pm_runtime_disable(&pdev->dev);
+
+ return err;
}
static int mtk8250_remove(struct platform_device *pdev)
diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
index 562087df7d33..23e0decde33e 100644
--- a/drivers/tty/serial/8250/8250_omap.c
+++ b/drivers/tty/serial/8250/8250_omap.c
@@ -27,6 +27,7 @@
#include <linux/pm_qos.h>
#include <linux/pm_wakeirq.h>
#include <linux/dma-mapping.h>
+#include <linux/sys_soc.h>
#include "8250.h"
@@ -41,6 +42,7 @@
*/
#define UART_ERRATA_CLOCK_DISABLE (1 << 3)
#define UART_HAS_EFR2 BIT(4)
+#define UART_HAS_RHR_IT_DIS BIT(5)
#define OMAP_UART_FCR_RX_TRIG 6
#define OMAP_UART_FCR_TX_TRIG 4
@@ -94,6 +96,10 @@
#define OMAP_UART_REV_52 0x0502
#define OMAP_UART_REV_63 0x0603
+/* Interrupt Enable Register 2 */
+#define UART_OMAP_IER2 0x1B
+#define UART_OMAP_IER2_RHR_IT_DIS BIT(2)
+
/* Enhanced features register 2 */
#define UART_OMAP_EFR2 0x23
#define UART_OMAP_EFR2_TIMEOUT_BEHAVE BIT(6)
@@ -184,11 +190,6 @@ static void omap_8250_mdr1_errataset(struct uart_8250_port *up,
struct omap8250_priv *priv)
{
u8 timeout = 255;
- u8 old_mdr1;
-
- old_mdr1 = serial_in(up, UART_OMAP_MDR1);
- if (old_mdr1 == priv->mdr1)
- return;
serial_out(up, UART_OMAP_MDR1, priv->mdr1);
udelay(2);
@@ -533,6 +534,11 @@ static void omap_8250_pm(struct uart_port *port, unsigned int state,
static void omap_serial_fill_features_erratas(struct uart_8250_port *up,
struct omap8250_priv *priv)
{
+ const struct soc_device_attribute k3_soc_devices[] = {
+ { .family = "AM65X", },
+ { .family = "J721E", .revision = "SR1.0" },
+ { /* sentinel */ }
+ };
u32 mvr, scheme;
u16 revision, major, minor;
@@ -580,6 +586,14 @@ static void omap_serial_fill_features_erratas(struct uart_8250_port *up,
default:
break;
}
+
+ /*
+ * AM65x SR1.0, AM65x SR2.0 and J721e SR1.0 don't
+ * don't have RHR_IT_DIS bit in IER2 register. So drop to flag
+ * to enable errata workaround.
+ */
+ if (soc_device_match(k3_soc_devices))
+ priv->habit &= ~UART_HAS_RHR_IT_DIS;
}
static void omap8250_uart_qos_work(struct work_struct *work)
@@ -761,17 +775,27 @@ static void __dma_rx_do_complete(struct uart_8250_port *p)
{
struct uart_8250_dma *dma = p->dma;
struct tty_port *tty_port = &p->port.state->port;
+ struct omap8250_priv *priv = p->port.private_data;
struct dma_chan *rxchan = dma->rxchan;
dma_cookie_t cookie;
struct dma_tx_state state;
int count;
int ret;
+ u32 reg;
if (!dma->rx_running)
goto out;
cookie = dma->rx_cookie;
dma->rx_running = 0;
+
+ /* Re-enable RX FIFO interrupt now that transfer is complete */
+ if (priv->habit & UART_HAS_RHR_IT_DIS) {
+ reg = serial_in(p, UART_OMAP_IER2);
+ reg &= ~UART_OMAP_IER2_RHR_IT_DIS;
+ serial_out(p, UART_OMAP_IER2, UART_OMAP_IER2_RHR_IT_DIS);
+ }
+
dmaengine_tx_status(rxchan, cookie, &state);
count = dma->rx_size - state.residue + state.in_flight_bytes;
@@ -867,6 +891,7 @@ static int omap_8250_rx_dma(struct uart_8250_port *p)
int err = 0;
struct dma_async_tx_descriptor *desc;
unsigned long flags;
+ u32 reg;
if (priv->rx_dma_broken)
return -EINVAL;
@@ -902,6 +927,17 @@ static int omap_8250_rx_dma(struct uart_8250_port *p)
dma->rx_cookie = dmaengine_submit(desc);
+ /*
+ * Disable RX FIFO interrupt while RX DMA is enabled, else
+ * spurious interrupt may be raised when data is in the RX FIFO
+ * but is yet to be drained by DMA.
+ */
+ if (priv->habit & UART_HAS_RHR_IT_DIS) {
+ reg = serial_in(p, UART_OMAP_IER2);
+ reg |= UART_OMAP_IER2_RHR_IT_DIS;
+ serial_out(p, UART_OMAP_IER2, UART_OMAP_IER2_RHR_IT_DIS);
+ }
+
dma_async_issue_pending(dma->rxchan);
out:
spin_unlock_irqrestore(&priv->rx_dma_lock, flags);
@@ -1182,7 +1218,7 @@ static struct omap8250_dma_params am33xx_dma = {
static struct omap8250_platdata am654_platdata = {
.dma_params = &am654_dma,
- .habit = UART_HAS_EFR2,
+ .habit = UART_HAS_EFR2 | UART_HAS_RHR_IT_DIS,
};
static struct omap8250_platdata am33xx_platdata = {
diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
index d5a513efb261..689d8227f95f 100644
--- a/drivers/tty/serial/8250/8250_pci.c
+++ b/drivers/tty/serial/8250/8250_pci.c
@@ -1964,7 +1964,7 @@ pci_moxa_setup(struct serial_private *priv,
* This list is ordered alphabetically by vendor then device.
* Specific entries must come before more generic entries.
*/
-static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
+static struct pci_serial_quirk pci_serial_quirks[] = {
/*
* ADDI-DATA GmbH communication cards <info@addi-data.com>
*/
diff --git a/drivers/tty/serial/8250/serial_cs.c b/drivers/tty/serial/8250/serial_cs.c
index e3d10794dbba..35ff6627c61b 100644
--- a/drivers/tty/serial/8250/serial_cs.c
+++ b/drivers/tty/serial/8250/serial_cs.c
@@ -559,16 +559,13 @@ static int multi_config(struct pcmcia_device *link)
*/
if (info->manfid == MANFID_OXSEMI || (info->manfid == MANFID_POSSIO &&
info->prodid == PRODID_POSSIO_GCC)) {
- int err;
-
if (link->config_index == 1 ||
link->config_index == 3) {
- err = setup_serial(link, info, base2,
- link->irq);
+ setup_serial(link, info, base2, link->irq);
base2 = link->resource[0]->start;
} else {
- err = setup_serial(link, info, link->resource[0]->start,
- link->irq);
+ setup_serial(link, info, link->resource[0]->start,
+ link->irq);
}
info->c950ctrl = base2;
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 28f22e58639c..12d71d5eb6ca 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -206,7 +206,7 @@ config SERIAL_MESON
config SERIAL_MESON_CONSOLE
bool "Support for console on meson"
- depends on SERIAL_MESON=y
+ depends on SERIAL_MESON
select SERIAL_CORE_CONSOLE
select SERIAL_EARLYCON
help
@@ -704,22 +704,6 @@ config SERIAL_SH_SCI_DMA
depends on SERIAL_SH_SCI && DMA_ENGINE
default ARCH_RENESAS
-config SERIAL_PNX8XXX
- bool "Enable PNX8XXX SoCs' UART Support"
- depends on SOC_PNX833X
- select SERIAL_CORE
- help
- If you have a MIPS-based Philips SoC such as PNX8330 and you want
- to use serial ports, say Y. Otherwise, say N.
-
-config SERIAL_PNX8XXX_CONSOLE
- bool "Enable PNX8XX0 serial console"
- depends on SERIAL_PNX8XXX
- select SERIAL_CORE_CONSOLE
- help
- If you have a MIPS-based Philips SoC such as PNX8330 and you want
- to use serial console, say Y. Otherwise, say N.
-
config SERIAL_HS_LPC32XX
tristate "LPC32XX high speed serial port support"
depends on ARCH_LPC32XX || COMPILE_TEST
@@ -1133,7 +1117,7 @@ config SERIAL_TIMBERDALE
config SERIAL_BCM63XX
tristate "Broadcom BCM63xx/BCM33xx UART support"
select SERIAL_CORE
- depends on MIPS || ARM || COMPILE_TEST
+ depends on COMMON_CLK
help
This enables the driver for the onchip UART core found on
the following chipsets:
diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile
index caf167f0c10a..af44b231123c 100644
--- a/drivers/tty/serial/Makefile
+++ b/drivers/tty/serial/Makefile
@@ -27,7 +27,6 @@ obj-$(CONFIG_SERIAL_AMBA_PL010) += amba-pl010.o
obj-$(CONFIG_SERIAL_AMBA_PL011) += amba-pl011.o
obj-$(CONFIG_SERIAL_CLPS711X) += clps711x.o
obj-$(CONFIG_SERIAL_PXA_NON8250) += pxa.o
-obj-$(CONFIG_SERIAL_PNX8XXX) += pnx8xxx_uart.o
obj-$(CONFIG_SERIAL_SA1100) += sa1100.o
obj-$(CONFIG_SERIAL_BCM63XX) += bcm63xx_uart.o
obj-$(CONFIG_SERIAL_SAMSUNG) += samsung_tty.o
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 87dc3fc15694..c255476cce28 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2789,7 +2789,7 @@ static const struct of_device_id sbsa_uart_of_match[] = {
};
MODULE_DEVICE_TABLE(of, sbsa_uart_of_match);
-static const struct acpi_device_id sbsa_uart_acpi_match[] = {
+static const struct acpi_device_id __maybe_unused sbsa_uart_acpi_match[] = {
{ "ARMH0011", 0 },
{},
};
diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
index b70877932d47..57c70851f22a 100644
--- a/drivers/tty/serial/earlycon.c
+++ b/drivers/tty/serial/earlycon.c
@@ -175,7 +175,7 @@ static int __init register_earlycon(char *buf, const struct earlycon_id *match)
*/
int __init setup_earlycon(char *buf)
{
- const struct earlycon_id **p_match;
+ const struct earlycon_id *match;
bool empty_compatible = true;
if (!buf || !buf[0])
@@ -185,9 +185,7 @@ int __init setup_earlycon(char *buf)
return -EALREADY;
again:
- for (p_match = __earlycon_table; p_match < __earlycon_table_end;
- p_match++) {
- const struct earlycon_id *match = *p_match;
+ for (match = __earlycon_table; match < __earlycon_table_end; match++) {
size_t len = strlen(match->name);
if (strncmp(buf, match->name, len))
diff --git a/drivers/tty/serial/fsl_linflexuart.c b/drivers/tty/serial/fsl_linflexuart.c
index 3e28be402aef..d87048073abe 100644
--- a/drivers/tty/serial/fsl_linflexuart.c
+++ b/drivers/tty/serial/fsl_linflexuart.c
@@ -252,23 +252,22 @@ static irqreturn_t linflex_rxint(int irq, void *dev_id)
flg = TTY_NORMAL;
sport->icount.rx++;
- if (status & (LINFLEXD_UARTSR_BOF | LINFLEXD_UARTSR_SZF |
- LINFLEXD_UARTSR_FEF | LINFLEXD_UARTSR_PE)) {
- if (status & LINFLEXD_UARTSR_SZF)
- status |= LINFLEXD_UARTSR_SZF;
+ if (status & (LINFLEXD_UARTSR_BOF | LINFLEXD_UARTSR_FEF |
+ LINFLEXD_UARTSR_PE)) {
if (status & LINFLEXD_UARTSR_BOF)
- status |= LINFLEXD_UARTSR_BOF;
+ sport->icount.overrun++;
if (status & LINFLEXD_UARTSR_FEF) {
- if (!rx)
+ if (!rx) {
brk = true;
- status |= LINFLEXD_UARTSR_FEF;
+ sport->icount.brk++;
+ } else
+ sport->icount.frame++;
}
if (status & LINFLEXD_UARTSR_PE)
- status |= LINFLEXD_UARTSR_PE;
+ sport->icount.parity++;
}
- writel(status | LINFLEXD_UARTSR_RMB | LINFLEXD_UARTSR_DRFRFE,
- sport->membase + UARTSR);
+ writel(status, sport->membase + UARTSR);
status = readl(sport->membase + UARTSR);
if (brk) {
diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index 21d519c804cb..182e0ccd60b2 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -545,6 +545,7 @@ static void ifx_spi_hangup(struct tty_struct *tty)
/**
* ifx_port_activate
* @port: our tty port
+ * @tty: our tty device
*
* tty port activate method - called for first open. Serialized
* with hangup and shutdown by the tty layer.
@@ -719,7 +720,7 @@ complete_exit:
/**
* ifx_spio_io - I/O tasklet
- * @data: our SPI device
+ * @t: tasklet construct used to fetch the SPI device
*
* Queue data for transmission if possible and then kick off the
* transfer.
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index cacf7266a262..425624d794dd 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -30,7 +30,6 @@
#include <linux/dma-mapping.h>
#include <asm/irq.h>
-#include <linux/platform_data/serial-imx.h>
#include <linux/platform_data/dma-imx.h>
#include "serial_mctrl_gpio.h"
@@ -263,25 +262,6 @@ static struct imx_uart_data imx_uart_devdata[] = {
},
};
-static const struct platform_device_id imx_uart_devtype[] = {
- {
- .name = "imx1-uart",
- .driver_data = (kernel_ulong_t) &imx_uart_devdata[IMX1_UART],
- }, {
- .name = "imx21-uart",
- .driver_data = (kernel_ulong_t) &imx_uart_devdata[IMX21_UART],
- }, {
- .name = "imx53-uart",
- .driver_data = (kernel_ulong_t) &imx_uart_devdata[IMX53_UART],
- }, {
- .name = "imx6q-uart",
- .driver_data = (kernel_ulong_t) &imx_uart_devdata[IMX6Q_UART],
- }, {
- /* sentinel */
- }
-};
-MODULE_DEVICE_TABLE(platform, imx_uart_devtype);
-
static const struct of_device_id imx_uart_dt_ids[] = {
{ .compatible = "fsl,imx6q-uart", .data = &imx_uart_devdata[IMX6Q_UART], },
{ .compatible = "fsl,imx53-uart", .data = &imx_uart_devdata[IMX53_UART], },
@@ -1881,7 +1861,7 @@ static int imx_uart_poll_init(struct uart_port *port)
ucr1 |= UCR1_UARTEN;
ucr1 &= ~(UCR1_TRDYEN | UCR1_RTSDEN | UCR1_RRDYEN);
- ucr2 |= UCR2_RXEN;
+ ucr2 |= UCR2_RXEN | UCR2_TXEN;
ucr2 &= ~UCR2_ATEN;
imx_uart_writel(sport, ucr1, UCR1);
@@ -2183,70 +2163,6 @@ static struct uart_driver imx_uart_uart_driver = {
.cons = IMX_CONSOLE,
};
-#ifdef CONFIG_OF
-/*
- * This function returns 1 iff pdev isn't a device instatiated by dt, 0 iff it
- * could successfully get all information from dt or a negative errno.
- */
-static int imx_uart_probe_dt(struct imx_port *sport,
- struct platform_device *pdev)
-{
- struct device_node *np = pdev->dev.of_node;
- int ret;
-
- sport->devdata = of_device_get_match_data(&pdev->dev);
- if (!sport->devdata)
- /* no device tree device */
- return 1;
-
- ret = of_alias_get_id(np, "serial");
- if (ret < 0) {
- dev_err(&pdev->dev, "failed to get alias id, errno %d\n", ret);
- return ret;
- }
- sport->port.line = ret;
-
- if (of_get_property(np, "uart-has-rtscts", NULL) ||
- of_get_property(np, "fsl,uart-has-rtscts", NULL) /* deprecated */)
- sport->have_rtscts = 1;
-
- if (of_get_property(np, "fsl,dte-mode", NULL))
- sport->dte_mode = 1;
-
- if (of_get_property(np, "rts-gpios", NULL))
- sport->have_rtsgpio = 1;
-
- if (of_get_property(np, "fsl,inverted-tx", NULL))
- sport->inverted_tx = 1;
-
- if (of_get_property(np, "fsl,inverted-rx", NULL))
- sport->inverted_rx = 1;
-
- return 0;
-}
-#else
-static inline int imx_uart_probe_dt(struct imx_port *sport,
- struct platform_device *pdev)
-{
- return 1;
-}
-#endif
-
-static void imx_uart_probe_pdata(struct imx_port *sport,
- struct platform_device *pdev)
-{
- struct imxuart_platform_data *pdata = dev_get_platdata(&pdev->dev);
-
- sport->port.line = pdev->id;
- sport->devdata = (struct imx_uart_data *) pdev->id_entry->driver_data;
-
- if (!pdata)
- return;
-
- if (pdata->flags & IMXUART_HAVE_RTSCTS)
- sport->have_rtscts = 1;
-}
-
static enum hrtimer_restart imx_trigger_start_tx(struct hrtimer *t)
{
struct imx_port *sport = container_of(t, struct imx_port, trigger_start_tx);
@@ -2275,6 +2191,7 @@ static enum hrtimer_restart imx_trigger_stop_tx(struct hrtimer *t)
static int imx_uart_probe(struct platform_device *pdev)
{
+ struct device_node *np = pdev->dev.of_node;
struct imx_port *sport;
void __iomem *base;
int ret = 0;
@@ -2286,11 +2203,30 @@ static int imx_uart_probe(struct platform_device *pdev)
if (!sport)
return -ENOMEM;
- ret = imx_uart_probe_dt(sport, pdev);
- if (ret > 0)
- imx_uart_probe_pdata(sport, pdev);
- else if (ret < 0)
+ sport->devdata = of_device_get_match_data(&pdev->dev);
+
+ ret = of_alias_get_id(np, "serial");
+ if (ret < 0) {
+ dev_err(&pdev->dev, "failed to get alias id, errno %d\n", ret);
return ret;
+ }
+ sport->port.line = ret;
+
+ if (of_get_property(np, "uart-has-rtscts", NULL) ||
+ of_get_property(np, "fsl,uart-has-rtscts", NULL) /* deprecated */)
+ sport->have_rtscts = 1;
+
+ if (of_get_property(np, "fsl,dte-mode", NULL))
+ sport->dte_mode = 1;
+
+ if (of_get_property(np, "rts-gpios", NULL))
+ sport->have_rtsgpio = 1;
+
+ if (of_get_property(np, "fsl,inverted-tx", NULL))
+ sport->inverted_tx = 1;
+
+ if (of_get_property(np, "fsl,inverted-rx", NULL))
+ sport->inverted_rx = 1;
if (sport->port.line >= ARRAY_SIZE(imx_uart_ports)) {
dev_err(&pdev->dev, "serial%d out of range\n",
@@ -2639,7 +2575,6 @@ static struct platform_driver imx_uart_platform_driver = {
.probe = imx_uart_probe,
.remove = imx_uart_remove,
- .id_table = imx_uart_devtype,
.driver = {
.name = "imx-uart",
.of_match_table = imx_uart_dt_ids,
diff --git a/drivers/tty/serial/jsm/jsm_cls.c b/drivers/tty/serial/jsm/jsm_cls.c
index c061a7b7bd23..b507a2cec926 100644
--- a/drivers/tty/serial/jsm/jsm_cls.c
+++ b/drivers/tty/serial/jsm/jsm_cls.c
@@ -397,10 +397,8 @@ static void cls_copy_data_from_uart_to_queue(struct jsm_channel *ch)
* which in this case is the break signal.
*/
if (linestatus & error_mask) {
- u8 discard;
-
linestatus = 0;
- discard = readb(&ch->ch_cls_uart->txrx);
+ readb(&ch->ch_cls_uart->txrx);
continue;
}
diff --git a/drivers/tty/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c
index 689774c073ca..512b77195e9f 100644
--- a/drivers/tty/serial/jsm/jsm_tty.c
+++ b/drivers/tty/serial/jsm/jsm_tty.c
@@ -607,7 +607,7 @@ void jsm_input(struct jsm_channel *ch)
* Give the Linux ld the flags in the
* format it likes.
*/
- if (*(ch->ch_equeue +tail +i) & UART_LSR_BI)
+ if (*(ch->ch_equeue + tail + i) & UART_LSR_BI)
tty_insert_flip_char(port, *(ch->ch_rqueue +tail +i), TTY_BREAK);
else if (*(ch->ch_equeue +tail +i) & UART_LSR_PE)
tty_insert_flip_char(port, *(ch->ch_rqueue +tail +i), TTY_PARITY);
diff --git a/drivers/tty/serial/lpc32xx_hs.c b/drivers/tty/serial/lpc32xx_hs.c
index b5898c932036..1fa098d7aec4 100644
--- a/drivers/tty/serial/lpc32xx_hs.c
+++ b/drivers/tty/serial/lpc32xx_hs.c
@@ -241,12 +241,11 @@ static unsigned int __serial_get_clock_div(unsigned long uartclk,
static void __serial_uart_flush(struct uart_port *port)
{
- u32 tmp;
int cnt = 0;
while ((readl(LPC32XX_HSUART_LEVEL(port->membase)) > 0) &&
(cnt++ < FIFO_READ_LIMIT))
- tmp = readl(LPC32XX_HSUART_FIFO(port->membase));
+ readl(LPC32XX_HSUART_FIFO(port->membase));
}
static void __serial_lpc32xx_rx(struct uart_port *port)
diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
index 21130af106bb..9795b2e8b0b2 100644
--- a/drivers/tty/serial/max310x.c
+++ b/drivers/tty/serial/max310x.c
@@ -15,8 +15,8 @@
#include <linux/device.h>
#include <linux/gpio/driver.h>
#include <linux/module.h>
-#include <linux/of.h>
-#include <linux/of_device.h>
+#include <linux/mod_devicetable.h>
+#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/serial_core.h>
#include <linux/serial.h>
@@ -267,7 +267,7 @@ struct max310x_one {
container_of(_port, struct max310x_one, port)
struct max310x_port {
- struct max310x_devtype *devtype;
+ const struct max310x_devtype *devtype;
struct regmap *regmap;
struct clk *clk;
#ifdef CONFIG_GPIOLIB
@@ -1269,11 +1269,10 @@ static int max310x_gpio_set_config(struct gpio_chip *chip, unsigned int offset,
}
#endif
-static int max310x_probe(struct device *dev, struct max310x_devtype *devtype,
+static int max310x_probe(struct device *dev, const struct max310x_devtype *devtype,
struct regmap *regmap, int irq)
{
int i, ret, fmin, fmax, freq, uartclk;
- struct clk *clk_osc, *clk_xtal;
struct max310x_port *s;
bool xtal = false;
@@ -1287,23 +1286,24 @@ static int max310x_probe(struct device *dev, struct max310x_devtype *devtype,
return -ENOMEM;
}
- clk_osc = devm_clk_get(dev, "osc");
- clk_xtal = devm_clk_get(dev, "xtal");
- if (!IS_ERR(clk_osc)) {
- s->clk = clk_osc;
+ s->clk = devm_clk_get_optional(dev, "osc");
+ if (IS_ERR(s->clk))
+ return PTR_ERR(s->clk);
+ if (s->clk) {
fmin = 500000;
fmax = 35000000;
- } else if (!IS_ERR(clk_xtal)) {
- s->clk = clk_xtal;
- fmin = 1000000;
- fmax = 4000000;
- xtal = true;
- } else if (PTR_ERR(clk_osc) == -EPROBE_DEFER ||
- PTR_ERR(clk_xtal) == -EPROBE_DEFER) {
- return -EPROBE_DEFER;
} else {
- dev_err(dev, "Cannot get clock\n");
- return -EINVAL;
+ s->clk = devm_clk_get_optional(dev, "xtal");
+ if (IS_ERR(s->clk))
+ return PTR_ERR(s->clk);
+ if (s->clk) {
+ fmin = 1000000;
+ fmax = 4000000;
+ xtal = true;
+ } else {
+ dev_err(dev, "Cannot get clock\n");
+ return -EINVAL;
+ }
}
ret = clk_prepare_enable(s->clk);
@@ -1478,7 +1478,7 @@ static struct regmap_config regcfg = {
#ifdef CONFIG_SPI_MASTER
static int max310x_spi_probe(struct spi_device *spi)
{
- struct max310x_devtype *devtype;
+ const struct max310x_devtype *devtype;
struct regmap *regmap;
int ret;
@@ -1490,18 +1490,9 @@ static int max310x_spi_probe(struct spi_device *spi)
if (ret)
return ret;
- if (spi->dev.of_node) {
- const struct of_device_id *of_id =
- of_match_device(max310x_dt_ids, &spi->dev);
- if (!of_id)
- return -ENODEV;
-
- devtype = (struct max310x_devtype *)of_id->data;
- } else {
- const struct spi_device_id *id_entry = spi_get_device_id(spi);
-
- devtype = (struct max310x_devtype *)id_entry->driver_data;
- }
+ devtype = device_get_match_data(&spi->dev);
+ if (!devtype)
+ devtype = (struct max310x_devtype *)spi_get_device_id(spi)->driver_data;
regcfg.max_register = devtype->nr * 0x20 - 1;
regmap = devm_regmap_init_spi(spi, &regcfg);
@@ -1526,7 +1517,7 @@ MODULE_DEVICE_TABLE(spi, max310x_id_table);
static struct spi_driver max310x_spi_driver = {
.driver = {
.name = MAX310X_NAME,
- .of_match_table = of_match_ptr(max310x_dt_ids),
+ .of_match_table = max310x_dt_ids,
.pm = &max310x_pm_ops,
},
.probe = max310x_spi_probe,
diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c
index d2c08b760f83..69eeef9edfa5 100644
--- a/drivers/tty/serial/meson_uart.c
+++ b/drivers/tty/serial/meson_uart.c
@@ -604,7 +604,6 @@ static int __init meson_serial_console_init(void)
register_console(&meson_serial_console);
return 0;
}
-console_initcall(meson_serial_console_init);
static void meson_serial_early_console_write(struct console *co,
const char *s,
@@ -634,6 +633,9 @@ OF_EARLYCON_DECLARE(meson, "amlogic,meson-ao-uart",
#define MESON_SERIAL_CONSOLE (&meson_serial_console)
#else
+static int __init meson_serial_console_init(void) {
+ return 0;
+}
#define MESON_SERIAL_CONSOLE NULL
#endif
@@ -824,6 +826,10 @@ static int __init meson_uart_init(void)
{
int ret;
+ ret = meson_serial_console_init();
+ if (ret)
+ return ret;
+
ret = uart_register_driver(&meson_uart_driver);
if (ret)
return ret;
diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index 87f005e5d2af..770c182e2208 100644
--- a/drivers/tty/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
@@ -426,7 +426,6 @@ static void msm_complete_tx_dma(void *args)
struct circ_buf *xmit = &port->state->xmit;
struct msm_dma *dma = &msm_port->tx_dma;
struct dma_tx_state state;
- enum dma_status status;
unsigned long flags;
unsigned int count;
u32 val;
@@ -437,7 +436,7 @@ static void msm_complete_tx_dma(void *args)
if (!dma->count)
goto done;
- status = dmaengine_tx_status(dma->chan, dma->cookie, &state);
+ dmaengine_tx_status(dma->chan, dma->cookie, &state);
dma_unmap_single(port->dev, dma->phys, dma->count, dma->dir);
@@ -1525,7 +1524,7 @@ static void msm_poll_put_char(struct uart_port *port, unsigned char c)
}
#endif
-static struct uart_ops msm_uart_pops = {
+static const struct uart_ops msm_uart_pops = {
.tx_empty = msm_tx_empty,
.set_mctrl = msm_set_mctrl,
.get_mctrl = msm_get_mctrl,
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index b784323a6a7b..8ecf622602cb 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -443,24 +443,16 @@ struct mxs_auart_port {
bool ms_irq_enabled;
};
-static const struct platform_device_id mxs_auart_devtype[] = {
- { .name = "mxs-auart-imx23", .driver_data = IMX23_AUART },
- { .name = "mxs-auart-imx28", .driver_data = IMX28_AUART },
- { .name = "as-auart-asm9260", .driver_data = ASM9260_AUART },
- { /* sentinel */ }
-};
-MODULE_DEVICE_TABLE(platform, mxs_auart_devtype);
-
static const struct of_device_id mxs_auart_dt_ids[] = {
{
.compatible = "fsl,imx28-auart",
- .data = &mxs_auart_devtype[IMX28_AUART]
+ .data = (const void *)IMX28_AUART
}, {
.compatible = "fsl,imx23-auart",
- .data = &mxs_auart_devtype[IMX23_AUART]
+ .data = (const void *)IMX23_AUART
}, {
.compatible = "alphascale,asm9260-auart",
- .data = &mxs_auart_devtype[ASM9260_AUART]
+ .data = (const void *)ASM9260_AUART
}, { /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, mxs_auart_dt_ids);
@@ -1639,8 +1631,6 @@ static int mxs_auart_request_gpio_irq(struct mxs_auart_port *s)
static int mxs_auart_probe(struct platform_device *pdev)
{
- const struct of_device_id *of_id =
- of_match_device(mxs_auart_dt_ids, &pdev->dev);
struct mxs_auart_port *s;
u32 version;
int ret, irq;
@@ -1663,10 +1653,7 @@ static int mxs_auart_probe(struct platform_device *pdev)
return -EINVAL;
}
- if (of_id) {
- pdev->id_entry = of_id->data;
- s->devtype = pdev->id_entry->driver_data;
- }
+ s->devtype = (enum mxs_auart_type)of_device_get_match_data(&pdev->dev);
ret = mxs_get_clks(s, pdev);
if (ret)
diff --git a/drivers/tty/serial/pmac_zilog.h b/drivers/tty/serial/pmac_zilog.h
index bb874e76810e..fa85b0de5c2f 100644
--- a/drivers/tty/serial/pmac_zilog.h
+++ b/drivers/tty/serial/pmac_zilog.h
@@ -362,10 +362,10 @@ static inline void zssync(struct uart_pmac_port *port)
/* Misc macros */
#define ZS_CLEARERR(port) (write_zsreg(port, 0, ERR_RES))
-#define ZS_CLEARFIFO(port) do { volatile unsigned char garbage; \
- garbage = read_zsdata(port); \
- garbage = read_zsdata(port); \
- garbage = read_zsdata(port); \
+#define ZS_CLEARFIFO(port) do { \
+ read_zsdata(port); \
+ read_zsdata(port); \
+ read_zsdata(port); \
} while(0)
#define ZS_IS_CONS(UP) ((UP)->flags & PMACZILOG_FLAG_IS_CONS)
diff --git a/drivers/tty/serial/pnx8xxx_uart.c b/drivers/tty/serial/pnx8xxx_uart.c
deleted file mode 100644
index 972d94e8d32b..000000000000
--- a/drivers/tty/serial/pnx8xxx_uart.c
+++ /dev/null
@@ -1,858 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * UART driver for PNX8XXX SoCs
- *
- * Author: Per Hallsmark per.hallsmark@mvista.com
- * Ported to 2.6 kernel by EmbeddedAlley
- * Reworked by Vitaly Wool <vitalywool@gmail.com>
- *
- * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.
- * Copyright (C) 2000 Deep Blue Solutions Ltd.
- */
-
-#include <linux/module.h>
-#include <linux/ioport.h>
-#include <linux/init.h>
-#include <linux/console.h>
-#include <linux/sysrq.h>
-#include <linux/device.h>
-#include <linux/platform_device.h>
-#include <linux/tty.h>
-#include <linux/tty_flip.h>
-#include <linux/serial_core.h>
-#include <linux/serial.h>
-#include <linux/serial_pnx8xxx.h>
-
-#include <asm/io.h>
-#include <asm/irq.h>
-
-/* We'll be using StrongARM sa1100 serial port major/minor */
-#define SERIAL_PNX8XXX_MAJOR 204
-#define MINOR_START 5
-
-#define NR_PORTS 2
-
-#define PNX8XXX_ISR_PASS_LIMIT 256
-
-/*
- * Convert from ignore_status_mask or read_status_mask to FIFO
- * and interrupt status bits
- */
-#define SM_TO_FIFO(x) ((x) >> 10)
-#define SM_TO_ISTAT(x) ((x) & 0x000001ff)
-#define FIFO_TO_SM(x) ((x) << 10)
-#define ISTAT_TO_SM(x) ((x) & 0x000001ff)
-
-/*
- * This is the size of our serial port register set.
- */
-#define UART_PORT_SIZE 0x1000
-
-/*
- * This determines how often we check the modem status signals
- * for any change. They generally aren't connected to an IRQ
- * so we have to poll them. We also check immediately before
- * filling the TX fifo incase CTS has been dropped.
- */
-#define MCTRL_TIMEOUT (250*HZ/1000)
-
-extern struct pnx8xxx_port pnx8xxx_ports[];
-
-static inline int serial_in(struct pnx8xxx_port *sport, int offset)
-{
- return (__raw_readl(sport->port.membase + offset));
-}
-
-static inline void serial_out(struct pnx8xxx_port *sport, int offset, int value)
-{
- __raw_writel(value, sport->port.membase + offset);
-}
-
-/*
- * Handle any change of modem status signal since we were last called.
- */
-static void pnx8xxx_mctrl_check(struct pnx8xxx_port *sport)
-{
- unsigned int status, changed;
-
- status = sport->port.ops->get_mctrl(&sport->port);
- changed = status ^ sport->old_status;
-
- if (changed == 0)
- return;
-
- sport->old_status = status;
-
- if (changed & TIOCM_RI)
- sport->port.icount.rng++;
- if (changed & TIOCM_DSR)
- sport->port.icount.dsr++;
- if (changed & TIOCM_CAR)
- uart_handle_dcd_change(&sport->port, status & TIOCM_CAR);
- if (changed & TIOCM_CTS)
- uart_handle_cts_change(&sport->port, status & TIOCM_CTS);
-
- wake_up_interruptible(&sport->port.state->port.delta_msr_wait);
-}
-
-/*
- * This is our per-port timeout handler, for checking the
- * modem status signals.
- */
-static void pnx8xxx_timeout(struct timer_list *t)
-{
- struct pnx8xxx_port *sport = from_timer(sport, t, timer);
- unsigned long flags;
-
- if (sport->port.state) {
- spin_lock_irqsave(&sport->port.lock, flags);
- pnx8xxx_mctrl_check(sport);
- spin_unlock_irqrestore(&sport->port.lock, flags);
-
- mod_timer(&sport->timer, jiffies + MCTRL_TIMEOUT);
- }
-}
-
-/*
- * interrupts disabled on entry
- */
-static void pnx8xxx_stop_tx(struct uart_port *port)
-{
- struct pnx8xxx_port *sport =
- container_of(port, struct pnx8xxx_port, port);
- u32 ien;
-
- /* Disable TX intr */
- ien = serial_in(sport, PNX8XXX_IEN);
- serial_out(sport, PNX8XXX_IEN, ien & ~PNX8XXX_UART_INT_ALLTX);
-
- /* Clear all pending TX intr */
- serial_out(sport, PNX8XXX_ICLR, PNX8XXX_UART_INT_ALLTX);
-}
-
-/*
- * interrupts may not be disabled on entry
- */
-static void pnx8xxx_start_tx(struct uart_port *port)
-{
- struct pnx8xxx_port *sport =
- container_of(port, struct pnx8xxx_port, port);
- u32 ien;
-
- /* Clear all pending TX intr */
- serial_out(sport, PNX8XXX_ICLR, PNX8XXX_UART_INT_ALLTX);
-
- /* Enable TX intr */
- ien = serial_in(sport, PNX8XXX_IEN);
- serial_out(sport, PNX8XXX_IEN, ien | PNX8XXX_UART_INT_ALLTX);
-}
-
-/*
- * Interrupts enabled
- */
-static void pnx8xxx_stop_rx(struct uart_port *port)
-{
- struct pnx8xxx_port *sport =
- container_of(port, struct pnx8xxx_port, port);
- u32 ien;
-
- /* Disable RX intr */
- ien = serial_in(sport, PNX8XXX_IEN);
- serial_out(sport, PNX8XXX_IEN, ien & ~PNX8XXX_UART_INT_ALLRX);
-
- /* Clear all pending RX intr */
- serial_out(sport, PNX8XXX_ICLR, PNX8XXX_UART_INT_ALLRX);
-}
-
-/*
- * Set the modem control timer to fire immediately.
- */
-static void pnx8xxx_enable_ms(struct uart_port *port)
-{
- struct pnx8xxx_port *sport =
- container_of(port, struct pnx8xxx_port, port);
-
- mod_timer(&sport->timer, jiffies);
-}
-
-static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport)
-{
- unsigned int status, ch, flg;
-
- status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) |
- ISTAT_TO_SM(serial_in(sport, PNX8XXX_ISTAT));
- while (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFIFO)) {
- ch = serial_in(sport, PNX8XXX_FIFO) & 0xff;
-
- sport->port.icount.rx++;
-
- flg = TTY_NORMAL;
-
- /*
- * note that the error handling code is
- * out of the main execution path
- */
- if (status & (FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE |
- PNX8XXX_UART_FIFO_RXPAR |
- PNX8XXX_UART_FIFO_RXBRK) |
- ISTAT_TO_SM(PNX8XXX_UART_INT_RXOVRN))) {
- if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXBRK)) {
- status &= ~(FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE) |
- FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR));
- sport->port.icount.brk++;
- if (uart_handle_break(&sport->port))
- goto ignore_char;
- } else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR))
- sport->port.icount.parity++;
- else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE))
- sport->port.icount.frame++;
- if (status & ISTAT_TO_SM(PNX8XXX_UART_INT_RXOVRN))
- sport->port.icount.overrun++;
-
- status &= sport->port.read_status_mask;
-
- if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR))
- flg = TTY_PARITY;
- else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE))
- flg = TTY_FRAME;
-
- sport->port.sysrq = 0;
- }
-
- if (uart_handle_sysrq_char(&sport->port, ch))
- goto ignore_char;
-
- uart_insert_char(&sport->port, status,
- ISTAT_TO_SM(PNX8XXX_UART_INT_RXOVRN), ch, flg);
-
- ignore_char:
- serial_out(sport, PNX8XXX_LCR, serial_in(sport, PNX8XXX_LCR) |
- PNX8XXX_UART_LCR_RX_NEXT);
- status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) |
- ISTAT_TO_SM(serial_in(sport, PNX8XXX_ISTAT));
- }
-
- spin_unlock(&sport->port.lock);
- tty_flip_buffer_push(&sport->port.state->port);
- spin_lock(&sport->port.lock);
-}
-
-static void pnx8xxx_tx_chars(struct pnx8xxx_port *sport)
-{
- struct circ_buf *xmit = &sport->port.state->xmit;
-
- if (sport->port.x_char) {
- serial_out(sport, PNX8XXX_FIFO, sport->port.x_char);
- sport->port.icount.tx++;
- sport->port.x_char = 0;
- return;
- }
-
- /*
- * Check the modem control lines before
- * transmitting anything.
- */
- pnx8xxx_mctrl_check(sport);
-
- if (uart_circ_empty(xmit) || uart_tx_stopped(&sport->port)) {
- pnx8xxx_stop_tx(&sport->port);
- return;
- }
-
- /*
- * TX while bytes available
- */
- while (((serial_in(sport, PNX8XXX_FIFO) &
- PNX8XXX_UART_FIFO_TXFIFO) >> 16) < 16) {
- serial_out(sport, PNX8XXX_FIFO, xmit->buf[xmit->tail]);
- xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
- sport->port.icount.tx++;
- if (uart_circ_empty(xmit))
- break;
- }
-
- if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
- uart_write_wakeup(&sport->port);
-
- if (uart_circ_empty(xmit))
- pnx8xxx_stop_tx(&sport->port);
-}
-
-static irqreturn_t pnx8xxx_int(int irq, void *dev_id)
-{
- struct pnx8xxx_port *sport = dev_id;
- unsigned int status;
-
- spin_lock(&sport->port.lock);
- /* Get the interrupts */
- status = serial_in(sport, PNX8XXX_ISTAT) & serial_in(sport, PNX8XXX_IEN);
-
- /* Byte or break signal received */
- if (status & (PNX8XXX_UART_INT_RX | PNX8XXX_UART_INT_BREAK))
- pnx8xxx_rx_chars(sport);
-
- /* TX holding register empty - transmit a byte */
- if (status & PNX8XXX_UART_INT_TX)
- pnx8xxx_tx_chars(sport);
-
- /* Clear the ISTAT register */
- serial_out(sport, PNX8XXX_ICLR, status);
-
- spin_unlock(&sport->port.lock);
- return IRQ_HANDLED;
-}
-
-/*
- * Return TIOCSER_TEMT when transmitter is not busy.
- */
-static unsigned int pnx8xxx_tx_empty(struct uart_port *port)
-{
- struct pnx8xxx_port *sport =
- container_of(port, struct pnx8xxx_port, port);
-
- return serial_in(sport, PNX8XXX_FIFO) & PNX8XXX_UART_FIFO_TXFIFO_STA ? 0 : TIOCSER_TEMT;
-}
-
-static unsigned int pnx8xxx_get_mctrl(struct uart_port *port)
-{
- struct pnx8xxx_port *sport =
- container_of(port, struct pnx8xxx_port, port);
- unsigned int mctrl = TIOCM_DSR;
- unsigned int msr;
-
- /* REVISIT */
-
- msr = serial_in(sport, PNX8XXX_MCR);
-
- mctrl |= msr & PNX8XXX_UART_MCR_CTS ? TIOCM_CTS : 0;
- mctrl |= msr & PNX8XXX_UART_MCR_DCD ? TIOCM_CAR : 0;
-
- return mctrl;
-}
-
-static void pnx8xxx_set_mctrl(struct uart_port *port, unsigned int mctrl)
-{
-#if 0 /* FIXME */
- struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port;
- unsigned int msr;
-#endif
-}
-
-/*
- * Interrupts always disabled.
- */
-static void pnx8xxx_break_ctl(struct uart_port *port, int break_state)
-{
- struct pnx8xxx_port *sport =
- container_of(port, struct pnx8xxx_port, port);
- unsigned long flags;
- unsigned int lcr;
-
- spin_lock_irqsave(&sport->port.lock, flags);
- lcr = serial_in(sport, PNX8XXX_LCR);
- if (break_state == -1)
- lcr |= PNX8XXX_UART_LCR_TXBREAK;
- else
- lcr &= ~PNX8XXX_UART_LCR_TXBREAK;
- serial_out(sport, PNX8XXX_LCR, lcr);
- spin_unlock_irqrestore(&sport->port.lock, flags);
-}
-
-static int pnx8xxx_startup(struct uart_port *port)
-{
- struct pnx8xxx_port *sport =
- container_of(port, struct pnx8xxx_port, port);
- int retval;
-
- /*
- * Allocate the IRQ
- */
- retval = request_irq(sport->port.irq, pnx8xxx_int, 0,
- "pnx8xxx-uart", sport);
- if (retval)
- return retval;
-
- /*
- * Finally, clear and enable interrupts
- */
-
- serial_out(sport, PNX8XXX_ICLR, PNX8XXX_UART_INT_ALLRX |
- PNX8XXX_UART_INT_ALLTX);
-
- serial_out(sport, PNX8XXX_IEN, serial_in(sport, PNX8XXX_IEN) |
- PNX8XXX_UART_INT_ALLRX |
- PNX8XXX_UART_INT_ALLTX);
-
- /*
- * Enable modem status interrupts
- */
- spin_lock_irq(&sport->port.lock);
- pnx8xxx_enable_ms(&sport->port);
- spin_unlock_irq(&sport->port.lock);
-
- return 0;
-}
-
-static void pnx8xxx_shutdown(struct uart_port *port)
-{
- struct pnx8xxx_port *sport =
- container_of(port, struct pnx8xxx_port, port);
- int lcr;
-
- /*
- * Stop our timer.
- */
- del_timer_sync(&sport->timer);
-
- /*
- * Disable all interrupts
- */
- serial_out(sport, PNX8XXX_IEN, 0);
-
- /*
- * Reset the Tx and Rx FIFOS, disable the break condition
- */
- lcr = serial_in(sport, PNX8XXX_LCR);
- lcr &= ~PNX8XXX_UART_LCR_TXBREAK;
- lcr |= PNX8XXX_UART_LCR_TX_RST | PNX8XXX_UART_LCR_RX_RST;
- serial_out(sport, PNX8XXX_LCR, lcr);
-
- /*
- * Clear all interrupts
- */
- serial_out(sport, PNX8XXX_ICLR, PNX8XXX_UART_INT_ALLRX |
- PNX8XXX_UART_INT_ALLTX);
-
- /*
- * Free the interrupt
- */
- free_irq(sport->port.irq, sport);
-}
-
-static void
-pnx8xxx_set_termios(struct uart_port *port, struct ktermios *termios,
- struct ktermios *old)
-{
- struct pnx8xxx_port *sport =
- container_of(port, struct pnx8xxx_port, port);
- unsigned long flags;
- unsigned int lcr_fcr, old_ien, baud, quot;
- unsigned int old_csize = old ? old->c_cflag & CSIZE : CS8;
-
- /*
- * We only support CS7 and CS8.
- */
- while ((termios->c_cflag & CSIZE) != CS7 &&
- (termios->c_cflag & CSIZE) != CS8) {
- termios->c_cflag &= ~CSIZE;
- termios->c_cflag |= old_csize;
- old_csize = CS8;
- }
-
- if ((termios->c_cflag & CSIZE) == CS8)
- lcr_fcr = PNX8XXX_UART_LCR_8BIT;
- else
- lcr_fcr = 0;
-
- if (termios->c_cflag & CSTOPB)
- lcr_fcr |= PNX8XXX_UART_LCR_2STOPB;
- if (termios->c_cflag & PARENB) {
- lcr_fcr |= PNX8XXX_UART_LCR_PAREN;
- if (!(termios->c_cflag & PARODD))
- lcr_fcr |= PNX8XXX_UART_LCR_PAREVN;
- }
-
- /*
- * Ask the core to calculate the divisor for us.
- */
- baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
- quot = uart_get_divisor(port, baud);
-
- spin_lock_irqsave(&sport->port.lock, flags);
-
- sport->port.read_status_mask = ISTAT_TO_SM(PNX8XXX_UART_INT_RXOVRN) |
- ISTAT_TO_SM(PNX8XXX_UART_INT_EMPTY) |
- ISTAT_TO_SM(PNX8XXX_UART_INT_RX);
- if (termios->c_iflag & INPCK)
- sport->port.read_status_mask |=
- FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE) |
- FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR);
- if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
- sport->port.read_status_mask |=
- ISTAT_TO_SM(PNX8XXX_UART_INT_BREAK);
-
- /*
- * Characters to ignore
- */
- sport->port.ignore_status_mask = 0;
- if (termios->c_iflag & IGNPAR)
- sport->port.ignore_status_mask |=
- FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE) |
- FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR);
- if (termios->c_iflag & IGNBRK) {
- sport->port.ignore_status_mask |=
- ISTAT_TO_SM(PNX8XXX_UART_INT_BREAK);
- /*
- * If we're ignoring parity and break indicators,
- * ignore overruns too (for real raw support).
- */
- if (termios->c_iflag & IGNPAR)
- sport->port.ignore_status_mask |=
- ISTAT_TO_SM(PNX8XXX_UART_INT_RXOVRN);
- }
-
- /*
- * ignore all characters if CREAD is not set
- */
- if ((termios->c_cflag & CREAD) == 0)
- sport->port.ignore_status_mask |=
- ISTAT_TO_SM(PNX8XXX_UART_INT_RX);
-
- del_timer_sync(&sport->timer);
-
- /*
- * Update the per-port timeout.
- */
- uart_update_timeout(port, termios->c_cflag, baud);
-
- /*
- * disable interrupts and drain transmitter
- */
- old_ien = serial_in(sport, PNX8XXX_IEN);
- serial_out(sport, PNX8XXX_IEN, old_ien & ~(PNX8XXX_UART_INT_ALLTX |
- PNX8XXX_UART_INT_ALLRX));
-
- while (serial_in(sport, PNX8XXX_FIFO) & PNX8XXX_UART_FIFO_TXFIFO_STA)
- barrier();
-
- /* then, disable everything */
- serial_out(sport, PNX8XXX_IEN, 0);
-
- /* Reset the Rx and Tx FIFOs too */
- lcr_fcr |= PNX8XXX_UART_LCR_TX_RST;
- lcr_fcr |= PNX8XXX_UART_LCR_RX_RST;
-
- /* set the parity, stop bits and data size */
- serial_out(sport, PNX8XXX_LCR, lcr_fcr);
-
- /* set the baud rate */
- quot -= 1;
- serial_out(sport, PNX8XXX_BAUD, quot);
-
- serial_out(sport, PNX8XXX_ICLR, -1);
-
- serial_out(sport, PNX8XXX_IEN, old_ien);
-
- if (UART_ENABLE_MS(&sport->port, termios->c_cflag))
- pnx8xxx_enable_ms(&sport->port);
-
- spin_unlock_irqrestore(&sport->port.lock, flags);
-}
-
-static const char *pnx8xxx_type(struct uart_port *port)
-{
- struct pnx8xxx_port *sport =
- container_of(port, struct pnx8xxx_port, port);
-
- return sport->port.type == PORT_PNX8XXX ? "PNX8XXX" : NULL;
-}
-
-/*
- * Release the memory region(s) being used by 'port'.
- */
-static void pnx8xxx_release_port(struct uart_port *port)
-{
- struct pnx8xxx_port *sport =
- container_of(port, struct pnx8xxx_port, port);
-
- release_mem_region(sport->port.mapbase, UART_PORT_SIZE);
-}
-
-/*
- * Request the memory region(s) being used by 'port'.
- */
-static int pnx8xxx_request_port(struct uart_port *port)
-{
- struct pnx8xxx_port *sport =
- container_of(port, struct pnx8xxx_port, port);
- return request_mem_region(sport->port.mapbase, UART_PORT_SIZE,
- "pnx8xxx-uart") != NULL ? 0 : -EBUSY;
-}
-
-/*
- * Configure/autoconfigure the port.
- */
-static void pnx8xxx_config_port(struct uart_port *port, int flags)
-{
- struct pnx8xxx_port *sport =
- container_of(port, struct pnx8xxx_port, port);
-
- if (flags & UART_CONFIG_TYPE &&
- pnx8xxx_request_port(&sport->port) == 0)
- sport->port.type = PORT_PNX8XXX;
-}
-
-/*
- * Verify the new serial_struct (for TIOCSSERIAL).
- * The only change we allow are to the flags and type, and
- * even then only between PORT_PNX8XXX and PORT_UNKNOWN
- */
-static int
-pnx8xxx_verify_port(struct uart_port *port, struct serial_struct *ser)
-{
- struct pnx8xxx_port *sport =
- container_of(port, struct pnx8xxx_port, port);
- int ret = 0;
-
- if (ser->type != PORT_UNKNOWN && ser->type != PORT_PNX8XXX)
- ret = -EINVAL;
- if (sport->port.irq != ser->irq)
- ret = -EINVAL;
- if (ser->io_type != SERIAL_IO_MEM)
- ret = -EINVAL;
- if (sport->port.uartclk / 16 != ser->baud_base)
- ret = -EINVAL;
- if ((void *)sport->port.mapbase != ser->iomem_base)
- ret = -EINVAL;
- if (sport->port.iobase != ser->port)
- ret = -EINVAL;
- if (ser->hub6 != 0)
- ret = -EINVAL;
- return ret;
-}
-
-static const struct uart_ops pnx8xxx_pops = {
- .tx_empty = pnx8xxx_tx_empty,
- .set_mctrl = pnx8xxx_set_mctrl,
- .get_mctrl = pnx8xxx_get_mctrl,
- .stop_tx = pnx8xxx_stop_tx,
- .start_tx = pnx8xxx_start_tx,
- .stop_rx = pnx8xxx_stop_rx,
- .enable_ms = pnx8xxx_enable_ms,
- .break_ctl = pnx8xxx_break_ctl,
- .startup = pnx8xxx_startup,
- .shutdown = pnx8xxx_shutdown,
- .set_termios = pnx8xxx_set_termios,
- .type = pnx8xxx_type,
- .release_port = pnx8xxx_release_port,
- .request_port = pnx8xxx_request_port,
- .config_port = pnx8xxx_config_port,
- .verify_port = pnx8xxx_verify_port,
-};
-
-
-/*
- * Setup the PNX8XXX serial ports.
- *
- * Note also that we support "console=ttySx" where "x" is either 0 or 1.
- */
-static void __init pnx8xxx_init_ports(void)
-{
- static int first = 1;
- int i;
-
- if (!first)
- return;
- first = 0;
-
- for (i = 0; i < NR_PORTS; i++) {
- timer_setup(&pnx8xxx_ports[i].timer, pnx8xxx_timeout, 0);
- pnx8xxx_ports[i].port.ops = &pnx8xxx_pops;
- }
-}
-
-#ifdef CONFIG_SERIAL_PNX8XXX_CONSOLE
-
-static void pnx8xxx_console_putchar(struct uart_port *port, int ch)
-{
- struct pnx8xxx_port *sport =
- container_of(port, struct pnx8xxx_port, port);
- int status;
-
- do {
- /* Wait for UART_TX register to empty */
- status = serial_in(sport, PNX8XXX_FIFO);
- } while (status & PNX8XXX_UART_FIFO_TXFIFO);
- serial_out(sport, PNX8XXX_FIFO, ch);
-}
-
-/*
- * Interrupts are disabled on entering
- */static void
-pnx8xxx_console_write(struct console *co, const char *s, unsigned int count)
-{
- struct pnx8xxx_port *sport = &pnx8xxx_ports[co->index];
- unsigned int old_ien, status;
-
- /*
- * First, save IEN and then disable interrupts
- */
- old_ien = serial_in(sport, PNX8XXX_IEN);
- serial_out(sport, PNX8XXX_IEN, old_ien & ~(PNX8XXX_UART_INT_ALLTX |
- PNX8XXX_UART_INT_ALLRX));
-
- uart_console_write(&sport->port, s, count, pnx8xxx_console_putchar);
-
- /*
- * Finally, wait for transmitter to become empty
- * and restore IEN
- */
- do {
- /* Wait for UART_TX register to empty */
- status = serial_in(sport, PNX8XXX_FIFO);
- } while (status & PNX8XXX_UART_FIFO_TXFIFO);
-
- /* Clear TX and EMPTY interrupt */
- serial_out(sport, PNX8XXX_ICLR, PNX8XXX_UART_INT_TX |
- PNX8XXX_UART_INT_EMPTY);
-
- serial_out(sport, PNX8XXX_IEN, old_ien);
-}
-
-static int __init
-pnx8xxx_console_setup(struct console *co, char *options)
-{
- struct pnx8xxx_port *sport;
- int baud = 38400;
- int bits = 8;
- int parity = 'n';
- int flow = 'n';
-
- /*
- * Check whether an invalid uart number has been specified, and
- * if so, search for the first available port that does have
- * console support.
- */
- if (co->index == -1 || co->index >= NR_PORTS)
- co->index = 0;
- sport = &pnx8xxx_ports[co->index];
-
- if (options)
- uart_parse_options(options, &baud, &parity, &bits, &flow);
-
- return uart_set_options(&sport->port, co, baud, parity, bits, flow);
-}
-
-static struct uart_driver pnx8xxx_reg;
-static struct console pnx8xxx_console = {
- .name = "ttyS",
- .write = pnx8xxx_console_write,
- .device = uart_console_device,
- .setup = pnx8xxx_console_setup,
- .flags = CON_PRINTBUFFER,
- .index = -1,
- .data = &pnx8xxx_reg,
-};
-
-static int __init pnx8xxx_rs_console_init(void)
-{
- pnx8xxx_init_ports();
- register_console(&pnx8xxx_console);
- return 0;
-}
-console_initcall(pnx8xxx_rs_console_init);
-
-#define PNX8XXX_CONSOLE &pnx8xxx_console
-#else
-#define PNX8XXX_CONSOLE NULL
-#endif
-
-static struct uart_driver pnx8xxx_reg = {
- .owner = THIS_MODULE,
- .driver_name = "ttyS",
- .dev_name = "ttyS",
- .major = SERIAL_PNX8XXX_MAJOR,
- .minor = MINOR_START,
- .nr = NR_PORTS,
- .cons = PNX8XXX_CONSOLE,
-};
-
-static int pnx8xxx_serial_suspend(struct platform_device *pdev, pm_message_t state)
-{
- struct pnx8xxx_port *sport = platform_get_drvdata(pdev);
-
- return uart_suspend_port(&pnx8xxx_reg, &sport->port);
-}
-
-static int pnx8xxx_serial_resume(struct platform_device *pdev)
-{
- struct pnx8xxx_port *sport = platform_get_drvdata(pdev);
-
- return uart_resume_port(&pnx8xxx_reg, &sport->port);
-}
-
-static int pnx8xxx_serial_probe(struct platform_device *pdev)
-{
- struct resource *res = pdev->resource;
- int i;
-
- for (i = 0; i < pdev->num_resources; i++, res++) {
- if (!(res->flags & IORESOURCE_MEM))
- continue;
-
- for (i = 0; i < NR_PORTS; i++) {
- if (pnx8xxx_ports[i].port.mapbase != res->start)
- continue;
-
- pnx8xxx_ports[i].port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_PNX8XXX_CONSOLE);
- pnx8xxx_ports[i].port.dev = &pdev->dev;
- uart_add_one_port(&pnx8xxx_reg, &pnx8xxx_ports[i].port);
- platform_set_drvdata(pdev, &pnx8xxx_ports[i]);
- break;
- }
- }
-
- return 0;
-}
-
-static int pnx8xxx_serial_remove(struct platform_device *pdev)
-{
- struct pnx8xxx_port *sport = platform_get_drvdata(pdev);
-
- if (sport)
- uart_remove_one_port(&pnx8xxx_reg, &sport->port);
-
- return 0;
-}
-
-static struct platform_driver pnx8xxx_serial_driver = {
- .driver = {
- .name = "pnx8xxx-uart",
- },
- .probe = pnx8xxx_serial_probe,
- .remove = pnx8xxx_serial_remove,
- .suspend = pnx8xxx_serial_suspend,
- .resume = pnx8xxx_serial_resume,
-};
-
-static int __init pnx8xxx_serial_init(void)
-{
- int ret;
-
- printk(KERN_INFO "Serial: PNX8XXX driver\n");
-
- pnx8xxx_init_ports();
-
- ret = uart_register_driver(&pnx8xxx_reg);
- if (ret == 0) {
- ret = platform_driver_register(&pnx8xxx_serial_driver);
- if (ret)
- uart_unregister_driver(&pnx8xxx_reg);
- }
- return ret;
-}
-
-static void __exit pnx8xxx_serial_exit(void)
-{
- platform_driver_unregister(&pnx8xxx_serial_driver);
- uart_unregister_driver(&pnx8xxx_reg);
-}
-
-module_init(pnx8xxx_serial_init);
-module_exit(pnx8xxx_serial_exit);
-
-MODULE_AUTHOR("Embedded Alley Solutions, Inc.");
-MODULE_DESCRIPTION("PNX8XXX SoCs serial port driver");
-MODULE_LICENSE("GPL");
-MODULE_ALIAS_CHARDEV_MAJOR(SERIAL_PNX8XXX_MAJOR);
-MODULE_ALIAS("platform:pnx8xxx-uart");
diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c
index bd13014a1c53..bbae072a125d 100644
--- a/drivers/tty/serial/serial-tegra.c
+++ b/drivers/tty/serial/serial-tegra.c
@@ -75,12 +75,17 @@
#define TEGRA_UART_FCR_IIR_FIFO_EN 0x40
/**
- * tegra_uart_chip_data: SOC specific data.
+ * struct tegra_uart_chip_data: SOC specific data.
*
* @tx_fifo_full_status: Status flag available for checking tx fifo full.
* @allow_txfifo_reset_fifo_mode: allow_tx fifo reset with fifo mode or not.
* Tegra30 does not allow this.
* @support_clk_src_div: Clock source support the clock divider.
+ * @fifo_mode_enable_status: Is FIFO mode enabled?
+ * @uart_max_port: Maximum number of UART ports
+ * @max_dma_burst_bytes: Maximum size of DMA bursts
+ * @error_tolerance_low_range: Lowest number in the error tolerance range
+ * @error_tolerance_high_range: Highest number in the error tolerance range
*/
struct tegra_uart_chip_data {
bool tx_fifo_full_status;
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index f41cba10b86b..828f9ad1be49 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1467,6 +1467,10 @@ static void uart_set_ldisc(struct tty_struct *tty)
{
struct uart_state *state = tty->driver_data;
struct uart_port *uport;
+ struct tty_port *port = &state->port;
+
+ if (!tty_port_initialized(port))
+ return;
mutex_lock(&state->port.mutex);
uport = uart_port_check(state);
diff --git a/drivers/tty/serial/serial_mctrl_gpio.c b/drivers/tty/serial/serial_mctrl_gpio.c
index fb4781292d40..c41d8911ce95 100644
--- a/drivers/tty/serial/serial_mctrl_gpio.c
+++ b/drivers/tty/serial/serial_mctrl_gpio.c
@@ -207,7 +207,7 @@ struct mctrl_gpios *mctrl_gpio_init(struct uart_port *port, unsigned int idx)
continue;
ret = gpiod_to_irq(gpios->gpio[i]);
- if (ret <= 0) {
+ if (ret < 0) {
dev_err(port->dev,
"failed to find corresponding irq for %s (idx=%d, err=%d)\n",
mctrl_gpios_desc[i].name, idx, ret);
diff --git a/drivers/tty/serial/sifive.c b/drivers/tty/serial/sifive.c
index 13eadcb8aec4..1066eebe3b28 100644
--- a/drivers/tty/serial/sifive.c
+++ b/drivers/tty/serial/sifive.c
@@ -144,12 +144,13 @@
*/
/**
- * sifive_serial_port - driver-specific data extension to struct uart_port
+ * struct sifive_serial_port - driver-specific data extension to struct uart_port
* @port: struct uart_port embedded in this struct
* @dev: struct device *
* @ier: shadowed copy of the interrupt enable register
* @clkin_rate: input clock to the UART IP block.
* @baud_rate: UART serial line rate (e.g., 115200 baud)
+ * @clk: reference to this device's clock
* @clk_notifier: clock rate change notifier for upstream clock changes
*
* Configuration data specific to this SiFive UART.
diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
index ee6c7762d355..f4de32d3f2af 100644
--- a/drivers/tty/serial/stm32-usart.c
+++ b/drivers/tty/serial/stm32-usart.c
@@ -350,7 +350,6 @@ static void stm32_transmit_chars_dma(struct uart_port *port)
struct stm32_usart_offsets *ofs = &stm32port->info->ofs;
struct circ_buf *xmit = &port->state->xmit;
struct dma_async_tx_descriptor *desc = NULL;
- dma_cookie_t cookie;
unsigned int count, i;
if (stm32port->tx_dma_busy)
@@ -394,7 +393,7 @@ static void stm32_transmit_chars_dma(struct uart_port *port)
desc->callback_param = port;
/* Push current DMA TX transaction in the pending queue */
- cookie = dmaengine_submit(desc);
+ dmaengine_submit(desc);
/* Issue pending DMA TX requests */
dma_async_issue_pending(stm32port->tx_ch);
@@ -1087,7 +1086,6 @@ static int stm32_of_dma_rx_probe(struct stm32_port *stm32port,
struct device *dev = &pdev->dev;
struct dma_slave_config config;
struct dma_async_tx_descriptor *desc = NULL;
- dma_cookie_t cookie;
int ret;
/* Request DMA RX channel */
@@ -1132,7 +1130,7 @@ static int stm32_of_dma_rx_probe(struct stm32_port *stm32port,
desc->callback_param = NULL;
/* Push current DMA transaction in the pending queue */
- cookie = dmaengine_submit(desc);
+ dmaengine_submit(desc);
/* Issue pending DMA requests */
dma_async_issue_pending(stm32port->rx_ch);
diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index 09379db613d8..f42ccc40ffa6 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -773,8 +773,8 @@ static int ulite_probe(struct platform_device *pdev)
return -ENODEV;
irq = platform_get_irq(pdev, 0);
- if (irq <= 0)
- return -ENXIO;
+ if (irq < 0)
+ return irq;
pdata->clk = devm_clk_get(&pdev->dev, "s_axi_aclk");
if (IS_ERR(pdata->clk)) {
diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index a9b1ee27183a..a14c5d996473 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -192,6 +192,7 @@ MODULE_PARM_DESC(rx_timeout, "Rx timeout, 1-255");
* @baud: Current baud rate
* @clk_rate_change_nb: Notifier block for clock changes
* @quirks: Flags for RXBS support.
+ * @cts_override: Modem control state override
*/
struct cdns_uart {
struct uart_port *port;