forked from jcmvbkbc/linux-xtensa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ARM: OMAP2+: PRCM: create SoC-specific chip restart functions
Split omap_prcm_restart() from mach-omap2/prcm.c into SoC-specific variants. These functions need to be able to save the reboot reason into the scratchpad RAM. This implies a dependency on both the PRM and SCM IP blocks, so they've been moved into their own file. This will eventually call functions in the PRM and SCM drivers, once those are created. Vaibhav Hiremath <hvaibhav@ti.com> identified an unused prototype in the first version of this patch - now removed. Tony Lindgren <tony@atomide.com> noted a compile problem with some RMK Kconfigs; resolved in this patch. Signed-off-by: Paul Walmsley <paul@pwsan.com> Cc: Vaibhav Hiremath <hvaibhav@ti.com> Tested-by: Vaibhav Hiremath <hvaibhav@ti.com> Cc: Tony Lindgren <tony@atomide.com>
- Loading branch information
Paul Walmsley
committed
Nov 8, 2012
1 parent
baa689b
commit 2f334a3
Showing
5 changed files
with
147 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* omap2-restart.c - code common to all OMAP2xxx machines. | ||
* | ||
* Copyright (C) 2012 Texas Instruments | ||
* Paul Walmsley | ||
* | ||
* 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/kernel.h> | ||
#include <linux/init.h> | ||
#include <linux/clk.h> | ||
#include <linux/io.h> | ||
|
||
#include "common.h" | ||
#include "prm2xxx.h" | ||
|
||
/* | ||
* reset_virt_prcm_set_ck, reset_sys_ck: pointers to the virt_prcm_set | ||
* clock and the sys_ck. Used during the reset process | ||
*/ | ||
static struct clk *reset_virt_prcm_set_ck, *reset_sys_ck; | ||
|
||
/* Reboot handling */ | ||
|
||
/** | ||
* omap2xxx_restart - Set DPLL to bypass mode for reboot to work | ||
* | ||
* Set the DPLL to bypass so that reboot completes successfully. No | ||
* return value. | ||
*/ | ||
void omap2xxx_restart(char mode, const char *cmd) | ||
{ | ||
u32 rate; | ||
|
||
rate = clk_get_rate(reset_sys_ck); | ||
clk_set_rate(reset_virt_prcm_set_ck, rate); | ||
|
||
/* XXX Should save the cmd argument for use after the reboot */ | ||
|
||
omap2xxx_prm_dpll_reset(); /* never returns */ | ||
while (1); | ||
} | ||
|
||
/** | ||
* omap2xxx_common_look_up_clks_for_reset - look up clocks needed for restart | ||
* | ||
* Some clocks need to be looked up in advance for the SoC restart | ||
* operation to work - see omap2xxx_restart(). Returns -EINVAL upon | ||
* error or 0 upon success. | ||
*/ | ||
static int __init omap2xxx_common_look_up_clks_for_reset(void) | ||
{ | ||
reset_virt_prcm_set_ck = clk_get(NULL, "virt_prcm_set"); | ||
if (IS_ERR(reset_virt_prcm_set_ck)) | ||
return -EINVAL; | ||
|
||
reset_sys_ck = clk_get(NULL, "sys_ck"); | ||
if (IS_ERR(reset_sys_ck)) | ||
return -EINVAL; | ||
|
||
return 0; | ||
} | ||
core_initcall(omap2xxx_common_look_up_clks_for_reset); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* omap3-restart.c - Code common to all OMAP3xxx machines. | ||
* | ||
* Copyright (C) 2009, 2012 Texas Instruments | ||
* Copyright (C) 2010 Nokia Corporation | ||
* Tony Lindgren <tony@atomide.com> | ||
* Santosh Shilimkar <santosh.shilimkar@ti.com> | ||
* | ||
* 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/kernel.h> | ||
#include <linux/init.h> | ||
|
||
#include "iomap.h" | ||
#include "common.h" | ||
#include "control.h" | ||
#include "prm3xxx.h" | ||
|
||
/* Global address base setup code */ | ||
|
||
/** | ||
* omap3xxx_restart - trigger a software restart of the SoC | ||
* @mode: the "reboot mode", see arch/arm/kernel/{setup,process}.c | ||
* @cmd: passed from the userspace program rebooting the system (if provided) | ||
* | ||
* Resets the SoC. For @cmd, see the 'reboot' syscall in | ||
* kernel/sys.c. No return value. | ||
*/ | ||
void omap3xxx_restart(char mode, const char *cmd) | ||
{ | ||
omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0)); | ||
omap3xxx_prm_dpll3_reset(); /* never returns */ | ||
while (1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters