Exemplo n.º 1
0
static void
restore_core_regs(void)
{
    extern void restore_au1xxx_intctl(void);
    extern void wakeup_counter0_adjust(void);

    au_writel(sleep_aux_pll_cntrl, SYS_AUXPLL);
    au_sync();
    au_writel(sleep_cpu_pll_cntrl, SYS_CPUPLL);
    au_sync();
    au_writel(sleep_pin_function, SYS_PINFUNC);
    au_sync();

    /* Restore the static memory controller configuration.
    */
    au_writel(sleep_static_memctlr[0][0], MEM_STCFG0);
    au_writel(sleep_static_memctlr[0][1], MEM_STTIME0);
    au_writel(sleep_static_memctlr[0][2], MEM_STADDR0);
    au_writel(sleep_static_memctlr[1][0], MEM_STCFG1);
    au_writel(sleep_static_memctlr[1][1], MEM_STTIME1);
    au_writel(sleep_static_memctlr[1][2], MEM_STADDR1);
    au_writel(sleep_static_memctlr[2][0], MEM_STCFG2);
    au_writel(sleep_static_memctlr[2][1], MEM_STTIME2);
    au_writel(sleep_static_memctlr[2][2], MEM_STADDR2);
    au_writel(sleep_static_memctlr[3][0], MEM_STCFG3);
    au_writel(sleep_static_memctlr[3][1], MEM_STTIME3);
    au_writel(sleep_static_memctlr[3][2], MEM_STADDR3);

    /* Enable the UART if it was enabled before sleep.
     * I guess I should define module control bits........
     */
    if (sleep_uart0_enable & 0x02) {
        au_writel(0, UART0_ADDR + UART_MOD_CNTRL);
        au_sync();
        au_writel(1, UART0_ADDR + UART_MOD_CNTRL);
        au_sync();
        au_writel(3, UART0_ADDR + UART_MOD_CNTRL);
        au_sync();
        au_writel(sleep_uart0_inten, UART0_ADDR + UART_IER);
        au_sync();
        au_writel(sleep_uart0_fifoctl, UART0_ADDR + UART_FCR);
        au_sync();
        au_writel(sleep_uart0_linectl, UART0_ADDR + UART_LCR);
        au_sync();
        au_writel(sleep_uart0_clkdiv, UART0_ADDR + UART_CLK);
        au_sync();
    }

    restore_au1xxx_intctl();
    wakeup_counter0_adjust();
}
Exemplo n.º 2
0
static void restore_core_regs(void)
{
	/* restore clock configuration.  Writing CPUPLL last will
	 * stall a bit and stabilize other clocks (unless this is
	 * one of those Au1000 with a write-only PLL, where we dont
	 * have a valid value)
	 */
	au_writel(sleep_sys_clocks[0], SYS_FREQCTRL0);
	au_writel(sleep_sys_clocks[1], SYS_FREQCTRL1);
	au_writel(sleep_sys_clocks[2], SYS_CLKSRC);
	au_writel(sleep_sys_clocks[4], SYS_AUXPLL);
	if (!au1xxx_cpu_has_pll_wo())
		au_writel(sleep_sys_clocks[3], SYS_CPUPLL);
	au_sync();

	au_writel(sleep_sys_pinfunc, SYS_PINFUNC);
	au_sync();

#ifndef CONFIG_SOC_AU1200
	au_writel(sleep_usb[0], USB_HOST_CONFIG);
	au_writel(sleep_usb[1], USBD_ENABLE);
	au_sync();
#else
	/* enable accces to OTG memory */
	au_writel(au_readl(USB_MSR_BASE + 4) | (1 << 6), USB_MSR_BASE + 4);
	au_sync();

	/* restore OTG caps and port mux. */
	au_writel(sleep_usb[0], 0xb4020020 + 0);	/* OTG_CAP */
	au_sync();
	au_writel(sleep_usb[1], 0xb4020020 + 4);	/* OTG_MUX */
	au_sync();
#endif

	/* Restore the static memory controller configuration. */
	au_writel(sleep_static_memctlr[0][0], MEM_STCFG0);
	au_writel(sleep_static_memctlr[0][1], MEM_STTIME0);
	au_writel(sleep_static_memctlr[0][2], MEM_STADDR0);
	au_writel(sleep_static_memctlr[1][0], MEM_STCFG1);
	au_writel(sleep_static_memctlr[1][1], MEM_STTIME1);
	au_writel(sleep_static_memctlr[1][2], MEM_STADDR1);
	au_writel(sleep_static_memctlr[2][0], MEM_STCFG2);
	au_writel(sleep_static_memctlr[2][1], MEM_STTIME2);
	au_writel(sleep_static_memctlr[2][2], MEM_STADDR2);
	au_writel(sleep_static_memctlr[3][0], MEM_STCFG3);
	au_writel(sleep_static_memctlr[3][1], MEM_STTIME3);
	au_writel(sleep_static_memctlr[3][2], MEM_STADDR3);

	/*
	 * Enable the UART if it was enabled before sleep.
	 * I guess I should define module control bits........
	 */
	if (sleep_uart0_enable & 0x02) {
		au_writel(0, UART0_ADDR + UART_MOD_CNTRL); au_sync();
		au_writel(1, UART0_ADDR + UART_MOD_CNTRL); au_sync();
		au_writel(3, UART0_ADDR + UART_MOD_CNTRL); au_sync();
		au_writel(sleep_uart0_inten, UART0_ADDR + UART_IER); au_sync();
		au_writel(sleep_uart0_fifoctl, UART0_ADDR + UART_FCR); au_sync();
		au_writel(sleep_uart0_linectl, UART0_ADDR + UART_LCR); au_sync();
		au_writel(sleep_uart0_clkdiv, UART0_ADDR + UART_CLK); au_sync();
	}

	restore_au1xxx_intctl();

#if defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200)
	au1xxx_dbdma_resume();
#endif
}