Skip to content

Commit d398e04

Browse files
committed
NON-REDISTRIBUTABLE! Use libdram blob to initialize A64 DRAM controller
In order to compile this code, the 'libdram' blob needs to be placed into the top level directory in the U-Boot source tree. The file in question can be found in the "lichee_linux_310.tar.gz" tarball (linked from the pine64 wiki) at the following path: "lichee/brandy/u-boot-2014.07/arch/arm/cpu/armv7/sun50iw1p1/dram" $ sha256sum libdram e23855effc870b194ab0e9623760f1f184f0129f644e0df639329ec2dc838055 libdram Please note that linking proprietary code with the GPL licensed U-Boot sources creates non-redistributable binaries. The GPL license requires that full source code needs to be provided together with the binaries. It means that if you try to create, let's say, a binary SD card image with this code, and *distribute* it to other people, then these other people have the right to request full source code from *you* (including the 'libdram' sources too).
1 parent d24d878 commit d398e04

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

arch/arm/cpu/armv7/sunxi/dram_sun50i.c

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,60 @@
99
#include <asm/arch/dram.h>
1010
#include <linux/kconfig.h>
1111

12-
unsigned long sunxi_dram_init(void)
12+
/* Some callback functions, needed for the libdram blob */
13+
14+
void __usdelay(unsigned long us)
15+
{
16+
udelay(us);
17+
}
18+
19+
int set_ddr_voltage(int set_vol)
1320
{
21+
/* DCDC5 is already set as 1.5V by default */
1422
return 0;
1523
}
24+
25+
/* A piece of data, extracted from the Pine64 Android image */
26+
u32 dram_para[] = {
27+
0x000002A0,
28+
0x00000003,
29+
0x003B3BBB,
30+
0x00000001,
31+
0x10E410E4,
32+
0x00001000,
33+
0x00001840,
34+
0x00000040,
35+
0x00000018,
36+
0x00000002,
37+
0x004A2195,
38+
0x02424190,
39+
0x0008B060,
40+
0x04B005DC,
41+
0x00000000,
42+
0x00000000,
43+
0x00000000,
44+
0x00000000,
45+
0x00000000,
46+
0x00000000,
47+
0x00008808,
48+
0x20250000,
49+
0x00000000,
50+
0x04000800,
51+
0x00000000,
52+
0x00000000,
53+
0x00000000,
54+
0x00000000,
55+
0x00000000,
56+
0x00000000,
57+
0x00000000,
58+
0x00000000
59+
};
60+
61+
/* Entry point to the libdram blob */
62+
unsigned long init_DRAM(u32, void *);
63+
64+
unsigned long sunxi_dram_init(void)
65+
{
66+
init_DRAM(0, &dram_para[0]);
67+
return get_ram_size((long *)PHYS_SDRAM_0, PHYS_SDRAM_0_SIZE);
68+
}

arch/arm/cpu/armv7/sunxi/u-boot-spl.lds

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ SECTIONS
2929
__start = .;
3030
*(.vectors)
3131
arch/arm/cpu/armv7/start.o (.text)
32+
../libdram (.text)
3233
*(.text*)
3334
} > .sram
3435

0 commit comments

Comments
 (0)