From 7d172bfefb72a8dae56beff326299c5e21f6f6db Mon Sep 17 00:00:00 2001 From: Manuel Lauss Date: Sat, 25 Sep 2010 15:13:46 +0200 Subject: Alchemy: Add UART PM methods. Custom UART PM hook for Alchemy chips: do standard UART pm and additionally en/disable uart block clocks as needed. This allows to get rid of a debug port PM hack in the Alchemy pm code. Tested on Db1200. Signed-off-by: Manuel Lauss Cc: Alan Cox Signed-off-by: Greg Kroah-Hartman --- arch/mips/alchemy/common/platform.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'arch/mips/alchemy/common/platform.c') diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c index 1dc55ee2681b..3691630931d6 100644 --- a/arch/mips/alchemy/common/platform.c +++ b/arch/mips/alchemy/common/platform.c @@ -24,6 +24,33 @@ #include +static void alchemy_8250_pm(struct uart_port *port, unsigned int state, + unsigned int old_state) +{ + switch (state) { + case 0: + if ((__raw_readl(port->membase + UART_MOD_CNTRL) & 3) != 3) { + /* power-on sequence as suggested in the databooks */ + __raw_writel(0, port->membase + UART_MOD_CNTRL); + wmb(); + __raw_writel(1, port->membase + UART_MOD_CNTRL); + wmb(); + } + __raw_writel(3, port->membase + UART_MOD_CNTRL); /* full on */ + wmb(); + serial8250_do_pm(port, state, old_state); + break; + case 3: /* power off */ + serial8250_do_pm(port, state, old_state); + __raw_writel(0, port->membase + UART_MOD_CNTRL); + wmb(); + break; + default: + serial8250_do_pm(port, state, old_state); + break; + } +} + #define PORT(_base, _irq) \ { \ .mapbase = _base, \ @@ -33,6 +60,7 @@ .flags = UPF_SKIP_TEST | UPF_IOREMAP | \ UPF_FIXED_TYPE, \ .type = PORT_16550A, \ + .pm = alchemy_8250_pm, \ } static struct plat_serial8250_port au1x00_uart_data[] = { -- cgit v1.2.3-59-g8ed1b