Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
1
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
54a4644
Documentation
arch
alpha
arc
arm
boot
common
configs
crypto
include
kernel
kvm
lib
mach-at91
mach-bcm
mach-bcm2835
mach-clps711x
mach-cns3xxx
mach-davinci
mach-dove
mach-ebsa110
mach-ep93xx
mach-exynos
mach-footbridge
mach-gemini
mach-h720x
mach-highbank
mach-imx
devices
3ds_debugboard.c
3ds_debugboard.h
Kconfig
Makefile
Makefile.boot
avic.c
board-mx31lilly.h
board-mx31lite.h
board-mx31moboard.h
board-pcm038.h
clk-busy.c
clk-gate2.c
clk-imx1.c
clk-imx21.c
clk-imx25.c
clk-imx27.c
clk-imx31.c
clk-imx35.c
clk-imx51-imx53.c
clk-imx6q.c
clk-pfd.c
clk-pllv1.c
clk-pllv2.c
clk-pllv3.c
clk.c
clk.h
common.h
cpu-imx25.c
cpu-imx27.c
cpu-imx31.c
cpu-imx35.c
cpu-imx5.c
cpu.c
cpu_op-mx51.c
cpu_op-mx51.h
cpufreq.c
cpuidle-imx5.c
cpuidle-imx6q.c
cpuidle.h
crm-regs-imx5.h
crmregs-imx3.h
devices-imx1.h
devices-imx21.h
devices-imx25.h
devices-imx27.h
devices-imx31.h
devices-imx35.h
devices-imx51.h
ehci-imx25.c
ehci-imx27.c
ehci-imx31.c
ehci-imx35.c
ehci-imx5.c
epit.c
eukrea-baseboards.h
eukrea_mbimx27-baseboard.c
eukrea_mbimxsd25-baseboard.c
eukrea_mbimxsd35-baseboard.c
eukrea_mbimxsd51-baseboard.c
gpc.c
hardware.h
headsmp.S
hotplug.c
iim.h
imx25-dt.c
imx27-dt.c
imx31-dt.c
imx51-dt.c
iomux-imx31.c
iomux-mx1.h
iomux-mx21.h
iomux-mx25.h
iomux-mx27.h
iomux-mx2x.h
iomux-mx3.h
iomux-mx35.h
iomux-mx51.h
iomux-v1.c
iomux-v1.h
iomux-v3.c
iomux-v3.h
iram_alloc.c
irq-common.c
irq-common.h
mach-apf9328.c
mach-armadillo5x0.c
mach-bug.c
mach-cpuimx27.c
mach-cpuimx35.c
mach-cpuimx51sd.c
mach-eukrea_cpuimx25.c
mach-imx27_visstrim_m10.c
mach-imx27ipcam.c
mach-imx27lite.c
mach-imx53.c
mach-imx6q.c
mach-kzm_arm11_01.c
mach-mx1ads.c
mach-mx21ads.c
mach-mx25_3ds.c
mach-mx27_3ds.c
mach-mx27ads.c
mach-mx31_3ds.c
mach-mx31ads.c
mach-mx31lilly.c
mach-mx31lite.c
mach-mx31moboard.c
mach-mx35_3ds.c
mach-mx51_babbage.c
mach-mxt_td60.c
mach-pca100.c
mach-pcm037.c
mach-pcm037_eet.c
mach-pcm038.c
mach-pcm043.c
mach-qong.c
mach-scb9328.c
mach-vpr200.c
mm-imx1.c
mm-imx21.c
mm-imx25.c
mm-imx27.c
mm-imx3.c
mm-imx5.c
mmdc.c
mx1-camera-fiq-ksym.c
mx1-camera-fiq.S
mx1.h
mx21.h
mx25.h
mx27.h
mx2x.h
mx31.h
mx31lilly-db.c
mx31lite-db.c
mx31moboard-devboard.c
mx31moboard-marxbot.c
mx31moboard-smartbot.c
mx35.h
mx3x.h
mx51.h
mx53.h
mx6q.h
mxc.h
pcm037.h
pcm970-baseboard.c
platsmp.c
pm-imx27.c
pm-imx3.c
pm-imx5.c
pm-imx6q.c
src.c
ssi-fiq-ksym.c
ssi-fiq.S
system.c
time.c
tzic.c
ulpi.c
ulpi.h
mach-integrator
mach-iop13xx
mach-iop32x
mach-iop33x
mach-ixp4xx
mach-kirkwood
mach-ks8695
mach-l7200
mach-lpc32xx
mach-mmp
mach-msm
mach-mv78xx0
mach-mvebu
mach-mxs
mach-netx
mach-nomadik
mach-omap1
mach-omap2
mach-orion5x
mach-picoxcell
mach-prima2
mach-pxa
mach-realview
mach-rpc
mach-s3c24xx
mach-s3c64xx
mach-s5p64x0
mach-s5pc100
mach-s5pv210
mach-sa1100
mach-shark
mach-shmobile
mach-socfpga
mach-spear13xx
mach-spear3xx
mach-spear6xx
mach-sunxi
mach-tegra
mach-u300
mach-ux500
mach-versatile
mach-vexpress
mach-virt
mach-vt8500
mach-w90x900
mach-zynq
mm
net
nwfpe
oprofile
plat-iop
plat-omap
plat-orion
plat-pxa
plat-samsung
plat-spear
plat-versatile
tools
vfp
xen
Kconfig
Kconfig-nommu
Kconfig.debug
Makefile
arm64
avr32
blackfin
c6x
cris
frv
h8300
hexagon
ia64
m32r
m68k
metag
microblaze
mips
mn10300
openrisc
parisc
powerpc
s390
score
sh
sparc
tile
um
unicore32
x86
xtensa
.gitignore
Kconfig
block
crypto
drivers
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
REPORTING-BUGS
Breadcrumbs
linux
/
arch
/
arm
/
mach-imx
/
pm-imx5.c
Copy path
Blame
Blame
Latest commit
History
History
182 lines (156 loc) · 4.49 KB
Breadcrumbs
linux
/
arch
/
arm
/
mach-imx
/
pm-imx5.c
Top
File metadata and controls
Code
Blame
182 lines (156 loc) · 4.49 KB
Raw
/* * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved. * * The code contained herein is licensed under the GNU General Public * License. You may obtain a copy of the GNU General Public License * Version 2 or later at the following locations: * * http://www.opensource.org/licenses/gpl-license.html * http://www.gnu.org/copyleft/gpl.html */ #include <linux/suspend.h> #include <linux/clk.h> #include <linux/io.h> #include <linux/err.h> #include <linux/export.h> #include <asm/cacheflush.h> #include <asm/system_misc.h> #include <asm/tlbflush.h> #include "common.h" #include "cpuidle.h" #include "crm-regs-imx5.h" #include "hardware.h" /* * The WAIT_UNCLOCKED_POWER_OFF state only requires <= 500ns to exit. * This is also the lowest power state possible without affecting * non-cpu parts of the system. For these reasons, imx5 should default * to always using this state for cpu idling. The PM_SUSPEND_STANDBY also * uses this state and needs to take no action when registers remain confgiured * for this state. */ #define IMX5_DEFAULT_CPU_IDLE_STATE WAIT_UNCLOCKED_POWER_OFF /* * set cpu low power mode before WFI instruction. This function is called * mx5 because it can be used for mx51, and mx53. */ static void mx5_cpu_lp_set(enum mxc_cpu_pwr_mode mode) { u32 plat_lpc, arm_srpgcr, ccm_clpcr; u32 empgc0, empgc1; int stop_mode = 0; /* always allow platform to issue a deep sleep mode request */ plat_lpc = __raw_readl(MXC_CORTEXA8_PLAT_LPC) & ~(MXC_CORTEXA8_PLAT_LPC_DSM); ccm_clpcr = __raw_readl(MXC_CCM_CLPCR) & ~(MXC_CCM_CLPCR_LPM_MASK); arm_srpgcr = __raw_readl(MXC_SRPG_ARM_SRPGCR) & ~(MXC_SRPGCR_PCR); empgc0 = __raw_readl(MXC_SRPG_EMPGC0_SRPGCR) & ~(MXC_SRPGCR_PCR); empgc1 = __raw_readl(MXC_SRPG_EMPGC1_SRPGCR) & ~(MXC_SRPGCR_PCR); switch (mode) { case WAIT_CLOCKED: break; case WAIT_UNCLOCKED: ccm_clpcr |= 0x1 << MXC_CCM_CLPCR_LPM_OFFSET; break; case WAIT_UNCLOCKED_POWER_OFF: case STOP_POWER_OFF: plat_lpc |= MXC_CORTEXA8_PLAT_LPC_DSM | MXC_CORTEXA8_PLAT_LPC_DBG_DSM; if (mode == WAIT_UNCLOCKED_POWER_OFF) { ccm_clpcr |= 0x1 << MXC_CCM_CLPCR_LPM_OFFSET; ccm_clpcr &= ~MXC_CCM_CLPCR_VSTBY; ccm_clpcr &= ~MXC_CCM_CLPCR_SBYOS; stop_mode = 0; } else { ccm_clpcr |= 0x2 << MXC_CCM_CLPCR_LPM_OFFSET; ccm_clpcr |= 0x3 << MXC_CCM_CLPCR_STBY_COUNT_OFFSET; ccm_clpcr |= MXC_CCM_CLPCR_VSTBY; ccm_clpcr |= MXC_CCM_CLPCR_SBYOS; stop_mode = 1; } arm_srpgcr |= MXC_SRPGCR_PCR; break; case STOP_POWER_ON: ccm_clpcr |= 0x2 << MXC_CCM_CLPCR_LPM_OFFSET; break; default: printk(KERN_WARNING "UNKNOWN cpu power mode: %d\n", mode); return; } __raw_writel(plat_lpc, MXC_CORTEXA8_PLAT_LPC); __raw_writel(ccm_clpcr, MXC_CCM_CLPCR); __raw_writel(arm_srpgcr, MXC_SRPG_ARM_SRPGCR); __raw_writel(arm_srpgcr, MXC_SRPG_NEON_SRPGCR); if (stop_mode) { empgc0 |= MXC_SRPGCR_PCR; empgc1 |= MXC_SRPGCR_PCR; __raw_writel(empgc0, MXC_SRPG_EMPGC0_SRPGCR); __raw_writel(empgc1, MXC_SRPG_EMPGC1_SRPGCR); } } static int mx5_suspend_enter(suspend_state_t state) { switch (state) { case PM_SUSPEND_MEM: mx5_cpu_lp_set(STOP_POWER_OFF); break; case PM_SUSPEND_STANDBY: /* DEFAULT_IDLE_STATE already configured */ break; default: return -EINVAL; } if (state == PM_SUSPEND_MEM) { local_flush_tlb_all(); flush_cache_all(); /*clear the EMPGC0/1 bits */ __raw_writel(0, MXC_SRPG_EMPGC0_SRPGCR); __raw_writel(0, MXC_SRPG_EMPGC1_SRPGCR); } cpu_do_idle(); /* return registers to default idle state */ mx5_cpu_lp_set(IMX5_DEFAULT_CPU_IDLE_STATE); return 0; } static int mx5_pm_valid(suspend_state_t state) { return (state > PM_SUSPEND_ON && state <= PM_SUSPEND_MAX); } static const struct platform_suspend_ops mx5_suspend_ops = { .valid = mx5_pm_valid, .enter = mx5_suspend_enter, }; static inline int imx5_cpu_do_idle(void) { int ret = tzic_enable_wake(); if (likely(!ret)) cpu_do_idle(); return ret; } static void imx5_pm_idle(void) { imx5_cpu_do_idle(); } static int __init imx5_pm_common_init(void) { int ret; struct clk *gpc_dvfs_clk = clk_get(NULL, "gpc_dvfs"); if (IS_ERR(gpc_dvfs_clk)) return PTR_ERR(gpc_dvfs_clk); ret = clk_prepare_enable(gpc_dvfs_clk); if (ret) return ret; arm_pm_idle = imx5_pm_idle; /* Set the registers to the default cpu idle state. */ mx5_cpu_lp_set(IMX5_DEFAULT_CPU_IDLE_STATE); return imx5_cpuidle_init(); } void __init imx51_pm_init(void) { int ret = imx5_pm_common_init(); if (!ret) suspend_set_ops(&mx5_suspend_ops); } void __init imx53_pm_init(void) { imx5_pm_common_init(); }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
You can’t perform that action at this time.