Commit ba08d78c8486e767c85aff9823ecfecd9f1e148a
1 parent
02af80fd3b
Exists in
smarc_8mm-imx_v2018.03_4.14.98_2.0.0_ga
and in
5 other branches
MLK-13525-1 mx7ulp: Add common plugin codes for mx7ulp
Add common plugin codes to call ROM's hwcnfg_setup and generate IVT2 header. Signed-off-by: Ye Li <ye.li@nxp.com> (cherry picked from commit 58ffe85c25ff554c185d8f6fd8b6443f167227da) (cherry picked from commit 8dc963c970f81f9cdefff0955eba6b27ca7dc17e)
Showing 2 changed files with 106 additions and 1 deletions Side-by-side Diff
arch/arm/include/asm/arch-mx7ulp/mx7ulp_plugin.S
1 | +/* | |
2 | + * Copyright (C) 2016 Freescale Semiconductor, Inc. | |
3 | + * | |
4 | + * See file CREDITS for list of people who contributed to this | |
5 | + * project. | |
6 | + * | |
7 | + * This program is free software; you can redistribute it and/or | |
8 | + * modify it under the terms of the GNU General Public License as | |
9 | + * published by the Free Software Foundation; either version 2 of | |
10 | + * the License, or (at your option) any later version. | |
11 | + * | |
12 | + * This program is distributed in the hope that it will be useful, | |
13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | + * GNU General Public License for more details. | |
16 | + */ | |
17 | + | |
18 | +#include <config.h> | |
19 | + | |
20 | +#define ROM_API_TABLE_BASE_ADDR_LEGACY 0x180 | |
21 | +#define ROM_VERSION_OFFSET 0x80 | |
22 | +#define ROM_API_HWCNFG_SETUP_OFFSET 0x08 | |
23 | + | |
24 | +plugin_start: | |
25 | + | |
26 | + push {r0-r4, lr} | |
27 | + | |
28 | + imx7ulp_ddr_setting | |
29 | + imx7ulp_clock_gating | |
30 | + imx7ulp_qos_setting | |
31 | + | |
32 | +normal_boot: | |
33 | + | |
34 | +/* | |
35 | + * The following is to fill in those arguments for this ROM function | |
36 | + * pu_irom_hwcnfg_setup(void **start, size_t *bytes, const void *boot_data) | |
37 | + * This function is used to copy data from the storage media into DDR. | |
38 | + * start - Initial (possibly partial) image load address on entry. | |
39 | + * Final image load address on exit. | |
40 | + * bytes - Initial (possibly partial) image size on entry. | |
41 | + * Final image size on exit. | |
42 | + * boot_data - Initial @ref ivt Boot Data load address. | |
43 | + */ | |
44 | + adr r0, boot_data2 | |
45 | + adr r1, image_len2 | |
46 | + adr r2, boot_data2 | |
47 | + | |
48 | +/* | |
49 | + * check the _pu_irom_api_table for the address | |
50 | + */ | |
51 | +before_calling_rom___pu_irom_hwcnfg_setup: | |
52 | + ldr r3, =ROM_VERSION_OFFSET | |
53 | + ldr r4, [r3] | |
54 | + ldr r3, =ROM_API_TABLE_BASE_ADDR_LEGACY | |
55 | + ldr r4, [r3, #ROM_API_HWCNFG_SETUP_OFFSET] | |
56 | + blx r4 | |
57 | +after_calling_rom___pu_irom_hwcnfg_setup: | |
58 | + | |
59 | + | |
60 | +/* To return to ROM from plugin, we need to fill in these argument. | |
61 | + * Here is what need to do: | |
62 | + * Need to construct the paramters for this function before return to ROM: | |
63 | + * plugin_download(void **start, size_t *bytes, UINT32 *ivt_offset) | |
64 | + */ | |
65 | + pop {r0-r4, lr} | |
66 | + push {r5} | |
67 | + ldr r5, boot_data2 | |
68 | + str r5, [r0] | |
69 | + ldr r5, image_len2 | |
70 | + str r5, [r1] | |
71 | + ldr r5, second_ivt_offset | |
72 | + str r5, [r2] | |
73 | + mov r0, #1 | |
74 | + pop {r5} | |
75 | + | |
76 | + /* return back to ROM code */ | |
77 | + bx lr | |
78 | + | |
79 | +/* make the following data right in the end of the output*/ | |
80 | +.ltorg | |
81 | + | |
82 | +#define FLASH_OFFSET 0x400 | |
83 | + | |
84 | +/* | |
85 | + * second_ivt_offset is the offset from the "second_ivt_header" to | |
86 | + * "image_copy_start", which involves FLASH_OFFSET, plus the first | |
87 | + * ivt_header, the plugin code size itself recorded by "ivt2_header" | |
88 | + */ | |
89 | + | |
90 | +second_ivt_offset: .long (ivt2_header + 0x2C + FLASH_OFFSET) | |
91 | + | |
92 | +/* | |
93 | + * The following is the second IVT header plus the second boot data | |
94 | + */ | |
95 | +ivt2_header: .long 0x0 | |
96 | +app2_code_jump_v: .long 0x0 | |
97 | +reserv3: .long 0x0 | |
98 | +dcd2_ptr: .long 0x0 | |
99 | +boot_data2_ptr: .long 0x0 | |
100 | +self_ptr2: .long 0x0 | |
101 | +app_code_csf2: .long 0x0 | |
102 | +reserv4: .long 0x0 | |
103 | +boot_data2: .long 0x0 | |
104 | +image_len2: .long 0x0 | |
105 | +plugin2: .long 0x0 |
arch/arm/mach-imx/Kconfig
... | ... | @@ -29,7 +29,7 @@ |
29 | 29 | |
30 | 30 | config USE_IMXIMG_PLUGIN |
31 | 31 | bool "Use imximage plugin code" |
32 | - depends on ARCH_MX7 || ARCH_MX6 | |
32 | + depends on ARCH_MX7 || ARCH_MX6 || ARCH_MX7ULP | |
33 | 33 | help |
34 | 34 | i.MX6/7 supports DCD and Plugin. Enable this configuration |
35 | 35 | to use Plugin, otherwise DCD will be used. |