Skip to content

Commit c8f95ec

Browse files
Dinh Nguyendinguyen702
authored andcommitted
FogBugz #184646: Turn on all peripheral clocks for a system reboot
When doing a software reboot, all peripheral clocks must get turned on for the L3 interconnect to work. This code is needed when doing a "reboot" from user-space and a peripheral clock as been gated off. Why would a peripheral clock get gated? An example use case would be a .ko that gets insmod and rmmod during runtime. The insmod would turn on the IP's clock, and the rmmod would turn off the IP's clock. Doing a "reboot" would cause the system to hang. Signed-off-by: Dinh Nguyen <[email protected]> Conflicts: arch/arm/mach-socfpga/core.h
1 parent 5e742bd commit c8f95ec

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

arch/arm/mach-socfpga/core.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,7 @@ extern unsigned long socfpga_cpu1start_addr;
3939

4040
#define SOCFPGA_SCU_VIRT_BASE 0xfee00000
4141

42+
/* Clock manager defines */
43+
#define SOCFPGA_ENABLE_PLL_REG 0xA0
44+
4245
#endif

arch/arm/mach-socfpga/socfpga.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ void __iomem *sys_manager_base_addr;
2020
void __iomem *rst_manager_base_addr;
2121
void __iomem *sdr_ctl_base_addr;
2222
unsigned long socfpga_cpu1start_addr;
23+
void __iomem *clkmgr_base_addr;
2324

2425
static void __init socfpga_sysmgr_init(void)
2526
{
@@ -40,6 +41,10 @@ static void __init socfpga_sysmgr_init(void)
4041
np = of_find_compatible_node(NULL, NULL, "altr,rst-mgr");
4142
rst_manager_base_addr = of_iomap(np, 0);
4243

44+
np = of_find_compatible_node(NULL, NULL, "altr,clk-mgr");
45+
clkmgr_base_addr = of_iomap(np, 0);
46+
WARN_ON(!clkmgr_base_addr);
47+
4348
np = of_find_compatible_node(NULL, NULL, "altr,sdr-ctl");
4449
sdr_ctl_base_addr = of_iomap(np, 0);
4550
}
@@ -71,6 +76,9 @@ static void socfpga_cyclone5_restart(enum reboot_mode mode, const char *cmd)
7176
{
7277
u32 temp;
7378

79+
/* Turn on all periph PLL clocks */
80+
writel(0xffff, clkmgr_base_addr + SOCFPGA_ENABLE_PLL_REG);
81+
7482
temp = readl(rst_manager_base_addr + SOCFPGA_RSTMGR_CTRL);
7583

7684
if (mode == REBOOT_HARD)

0 commit comments

Comments
 (0)