mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-29 18:11:20 +00:00
serial: imx: add imx_poll_init()
For the console poll usage, .poll_init() will perform deeper hardware initialization to ensure the serial port is always active. Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com> Cc: Jiri Slaby <jslaby@suse.cz> Cc: Huang Shijie <b32955@freescale.com> Cc: linux-serial@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
f968ef3494
commit
6b8bdad961
1 changed files with 36 additions and 0 deletions
|
@ -1455,6 +1455,41 @@ imx_verify_port(struct uart_port *port, struct serial_struct *ser)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_CONSOLE_POLL)
|
#if defined(CONFIG_CONSOLE_POLL)
|
||||||
|
|
||||||
|
static int imx_poll_init(struct uart_port *port)
|
||||||
|
{
|
||||||
|
struct imx_port *sport = (struct imx_port *)port;
|
||||||
|
unsigned long flags;
|
||||||
|
unsigned long temp;
|
||||||
|
int retval;
|
||||||
|
|
||||||
|
retval = clk_prepare_enable(sport->clk_ipg);
|
||||||
|
if (retval)
|
||||||
|
return retval;
|
||||||
|
retval = clk_prepare_enable(sport->clk_per);
|
||||||
|
if (retval)
|
||||||
|
clk_disable_unprepare(sport->clk_ipg);
|
||||||
|
|
||||||
|
imx_setup_ufcr(sport, 0);
|
||||||
|
|
||||||
|
spin_lock_irqsave(&sport->port.lock, flags);
|
||||||
|
|
||||||
|
temp = readl(sport->port.membase + UCR1);
|
||||||
|
if (is_imx1_uart(sport))
|
||||||
|
temp |= IMX1_UCR1_UARTCLKEN;
|
||||||
|
temp |= UCR1_UARTEN | UCR1_RRDYEN;
|
||||||
|
temp &= ~(UCR1_TXMPTYEN | UCR1_RTSDEN);
|
||||||
|
writel(temp, sport->port.membase + UCR1);
|
||||||
|
|
||||||
|
temp = readl(sport->port.membase + UCR2);
|
||||||
|
temp |= UCR2_RXEN;
|
||||||
|
writel(temp, sport->port.membase + UCR2);
|
||||||
|
|
||||||
|
spin_unlock_irqrestore(&sport->port.lock, flags);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int imx_poll_get_char(struct uart_port *port)
|
static int imx_poll_get_char(struct uart_port *port)
|
||||||
{
|
{
|
||||||
if (!(readl_relaxed(port->membase + USR2) & USR2_RDR))
|
if (!(readl_relaxed(port->membase + USR2) & USR2_RDR))
|
||||||
|
@ -1499,6 +1534,7 @@ static struct uart_ops imx_pops = {
|
||||||
.config_port = imx_config_port,
|
.config_port = imx_config_port,
|
||||||
.verify_port = imx_verify_port,
|
.verify_port = imx_verify_port,
|
||||||
#if defined(CONFIG_CONSOLE_POLL)
|
#if defined(CONFIG_CONSOLE_POLL)
|
||||||
|
.poll_init = imx_poll_init,
|
||||||
.poll_get_char = imx_poll_get_char,
|
.poll_get_char = imx_poll_get_char,
|
||||||
.poll_put_char = imx_poll_put_char,
|
.poll_put_char = imx_poll_put_char,
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue