summaryrefslogtreecommitdiffstats
path: root/recipes-bsp/imx-bootlets/imx-bootlets/cfa10036-support.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-bsp/imx-bootlets/imx-bootlets/cfa10036-support.patch')
-rw-r--r--recipes-bsp/imx-bootlets/imx-bootlets/cfa10036-support.patch271
1 files changed, 271 insertions, 0 deletions
diff --git a/recipes-bsp/imx-bootlets/imx-bootlets/cfa10036-support.patch b/recipes-bsp/imx-bootlets/imx-bootlets/cfa10036-support.patch
new file mode 100644
index 0000000..9483af4
--- /dev/null
+++ b/recipes-bsp/imx-bootlets/imx-bootlets/cfa10036-support.patch
@@ -0,0 +1,271 @@
1Add cfa10036 support
2
3Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
4
5diff --git a/Makefile b/Makefile
6index 367738c..a9c5d21 100644
7--- a/Makefile
8+++ b/Makefile
9@@ -16,6 +16,9 @@ endif
10 ifeq ($(BOARD), iMX28_EVK)
11 ARCH = mx28
12 endif
13+ifeq ($(BOARD), cfa10036)
14+ARCH = mx28
15+endif
16
17 all: build_prep gen_bootstream
18
19diff --git a/boot_prep/Makefile b/boot_prep/Makefile
20index 0267ede..86570fc 100644
21--- a/boot_prep/Makefile
22+++ b/boot_prep/Makefile
23@@ -23,6 +23,30 @@ MEM_TYPE ?= MEM_DDR1
24 CFLAGS = -g -Wall -I$(INCLUDEDIR) -I$(INCLUDEDIR)/mach -I./ -O -D$(MEM_TYPE)
25 LDFLAGS = -static -nostdlib -T $(BOOT_LAYOUT)
26
27+# The board defines STMP CPU family and peripherial components
28+# So, set ARCH and HW_OBJS variables for each supported board
29+# separately.
30+ifeq ($(BOARD), stmp37xx_dev)
31+ARCH = 37xx
32+HW_OBJS = $(LRADC_OBJS)
33+CFLAGS += -DSTMP37XX -DBOARD_STMP37XX_DEV
34+endif
35+ifeq ($(BOARD), stmp378x_dev)
36+ARCH = mx23
37+HW_OBJS = $(LRADC_OBJS)
38+CFLAGS += -DSTMP378X -DBOARD_STMP378X_DEV
39+endif
40+ifeq ($(BOARD), iMX28_EVK)
41+ARCH = mx28
42+HW_OBJS = $(LRADC_OBJS)
43+CFLAGS += -DMX28 -DBOARD_MX28_EVK
44+endif
45+ifeq ($(BOARD), cfa10036)
46+ARCH = mx28
47+HW_OBJS = $(LRADC_OBJS)
48+CFLAGS += -DMX28 -DBOARD_CFA10036
49+endif
50+
51 # Generic code
52 CORE_OBJS = init-$(ARCH).o debug.o
53
54diff --git a/boot_prep/init-mx28.c b/boot_prep/init-mx28.c
55index a1e4752..480a1c2 100644
56--- a/boot_prep/init-mx28.c
57+++ b/boot_prep/init-mx28.c
58@@ -752,17 +752,17 @@ void DDR2EmiController_EDE1116_200MHz(void)
59 DRAM_REG[24] = 0x00000000;
60 DRAM_REG[25] = 0x00000000;
61 DRAM_REG[26] = 0x00010101;
62- DRAM_REG[27] = 0x01010101;
63+ DRAM_REG[27] = 0x01010101; // 0000000 1 0000000 1 0000000 1 0000000 1
64 DRAM_REG[28] = 0x000f0f01;
65- DRAM_REG[29] = 0x0f02020a;
66+ DRAM_REG[29] = 0x0f02010a; // 0000 1111 00000 010 00000 001 0000 1010
67 DRAM_REG[30] = 0x00000000;
68- DRAM_REG[31] = 0x00010101;
69- DRAM_REG[32] = 0x00000100;
70+ DRAM_REG[31] = 0x00010101; // 000000000000000 1(8 banks) 0000000 1 0000000 1
71+ DRAM_REG[32] = 0x00000100; // 0000000000000000 0000000 1(REDUC) 0000000 0(REG_DIMM_ENABLE)
72 DRAM_REG[33] = 0x00000100;
73 DRAM_REG[34] = 0x00000000;
74- DRAM_REG[35] = 0x00000002;
75+ DRAM_REG[35] = 0x00000002; // 000000000000000 0 0000000 0 0000 0010
76 DRAM_REG[36] = 0x01010000;
77- DRAM_REG[37] = 0x07080403;
78+ DRAM_REG[37] = 0x07080503; // 0000 0111 0000 1000 00000 101(CAS5) 0000 0011
79 DRAM_REG[38] = 0x06005003;
80 DRAM_REG[39] = 0x0a0000c8;
81 DRAM_REG[40] = 0x02009c40;
82@@ -1300,12 +1300,54 @@ void poweron_vdda()
83 HW_POWER_VDDACTRL_WR( BF_POWER_VDDACTRL_TRG(0xC) | BF_POWER_VDDACTRL_BO_OFFSET(7)
84 | BF_POWER_VDDACTRL_LINREG_OFFSET(2) );
85 }
86+
87+/*
88+ * Check memory range for valid RAM. A simple memory test determines
89+ * the actually available RAM size between addresses `base' and
90+ * `base + maxsize'.
91+ * Copied and pasted from barebox common/memsize.c file
92+ */
93+long get_ram_size(long *base, long maxsize)
94+{
95+ volatile long *addr;
96+ long cnt;
97+ long val;
98+ long size;
99+ int i = 0;
100+
101+ for (cnt = (maxsize / sizeof (long)) >> 1; cnt > 0; cnt >>= 1) {
102+ addr = base + cnt; /* pointer arith! */
103+ *addr = ~cnt;
104+ }
105+
106+ addr = base;
107+ *addr = 0;
108+
109+ for (cnt = 1; cnt < maxsize / sizeof (long); cnt <<= 1) {
110+ addr = base + cnt; /* pointer arith! */
111+ val = *addr;
112+ if (val != ~cnt) {
113+ size = cnt * sizeof (long);
114+ return (size);
115+ }
116+ }
117+
118+ return (maxsize);
119+}
120+
121 int _start(int arg)
122 {
123 unsigned int value;
124- volatile int *pTest = 0x40000000;
125- int i;
126-
127+ int memsize;
128+
129+#ifdef BOARD_CFA10036
130+ /* Remove all the previous DUART muxing */
131+ HW_PINCTRL_MUXSEL6_CLR((3 << 4) | (3 << 6));
132+ HW_PINCTRL_MUXSEL7_CLR((3 << 0) | (3 << 2));
133+ HW_PINCTRL_MUXSEL7_CLR((3 << 16) | (3 << 18));
134+ /* Mux only the DUART to pins actually used for this function */
135+ HW_PINCTRL_MUXSEL6_SET((2 << 4) | (2 << 6));
136+#else
137 //boot rom wrong use debug uart port.
138 //If fuse burned, the below two line can be removed.
139 HW_PINCTRL_MUXSEL7_CLR(0xF);
140@@ -1315,6 +1357,7 @@ int _start(int arg)
141 * which cause uboot can't input
142 */
143 HW_PINCTRL_MUXSEL7_SET(0x30000);
144+#endif
145
146 #ifdef MEM_MDDR
147 /* set to mddr mode*/
148@@ -1374,28 +1417,8 @@ int _start(int arg)
149
150 change_cpu_freq();
151
152-#if 0
153- for (i = 0; i <= 40; i++) {
154- printf("mem %x - 0x%x\r\n",
155- i, *(volatile int*)(0x800E0000 + i * 4));
156- }
157-#endif
158-
159- /*Test Memory;*/
160- printf("start test memory accress\r\n");
161- printf("ddr2 0x%x\r\n", pTest);
162- for (i = 0; i < 1000; i++)
163- *pTest++ = i;
164-
165- pTest = (volatile int *)0x40000000;
166-
167- for (i = 0; i < 1000; i++) {
168- if (*pTest != (i)) {
169- printf("0x%x error value 0x%x\r\n", i, *pTest);
170- }
171- pTest++;
172- }
173- printf("finish simple test\r\n");
174+ memsize = get_ram_size((long *)0x40000000, 0x10000000);
175+ printf("finish simple test memory size = 0x%xMB\r\n", memsize >> 20);
176 return 0;
177 }
178
179diff --git a/linux_prep/Makefile b/linux_prep/Makefile
180index 19b02a9..b33e4c1 100644
181--- a/linux_prep/Makefile
182+++ b/linux_prep/Makefile
183@@ -69,6 +69,11 @@ ARCH = mx28
184 HW_OBJS = $(LRADC_OBJS)
185 CFLAGS += -DMX28 -DBOARD_MX28_EVK
186 endif
187+ifeq ($(BOARD), cfa10036)
188+ARCH = mx28
189+HW_OBJS = $(LRADC_OBJS)
190+CFLAGS += -DMX28 -DBOARD_CFA10036
191+endif
192
193 # Generic code
194 CORE_OBJS = entry.o resume.o cmdlines.o setup.o keys.o
195diff --git a/linux_prep/board/cfa10036.c b/linux_prep/board/cfa10036.c
196new file mode 100644
197index 0000000..b084ed4
198--- /dev/null
199+++ b/linux_prep/board/cfa10036.c
200@@ -0,0 +1,51 @@
201+/*
202+ * Platform specific data for the STMP37XX development board
203+ *
204+ * Vladislav Buzov <vbuzov@embeddedalley.com>
205+ *
206+ * Copyright 2008 SigmaTel, Inc
207+ * Copyright 2008 Embedded Alley Solutions, Inc
208+ * Copyright 2008-2010 Freescale Semiconductor, Inc. All Rights Reserved.
209+ *
210+ * This file is licensed under the terms of the GNU General Public License
211+ * version 2. This program is licensed "as is" without any warranty of any
212+ * kind, whether express or implied.
213+ */
214+#include <setup.h>
215+#include <keys.h>
216+#include <lradc_buttons.h>
217+
218+/************************************************
219+ * LRADC keyboard data *
220+ ************************************************/
221+int lradc_keypad_ch = LRADC_CH1;
222+int lradc_vddio_ch = LRADC_CH10;
223+
224+struct lradc_keycode lradc_keycodes[] = {
225+ { 100, KEY4 },
226+ { 306, KEY5 },
227+ { 626, KEY6 },
228+ { 932, KEY7 },
229+ { 1260, KEY8 },
230+ { 1584, KEY9 },
231+ { 1757, KEY10 },
232+ { 2207, KEY11 },
233+ { 2525, KEY12 },
234+ { 2831, KEY13 },
235+ { 3134, KEY14 },
236+ { -1, 0 },
237+};
238+
239+/************************************************
240+ * Magic key combinations for Armadillo *
241+ ************************************************/
242+u32 magic_keys[MAGIC_KEY_NR] = {
243+ [MAGIC_KEY1] = KEY4,
244+ [MAGIC_KEY2] = KEY6,
245+ [MAGIC_KEY3] = KEY10,
246+};
247+
248+/************************************************
249+ * Default command line *
250+ ************************************************/
251+char cmdline_def[] = "console=ttyAMA0,115200";
252diff --git a/linux_prep/cmdlines/cfa10036.txt b/linux_prep/cmdlines/cfa10036.txt
253new file mode 100644
254index 0000000..486ffe8
255--- /dev/null
256+++ b/linux_prep/cmdlines/cfa10036.txt
257@@ -0,0 +1 @@
258+console=ttyAMA0,115200 root=/dev/mmcblk0p3 rw rootwait
259diff --git a/linux_prep/include/mx28/platform.h b/linux_prep/include/mx28/platform.h
260index d4063f8..3d1f1d7 100644
261--- a/linux_prep/include/mx28/platform.h
262+++ b/linux_prep/include/mx28/platform.h
263@@ -19,6 +19,8 @@
264
265 #if defined (BOARD_MX28_EVK)
266 #define MACHINE_ID 2531
267+#elif defined (BOARD_CFA10036)
268+#define MACHINE_ID 4142
269 #else
270 #error "Allocate a machine ID for your board"
271 #endif