blob: b12f423b8595ecd7badd89eaeb2ba177a4f01d08 [file] [log] [blame]
Tony Lindgrenb824efa2006-04-02 17:46:20 +01001/*
2 * linux/arch/arm/mach-omap2/prcm.c
3 *
4 * OMAP 24xx Power Reset and Clock Management (PRCM) functions
5 *
6 * Copyright (C) 2005 Nokia Corporation
7 *
8 * Written by Tony Lindgren <tony.lindgren@nokia.com>
9 *
10 * Some pieces of code Copyright (C) 2005 Texas Instruments, Inc.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 */
Tony Lindgrenb824efa2006-04-02 17:46:20 +010016#include <linux/module.h>
17#include <linux/init.h>
18#include <linux/clk.h>
19
Paul Walmsley44595982008-03-18 10:04:51 +020020#include <asm/io.h>
21
22#include "prm.h"
23#include "prm-regbits-24xx.h"
Tony Lindgrenb824efa2006-04-02 17:46:20 +010024
Tony Lindgrenae78dcf2006-09-25 12:41:20 +030025extern void omap2_clk_prepare_for_reboot(void);
26
Tony Lindgrenb824efa2006-04-02 17:46:20 +010027u32 omap_prcm_get_reset_sources(void)
28{
Paul Walmsley44595982008-03-18 10:04:51 +020029 return prm_read_mod_reg(WKUP_MOD, RM_RSTST) & 0x7f;
Tony Lindgrenb824efa2006-04-02 17:46:20 +010030}
31EXPORT_SYMBOL(omap_prcm_get_reset_sources);
32
33/* Resets clock rates and reboots the system. Only called from system.h */
34void omap_prcm_arch_reset(char mode)
35{
Paul Walmsley44595982008-03-18 10:04:51 +020036 u32 wkup;
Tony Lindgrenae78dcf2006-09-25 12:41:20 +030037 omap2_clk_prepare_for_reboot();
Paul Walmsley44595982008-03-18 10:04:51 +020038
39 if (cpu_is_omap24xx()) {
40 wkup = prm_read_mod_reg(WKUP_MOD, RM_RSTCTRL) | OMAP_RST_DPLL3;
41 prm_write_mod_reg(wkup, WKUP_MOD, RM_RSTCTRL);
42 }
Tony Lindgrenb824efa2006-04-02 17:46:20 +010043}