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
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
0030edf
Documentation
arch
alpha
arc
arm
boot
common
configs
crypto
firmware
include
kernel
kvm
lib
mach-alpine
mach-asm9260
mach-at91
mach-axxia
mach-bcm
mach-berlin
mach-clps711x
mach-cns3xxx
mach-davinci
mach-digicolor
mach-dove
mach-ebsa110
mach-efm32
mach-ep93xx
mach-exynos
mach-footbridge
mach-gemini
mach-highbank
mach-hisi
mach-imx
mach-integrator
mach-iop13xx
mach-iop32x
mach-iop33x
mach-ixp4xx
mach-keystone
mach-ks8695
mach-lpc18xx
mach-lpc32xx
mach-mediatek
mach-meson
mach-mmp
mach-moxart
mach-mv78xx0
mach-mvebu
mach-mxs
mach-netx
mach-nomadik
mach-nspire
mach-omap1
mach-omap2
mach-orion5x
mach-picoxcell
mach-prima2
mach-pxa
mach-qcom
mach-realview
mach-rockchip
mach-rpc
mach-s3c24xx
mach-s3c64xx
mach-s5pv210
mach-sa1100
mach-shmobile
mach-socfpga
Kconfig
Makefile
core.h
headsmp.S
platsmp.c
pm.c
self-refresh.S
socfpga.c
mach-spear
mach-sti
mach-stm32
mach-sunxi
mach-tegra
mach-u300
mach-uniphier
mach-ux500
mach-versatile
mach-vexpress
mach-vt8500
mach-w90x900
mach-zx
mach-zynq
mm
net
nwfpe
oprofile
plat-iop
plat-omap
plat-orion
plat-pxa
plat-samsung
plat-versatile
probes
tools
vdso
vfp
xen
Kconfig
Kconfig-nommu
Kconfig.debug
Makefile
arm64
avr32
blackfin
c6x
cris
frv
h8300
hexagon
ia64
m32r
m68k
metag
microblaze
mips
mn10300
nios2
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-socfpga
/
pm.c
Blame
Blame
Latest commit
History
History
149 lines (125 loc) · 3.58 KB
Breadcrumbs
linux
/
arch
/
arm
/
mach-socfpga
/
pm.c
Top
File metadata and controls
Code
Blame
149 lines (125 loc) · 3.58 KB
Raw
/* * arch/arm/mach-socfpga/pm.c * * Copyright (C) 2014-2015 Altera Corporation. All rights reserved. * * with code from pm-imx6.c * Copyright 2011-2014 Freescale Semiconductor, Inc. * Copyright 2011 Linaro Ltd. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program. If not, see <http://www.gnu.org/licenses/>. */ #include <linux/bitops.h> #include <linux/genalloc.h> #include <linux/init.h> #include <linux/io.h> #include <linux/of_platform.h> #include <linux/suspend.h> #include <asm/suspend.h> #include <asm/fncpy.h> #include "core.h" /* Pointer to function copied to ocram */ static u32 (*socfpga_sdram_self_refresh_in_ocram)(u32 sdr_base); static int socfpga_setup_ocram_self_refresh(void) { struct platform_device *pdev; phys_addr_t ocram_pbase; struct device_node *np; struct gen_pool *ocram_pool; unsigned long ocram_base; void __iomem *suspend_ocram_base; int ret = 0; np = of_find_compatible_node(NULL, NULL, "mmio-sram"); if (!np) { pr_err("%s: Unable to find mmio-sram in dtb\n", __func__); return -ENODEV; } pdev = of_find_device_by_node(np); if (!pdev) { pr_warn("%s: failed to find ocram device!\n", __func__); ret = -ENODEV; goto put_node; } ocram_pool = gen_pool_get(&pdev->dev); if (!ocram_pool) { pr_warn("%s: ocram pool unavailable!\n", __func__); ret = -ENODEV; goto put_node; } ocram_base = gen_pool_alloc(ocram_pool, socfpga_sdram_self_refresh_sz); if (!ocram_base) { pr_warn("%s: unable to alloc ocram!\n", __func__); ret = -ENOMEM; goto put_node; } ocram_pbase = gen_pool_virt_to_phys(ocram_pool, ocram_base); suspend_ocram_base = __arm_ioremap_exec(ocram_pbase, socfpga_sdram_self_refresh_sz, false); if (!suspend_ocram_base) { pr_warn("%s: __arm_ioremap_exec failed!\n", __func__); ret = -ENOMEM; goto put_node; } /* Copy the code that puts DDR in self refresh to ocram */ socfpga_sdram_self_refresh_in_ocram = (void *)fncpy(suspend_ocram_base, &socfpga_sdram_self_refresh, socfpga_sdram_self_refresh_sz); WARN(!socfpga_sdram_self_refresh_in_ocram, "could not copy function to ocram"); if (!socfpga_sdram_self_refresh_in_ocram) ret = -EFAULT; put_node: of_node_put(np); return ret; } static int socfpga_pm_suspend(unsigned long arg) { u32 ret; if (!sdr_ctl_base_addr) return -EFAULT; ret = socfpga_sdram_self_refresh_in_ocram((u32)sdr_ctl_base_addr); pr_debug("%s self-refresh loops request=%d exit=%d\n", __func__, ret & 0xffff, (ret >> 16) & 0xffff); return 0; } static int socfpga_pm_enter(suspend_state_t state) { switch (state) { case PM_SUSPEND_STANDBY: case PM_SUSPEND_MEM: outer_disable(); cpu_suspend(0, socfpga_pm_suspend); outer_resume(); break; default: return -EINVAL; } return 0; } static const struct platform_suspend_ops socfpga_pm_ops = { .valid = suspend_valid_only_mem, .enter = socfpga_pm_enter, }; static int __init socfpga_pm_init(void) { int ret; ret = socfpga_setup_ocram_self_refresh(); if (ret) return ret; suspend_set_ops(&socfpga_pm_ops); pr_info("SoCFPGA initialized for DDR self-refresh during suspend.\n"); return 0; } arch_initcall(socfpga_pm_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
102
103
104
105
106
107
108
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
You can’t perform that action at this time.