From: Sumit Garg <sumit.garg@linaro.org>
To: gregkh@linuxfoundation.org, daniel.thompson@linaro.org,
dianders@chromium.org, linux-serial@vger.kernel.org,
kgdb-bugreport@lists.sourceforge.net
Cc: jslaby@suse.com, linux@armlinux.org.uk,
jason.wessel@windriver.com, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Sumit Garg <sumit.garg@linaro.org>
Subject: [RFC 3/5] serial: amba-pl011: Re-order APIs definition
Date: Tue, 21 Jul 2020 17:40:11 +0530 [thread overview]
Message-ID: <1595333413-30052-4-git-send-email-sumit.garg@linaro.org> (raw)
In-Reply-To: <1595333413-30052-1-git-send-email-sumit.garg@linaro.org>
A future patch will need to call pl011_hwinit() and
pl011_enable_interrupts() before they are currently defined. Move
them closer to the front of the file. There is no change in the
implementation of either function.
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
---
drivers/tty/serial/amba-pl011.c | 148 ++++++++++++++++++++--------------------
1 file changed, 74 insertions(+), 74 deletions(-)
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 8efd7c2..0983c5e 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -1581,6 +1581,80 @@ static void pl011_break_ctl(struct uart_port *port, int break_state)
spin_unlock_irqrestore(&uap->port.lock, flags);
}
+static int pl011_hwinit(struct uart_port *port)
+{
+ struct uart_amba_port *uap =
+ container_of(port, struct uart_amba_port, port);
+ int retval;
+
+ /* Optionaly enable pins to be muxed in and configured */
+ pinctrl_pm_select_default_state(port->dev);
+
+ /*
+ * Try to enable the clock producer.
+ */
+ retval = clk_prepare_enable(uap->clk);
+ if (retval)
+ return retval;
+
+ uap->port.uartclk = clk_get_rate(uap->clk);
+
+ /* Clear pending error and receive interrupts */
+ pl011_write(UART011_OEIS | UART011_BEIS | UART011_PEIS |
+ UART011_FEIS | UART011_RTIS | UART011_RXIS,
+ uap, REG_ICR);
+
+ /*
+ * Save interrupts enable mask, and enable RX interrupts in case if
+ * the interrupt is used for NMI entry.
+ */
+ uap->im = pl011_read(uap, REG_IMSC);
+ pl011_write(UART011_RTIM | UART011_RXIM, uap, REG_IMSC);
+
+ if (dev_get_platdata(uap->port.dev)) {
+ struct amba_pl011_data *plat;
+
+ plat = dev_get_platdata(uap->port.dev);
+ if (plat->init)
+ plat->init();
+ }
+ return 0;
+}
+
+/*
+ * Enable interrupts, only timeouts when using DMA
+ * if initial RX DMA job failed, start in interrupt mode
+ * as well.
+ */
+static void pl011_enable_interrupts(struct uart_amba_port *uap)
+{
+ unsigned int i;
+
+ spin_lock_irq(&uap->port.lock);
+
+ /* Clear out any spuriously appearing RX interrupts */
+ pl011_write(UART011_RTIS | UART011_RXIS, uap, REG_ICR);
+
+ /*
+ * RXIS is asserted only when the RX FIFO transitions from below
+ * to above the trigger threshold. If the RX FIFO is already
+ * full to the threshold this can't happen and RXIS will now be
+ * stuck off. Drain the RX FIFO explicitly to fix this:
+ */
+ for (i = 0; i < uap->fifosize * 2; ++i) {
+ if (pl011_read(uap, REG_FR) & UART01x_FR_RXFE)
+ break;
+
+ pl011_read(uap, REG_DR);
+ }
+
+ uap->im = UART011_RTIM;
+ if (!pl011_dma_rx_running(uap))
+ uap->im |= UART011_RXIM;
+ pl011_write(uap->im, uap, REG_IMSC);
+ spin_unlock_irq(&uap->port.lock);
+}
+
#ifdef CONFIG_CONSOLE_POLL
static void pl011_quiesce_irqs(struct uart_port *port)
@@ -1639,46 +1713,6 @@ static void pl011_put_poll_char(struct uart_port *port,
#endif /* CONFIG_CONSOLE_POLL */
-static int pl011_hwinit(struct uart_port *port)
-{
- struct uart_amba_port *uap =
- container_of(port, struct uart_amba_port, port);
- int retval;
-
- /* Optionaly enable pins to be muxed in and configured */
- pinctrl_pm_select_default_state(port->dev);
-
- /*
- * Try to enable the clock producer.
- */
- retval = clk_prepare_enable(uap->clk);
- if (retval)
- return retval;
-
- uap->port.uartclk = clk_get_rate(uap->clk);
-
- /* Clear pending error and receive interrupts */
- pl011_write(UART011_OEIS | UART011_BEIS | UART011_PEIS |
- UART011_FEIS | UART011_RTIS | UART011_RXIS,
- uap, REG_ICR);
-
- /*
- * Save interrupts enable mask, and enable RX interrupts in case if
- * the interrupt is used for NMI entry.
- */
- uap->im = pl011_read(uap, REG_IMSC);
- pl011_write(UART011_RTIM | UART011_RXIM, uap, REG_IMSC);
-
- if (dev_get_platdata(uap->port.dev)) {
- struct amba_pl011_data *plat;
-
- plat = dev_get_platdata(uap->port.dev);
- if (plat->init)
- plat->init();
- }
- return 0;
-}
-
static bool pl011_split_lcrh(const struct uart_amba_port *uap)
{
return pl011_reg_to_offset(uap, REG_LCRH_RX) !=
@@ -1707,40 +1741,6 @@ static int pl011_allocate_irq(struct uart_amba_port *uap)
return request_irq(uap->port.irq, pl011_int, IRQF_SHARED, "uart-pl011", uap);
}
-/*
- * Enable interrupts, only timeouts when using DMA
- * if initial RX DMA job failed, start in interrupt mode
- * as well.
- */
-static void pl011_enable_interrupts(struct uart_amba_port *uap)
-{
- unsigned int i;
-
- spin_lock_irq(&uap->port.lock);
-
- /* Clear out any spuriously appearing RX interrupts */
- pl011_write(UART011_RTIS | UART011_RXIS, uap, REG_ICR);
-
- /*
- * RXIS is asserted only when the RX FIFO transitions from below
- * to above the trigger threshold. If the RX FIFO is already
- * full to the threshold this can't happen and RXIS will now be
- * stuck off. Drain the RX FIFO explicitly to fix this:
- */
- for (i = 0; i < uap->fifosize * 2; ++i) {
- if (pl011_read(uap, REG_FR) & UART01x_FR_RXFE)
- break;
-
- pl011_read(uap, REG_DR);
- }
-
- uap->im = UART011_RTIM;
- if (!pl011_dma_rx_running(uap))
- uap->im |= UART011_RXIM;
- pl011_write(uap->im, uap, REG_IMSC);
- spin_unlock_irq(&uap->port.lock);
-}
-
static int pl011_startup(struct uart_port *port)
{
struct uart_amba_port *uap =
--
2.7.4
next prev parent reply other threads:[~2020-07-21 12:11 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-21 12:10 [RFC 0/5] Introduce NMI aware serial drivers Sumit Garg
2020-07-21 12:10 ` [RFC 1/5] tty/sysrq: Make sysrq handler NMI aware Sumit Garg
2020-08-12 23:59 ` Doug Anderson
2020-08-14 7:24 ` Sumit Garg
2020-08-14 14:34 ` peterz
2020-08-14 14:57 ` Doug Anderson
2020-08-17 14:08 ` Sumit Garg
2020-08-17 17:19 ` Doug Anderson
2020-08-18 13:30 ` Sumit Garg
2020-07-21 12:10 ` [RFC 2/5] serial: core: Add framework to allow NMI aware serial drivers Sumit Garg
2020-08-12 23:59 ` Doug Anderson
2020-08-13 14:19 ` Sumit Garg
2020-08-13 14:37 ` Doug Anderson
2020-08-14 11:17 ` Sumit Garg
2020-08-14 14:13 ` Daniel Thompson
2020-08-17 12:27 ` Sumit Garg
2020-08-17 13:57 ` Doug Anderson
2020-08-17 14:23 ` Sumit Garg
2020-08-17 14:32 ` Daniel Thompson
2020-08-18 13:18 ` Sumit Garg
2020-08-17 14:28 ` Daniel Thompson
2020-08-18 13:06 ` Sumit Garg
2020-08-14 14:43 ` Doug Anderson
2020-08-17 12:29 ` Sumit Garg
2020-07-21 12:10 ` Sumit Garg [this message]
2020-07-21 12:10 ` [RFC 4/5] serial: amba-pl011: Enable NMI aware uart port Sumit Garg
2020-08-12 23:59 ` Doug Anderson
2020-08-13 10:34 ` Sumit Garg
2020-07-21 12:10 ` [RFC 5/5] serial: Remove KGDB NMI serial driver Sumit Garg
2020-08-11 13:50 ` [RFC 0/5] Introduce NMI aware serial drivers Sumit Garg
2020-08-11 13:58 ` Greg Kroah-Hartman
2020-08-11 14:29 ` Sumit Garg
2020-08-11 14:58 ` Greg Kroah-Hartman
2020-08-11 17:15 ` Doug Anderson
2020-08-12 14:52 ` Sumit Garg
2020-08-12 15:27 ` Doug Anderson
2020-08-13 0:08 ` Doug Anderson
2020-08-13 9:25 ` Sumit Garg
2020-08-13 10:17 ` Daniel Thompson
2020-08-14 12:06 ` Sumit Garg
2020-08-14 14:18 ` Daniel Thompson
2020-08-17 5:12 ` Sumit Garg
2020-08-17 9:28 ` Daniel Thompson
2020-08-17 14:12 ` Sumit Garg
2020-08-13 15:26 ` Doug Anderson
2020-08-14 12:50 ` Sumit Garg
2020-08-12 5:48 ` Sumit Garg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1595333413-30052-4-git-send-email-sumit.garg@linaro.org \
--to=sumit.garg@linaro.org \
--cc=daniel.thompson@linaro.org \
--cc=dianders@chromium.org \
--cc=gregkh@linuxfoundation.org \
--cc=jason.wessel@windriver.com \
--cc=jslaby@suse.com \
--cc=kgdb-bugreport@lists.sourceforge.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux@armlinux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).