prcm.c 1.22 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/*
 * linux/arch/arm/mach-omap2/prcm.c
 *
 * OMAP 24xx Power Reset and Clock Management (PRCM) functions
 *
 * Copyright (C) 2005 Nokia Corporation
 *
 * Written by Tony Lindgren <tony.lindgren@nokia.com>
 *
 * Some pieces of code Copyright (C) 2005 Texas Instruments, Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */
#include <linux/module.h>
#include <linux/init.h>
18
#include <linux/clk.h>
19

20
#include "prm.h"
21
#include "prm-regbits-24xx.h"
22

23 24
extern void omap2_clk_prepare_for_reboot(void);

25 26
u32 omap_prcm_get_reset_sources(void)
{
27
	return prm_read_mod_reg(WKUP_MOD, RM_RSTST) & 0x7f;
28 29 30 31 32 33
}
EXPORT_SYMBOL(omap_prcm_get_reset_sources);

/* Resets clock rates and reboots the system. Only called from system.h */
void omap_prcm_arch_reset(char mode)
{
34
	u32 wkup;
35
	omap2_clk_prepare_for_reboot();
36 37 38 39 40 41 42 43 44

	if (cpu_is_omap24xx()) {
		wkup = prm_read_mod_reg(WKUP_MOD, RM_RSTCTRL) | OMAP_RST_DPLL3;
		prm_write_mod_reg(wkup, WKUP_MOD, RM_RSTCTRL);
	} else if (cpu_is_omap34xx()) {
		wkup = prm_read_mod_reg(OMAP3430_GR_MOD, RM_RSTCTRL)
							| OMAP_RST_DPLL3;
		prm_write_mod_reg(wkup, OMAP3430_GR_MOD, RM_RSTCTRL);
	}
45
}