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
182e796
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
include
Kconfig
Makefile
Makefile.boot
aemif.c
asp.h
board-da830-evm.c
board-da850-evm.c
board-dm355-evm.c
board-dm355-leopard.c
board-dm365-evm.c
board-dm644x-evm.c
board-dm646x-evm.c
board-mityomapl138.c
board-neuros-osd2.c
board-omapl138-hawk.c
board-sffsdr.c
board-tnetv107x-evm.c
cdce949.c
clock.c
clock.h
common.c
cp_intc.c
cpufreq.c
cpuidle.c
da830.c
da850.c
da8xx-dt.c
davinci.h
devices-da8xx.c
devices-tnetv107x.c
devices.c
dm355.c
dm365.c
dm644x.c
dm646x.c
dma.c
irq.c
mux.c
mux.h
pm.c
pm_domain.c
psc.c
serial.c
sleep.S
sram.c
time.c
tnetv107x.c
usb.c
mach-dove
mach-ebsa110
mach-ep93xx
mach-exynos
mach-footbridge
mach-gemini
mach-h720x
mach-highbank
mach-imx
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-davinci
/
sram.c
Copy path
Blame
Blame
Latest commit
History
History
88 lines (73 loc) · 1.92 KB
Breadcrumbs
linux
/
arch
/
arm
/
mach-davinci
/
sram.c
Top
File metadata and controls
Code
Blame
88 lines (73 loc) · 1.92 KB
Raw
/* * mach-davinci/sram.c - DaVinci simple SRAM allocator * * Copyright (C) 2009 David Brownell * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ #include <linux/module.h> #include <linux/init.h> #include <linux/io.h> #include <linux/genalloc.h> #include <mach/common.h> #include <mach/sram.h> static struct gen_pool *sram_pool; struct gen_pool *sram_get_gen_pool(void) { return sram_pool; } void *sram_alloc(size_t len, dma_addr_t *dma) { unsigned long vaddr; dma_addr_t dma_base = davinci_soc_info.sram_dma; if (dma) *dma = 0; if (!sram_pool || (dma && !dma_base)) return NULL; vaddr = gen_pool_alloc(sram_pool, len); if (!vaddr) return NULL; if (dma) *dma = gen_pool_virt_to_phys(sram_pool, vaddr); return (void *)vaddr; } EXPORT_SYMBOL(sram_alloc); void sram_free(void *addr, size_t len) { gen_pool_free(sram_pool, (unsigned long) addr, len); } EXPORT_SYMBOL(sram_free); /* * REVISIT This supports CPU and DMA access to/from SRAM, but it * doesn't (yet?) support some other notable uses of SRAM: as TCM * for data and/or instructions; and holding code needed to enter * and exit suspend states (while DRAM can't be used). */ static int __init sram_init(void) { phys_addr_t phys = davinci_soc_info.sram_dma; unsigned len = davinci_soc_info.sram_len; int status = 0; void __iomem *addr; if (len) { len = min_t(unsigned, len, SRAM_SIZE); sram_pool = gen_pool_create(ilog2(SRAM_GRANULARITY), -1); if (!sram_pool) status = -ENOMEM; } if (sram_pool) { addr = ioremap(phys, len); if (!addr) return -ENOMEM; status = gen_pool_add_virt(sram_pool, (unsigned long) addr, phys, len, -1); if (status < 0) iounmap(addr); } WARN_ON(status < 0); return status; } core_initcall(sram_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
You can’t perform that action at this time.