diff options
| author | Manuel Lauss <manuel.lauss@googlemail.com> | 2010-09-25 09:13:46 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-10-22 13:20:09 -0400 |
| commit | 7d172bfefb72a8dae56beff326299c5e21f6f6db (patch) | |
| tree | 73cddae39798d6f3878b371a50db72c1c5d04b8a | |
| parent | c161afe9759ddcc174d08e7c4f683d08ac9ba86f (diff) | |
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 <manuel.lauss@googlemail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
| -rw-r--r-- | arch/mips/alchemy/common/platform.c | 28 | ||||
| -rw-r--r-- | arch/mips/alchemy/common/power.c | 35 |
2 files changed, 28 insertions, 35 deletions
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 @@ | |||
| 24 | 24 | ||
| 25 | #include <prom.h> | 25 | #include <prom.h> |
| 26 | 26 | ||
| 27 | static void alchemy_8250_pm(struct uart_port *port, unsigned int state, | ||
| 28 | unsigned int old_state) | ||
| 29 | { | ||
| 30 | switch (state) { | ||
| 31 | case 0: | ||
| 32 | if ((__raw_readl(port->membase + UART_MOD_CNTRL) & 3) != 3) { | ||
| 33 | /* power-on sequence as suggested in the databooks */ | ||
| 34 | __raw_writel(0, port->membase + UART_MOD_CNTRL); | ||
| 35 | wmb(); | ||
| 36 | __raw_writel(1, port->membase + UART_MOD_CNTRL); | ||
| 37 | wmb(); | ||
| 38 | } | ||
| 39 | __raw_writel(3, port->membase + UART_MOD_CNTRL); /* full on */ | ||
| 40 | wmb(); | ||
| 41 | serial8250_do_pm(port, state, old_state); | ||
| 42 | break; | ||
| 43 | case 3: /* power off */ | ||
| 44 | serial8250_do_pm(port, state, old_state); | ||
| 45 | __raw_writel(0, port->membase + UART_MOD_CNTRL); | ||
| 46 | wmb(); | ||
| 47 | break; | ||
| 48 | default: | ||
| 49 | serial8250_do_pm(port, state, old_state); | ||
| 50 | break; | ||
| 51 | } | ||
| 52 | } | ||
| 53 | |||
| 27 | #define PORT(_base, _irq) \ | 54 | #define PORT(_base, _irq) \ |
| 28 | { \ | 55 | { \ |
| 29 | .mapbase = _base, \ | 56 | .mapbase = _base, \ |
| @@ -33,6 +60,7 @@ | |||
| 33 | .flags = UPF_SKIP_TEST | UPF_IOREMAP | \ | 60 | .flags = UPF_SKIP_TEST | UPF_IOREMAP | \ |
| 34 | UPF_FIXED_TYPE, \ | 61 | UPF_FIXED_TYPE, \ |
| 35 | .type = PORT_16550A, \ | 62 | .type = PORT_16550A, \ |
| 63 | .pm = alchemy_8250_pm, \ | ||
| 36 | } | 64 | } |
| 37 | 65 | ||
| 38 | static struct plat_serial8250_port au1x00_uart_data[] = { | 66 | static struct plat_serial8250_port au1x00_uart_data[] = { |
diff --git a/arch/mips/alchemy/common/power.c b/arch/mips/alchemy/common/power.c index 5ef06a164a82..e5916a516e58 100644 --- a/arch/mips/alchemy/common/power.c +++ b/arch/mips/alchemy/common/power.c | |||
| @@ -49,11 +49,6 @@ | |||
| 49 | * We only have to save/restore registers that aren't otherwise | 49 | * We only have to save/restore registers that aren't otherwise |
| 50 | * done as part of a driver pm_* function. | 50 | * done as part of a driver pm_* function. |
| 51 | */ | 51 | */ |
| 52 | static unsigned int sleep_uart0_inten; | ||
| 53 | static unsigned int sleep_uart0_fifoctl; | ||
| 54 | static unsigned int sleep_uart0_linectl; | ||
| 55 | static unsigned int sleep_uart0_clkdiv; | ||
| 56 | static unsigned int sleep_uart0_enable; | ||
| 57 | static unsigned int sleep_usb[2]; | 52 | static unsigned int sleep_usb[2]; |
| 58 | static unsigned int sleep_sys_clocks[5]; | 53 | static unsigned int sleep_sys_clocks[5]; |
| 59 | static unsigned int sleep_sys_pinfunc; | 54 | static unsigned int sleep_sys_pinfunc; |
| @@ -62,22 +57,6 @@ static unsigned int sleep_static_memctlr[4][3]; | |||
| 62 | 57 | ||
| 63 | static void save_core_regs(void) | 58 | static void save_core_regs(void) |
| 64 | { | 59 | { |
| 65 | extern void save_au1xxx_intctl(void); | ||
| 66 | extern void pm_eth0_shutdown(void); | ||
| 67 | |||
| 68 | /* | ||
| 69 | * Do the serial ports.....these really should be a pm_* | ||
| 70 | * registered function by the driver......but of course the | ||
| 71 | * standard serial driver doesn't understand our Au1xxx | ||
| 72 | * unique registers. | ||
| 73 | */ | ||
| 74 | sleep_uart0_inten = au_readl(UART0_ADDR + UART_IER); | ||
| 75 | sleep_uart0_fifoctl = au_readl(UART0_ADDR + UART_FCR); | ||
| 76 | sleep_uart0_linectl = au_readl(UART0_ADDR + UART_LCR); | ||
| 77 | sleep_uart0_clkdiv = au_readl(UART0_ADDR + UART_CLK); | ||
| 78 | sleep_uart0_enable = au_readl(UART0_ADDR + UART_MOD_CNTRL); | ||
| 79 | au_sync(); | ||
| 80 | |||
| 81 | #ifndef CONFIG_SOC_AU1200 | 60 | #ifndef CONFIG_SOC_AU1200 |
| 82 | /* Shutdown USB host/device. */ | 61 | /* Shutdown USB host/device. */ |
| 83 | sleep_usb[0] = au_readl(USB_HOST_CONFIG); | 62 | sleep_usb[0] = au_readl(USB_HOST_CONFIG); |
| @@ -175,20 +154,6 @@ static void restore_core_regs(void) | |||
| 175 | au_writel(sleep_static_memctlr[3][0], MEM_STCFG3); | 154 | au_writel(sleep_static_memctlr[3][0], MEM_STCFG3); |
| 176 | au_writel(sleep_static_memctlr[3][1], MEM_STTIME3); | 155 | au_writel(sleep_static_memctlr[3][1], MEM_STTIME3); |
| 177 | au_writel(sleep_static_memctlr[3][2], MEM_STADDR3); | 156 | au_writel(sleep_static_memctlr[3][2], MEM_STADDR3); |
| 178 | |||
| 179 | /* | ||
| 180 | * Enable the UART if it was enabled before sleep. | ||
| 181 | * I guess I should define module control bits........ | ||
| 182 | */ | ||
| 183 | if (sleep_uart0_enable & 0x02) { | ||
| 184 | au_writel(0, UART0_ADDR + UART_MOD_CNTRL); au_sync(); | ||
| 185 | au_writel(1, UART0_ADDR + UART_MOD_CNTRL); au_sync(); | ||
| 186 | au_writel(3, UART0_ADDR + UART_MOD_CNTRL); au_sync(); | ||
| 187 | au_writel(sleep_uart0_inten, UART0_ADDR + UART_IER); au_sync(); | ||
| 188 | au_writel(sleep_uart0_fifoctl, UART0_ADDR + UART_FCR); au_sync(); | ||
| 189 | au_writel(sleep_uart0_linectl, UART0_ADDR + UART_LCR); au_sync(); | ||
| 190 | au_writel(sleep_uart0_clkdiv, UART0_ADDR + UART_CLK); au_sync(); | ||
| 191 | } | ||
| 192 | } | 157 | } |
| 193 | 158 | ||
| 194 | void au_sleep(void) | 159 | void au_sleep(void) |
