Commit 2e5901d6540281de5e932254cce59538c109a308
1 parent
8e1279fcab
Exists in
smarc_8mq-imx_v2020.04_5.4.24_2.1.0
and in
1 other branch
MA-17246 Remove debug log for mx7ulp
Remove redundant debug log for imx7ulp. Change-Id: I6839cafe1d53ba071f97e7aa4caff7ff5d2f633c Signed-off-by: Ji Luo <ji.luo@nxp.com>
Showing 1 changed file with 0 additions and 1 deletions Inline Diff
board/freescale/mx7ulp_evk/mx7ulp_evk.c
1 | // SPDX-License-Identifier: GPL-2.0+ | 1 | // SPDX-License-Identifier: GPL-2.0+ |
2 | /* | 2 | /* |
3 | * Copyright (C) 2016 Freescale Semiconductor, Inc. | 3 | * Copyright (C) 2016 Freescale Semiconductor, Inc. |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <common.h> | 6 | #include <common.h> |
7 | #include <fdt_support.h> | 7 | #include <fdt_support.h> |
8 | #include <asm/io.h> | 8 | #include <asm/io.h> |
9 | #include <asm/arch/sys_proto.h> | 9 | #include <asm/arch/sys_proto.h> |
10 | #include <asm/arch/mx7ulp-pins.h> | 10 | #include <asm/arch/mx7ulp-pins.h> |
11 | #include <asm/arch/iomux.h> | 11 | #include <asm/arch/iomux.h> |
12 | #include <asm/mach-imx/boot_mode.h> | 12 | #include <asm/mach-imx/boot_mode.h> |
13 | #include <asm/gpio.h> | 13 | #include <asm/gpio.h> |
14 | #include <usb.h> | 14 | #include <usb.h> |
15 | #include <dm.h> | 15 | #include <dm.h> |
16 | 16 | ||
17 | #ifdef CONFIG_BOOTLOADER_MENU | 17 | #ifdef CONFIG_BOOTLOADER_MENU |
18 | #include "video.h" | 18 | #include "video.h" |
19 | #include "dm/uclass.h" | 19 | #include "dm/uclass.h" |
20 | #include "video_font_data.h" | 20 | #include "video_font_data.h" |
21 | #include "video_console.h" | 21 | #include "video_console.h" |
22 | #include "recovery.h" | 22 | #include "recovery.h" |
23 | #endif | 23 | #endif |
24 | 24 | ||
25 | DECLARE_GLOBAL_DATA_PTR; | 25 | DECLARE_GLOBAL_DATA_PTR; |
26 | 26 | ||
27 | #define UART_PAD_CTRL (PAD_CTL_PUS_UP) | 27 | #define UART_PAD_CTRL (PAD_CTL_PUS_UP) |
28 | #define QSPI_PAD_CTRL1 (PAD_CTL_PUS_UP | PAD_CTL_DSE) | 28 | #define QSPI_PAD_CTRL1 (PAD_CTL_PUS_UP | PAD_CTL_DSE) |
29 | #define OTG_ID_GPIO_PAD_CTRL (PAD_CTL_IBE_ENABLE) | 29 | #define OTG_ID_GPIO_PAD_CTRL (PAD_CTL_IBE_ENABLE) |
30 | 30 | ||
31 | int dram_init(void) | 31 | int dram_init(void) |
32 | { | 32 | { |
33 | gd->ram_size = imx_ddr_size(); | 33 | gd->ram_size = imx_ddr_size(); |
34 | 34 | ||
35 | return 0; | 35 | return 0; |
36 | } | 36 | } |
37 | 37 | ||
38 | static iomux_cfg_t const lpuart4_pads[] = { | 38 | static iomux_cfg_t const lpuart4_pads[] = { |
39 | MX7ULP_PAD_PTC3__LPUART4_RX | MUX_PAD_CTRL(UART_PAD_CTRL), | 39 | MX7ULP_PAD_PTC3__LPUART4_RX | MUX_PAD_CTRL(UART_PAD_CTRL), |
40 | MX7ULP_PAD_PTC2__LPUART4_TX | MUX_PAD_CTRL(UART_PAD_CTRL), | 40 | MX7ULP_PAD_PTC2__LPUART4_TX | MUX_PAD_CTRL(UART_PAD_CTRL), |
41 | }; | 41 | }; |
42 | 42 | ||
43 | static void setup_iomux_uart(void) | 43 | static void setup_iomux_uart(void) |
44 | { | 44 | { |
45 | mx7ulp_iomux_setup_multiple_pads(lpuart4_pads, | 45 | mx7ulp_iomux_setup_multiple_pads(lpuart4_pads, |
46 | ARRAY_SIZE(lpuart4_pads)); | 46 | ARRAY_SIZE(lpuart4_pads)); |
47 | } | 47 | } |
48 | 48 | ||
49 | #ifdef CONFIG_FSL_QSPI | 49 | #ifdef CONFIG_FSL_QSPI |
50 | #ifndef CONFIG_DM_SPI | 50 | #ifndef CONFIG_DM_SPI |
51 | static iomux_cfg_t const quadspi_pads[] = { | 51 | static iomux_cfg_t const quadspi_pads[] = { |
52 | MX7ULP_PAD_PTB8__QSPIA_SS0_B | MUX_PAD_CTRL(QSPI_PAD_CTRL1), | 52 | MX7ULP_PAD_PTB8__QSPIA_SS0_B | MUX_PAD_CTRL(QSPI_PAD_CTRL1), |
53 | MX7ULP_PAD_PTB15__QSPIA_SCLK | MUX_PAD_CTRL(QSPI_PAD_CTRL1), | 53 | MX7ULP_PAD_PTB15__QSPIA_SCLK | MUX_PAD_CTRL(QSPI_PAD_CTRL1), |
54 | MX7ULP_PAD_PTB16__QSPIA_DATA3 | MUX_PAD_CTRL(QSPI_PAD_CTRL1), | 54 | MX7ULP_PAD_PTB16__QSPIA_DATA3 | MUX_PAD_CTRL(QSPI_PAD_CTRL1), |
55 | MX7ULP_PAD_PTB17__QSPIA_DATA2 | MUX_PAD_CTRL(QSPI_PAD_CTRL1), | 55 | MX7ULP_PAD_PTB17__QSPIA_DATA2 | MUX_PAD_CTRL(QSPI_PAD_CTRL1), |
56 | MX7ULP_PAD_PTB18__QSPIA_DATA1 | MUX_PAD_CTRL(QSPI_PAD_CTRL1), | 56 | MX7ULP_PAD_PTB18__QSPIA_DATA1 | MUX_PAD_CTRL(QSPI_PAD_CTRL1), |
57 | MX7ULP_PAD_PTB19__QSPIA_DATA0 | MUX_PAD_CTRL(QSPI_PAD_CTRL1), | 57 | MX7ULP_PAD_PTB19__QSPIA_DATA0 | MUX_PAD_CTRL(QSPI_PAD_CTRL1), |
58 | }; | 58 | }; |
59 | #endif | 59 | #endif |
60 | 60 | ||
61 | int board_qspi_init(void) | 61 | int board_qspi_init(void) |
62 | { | 62 | { |
63 | u32 val; | 63 | u32 val; |
64 | #ifndef CONFIG_DM_SPI | 64 | #ifndef CONFIG_DM_SPI |
65 | mx7ulp_iomux_setup_multiple_pads(quadspi_pads, ARRAY_SIZE(quadspi_pads)); | 65 | mx7ulp_iomux_setup_multiple_pads(quadspi_pads, ARRAY_SIZE(quadspi_pads)); |
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | /* enable clock */ | 68 | /* enable clock */ |
69 | val = readl(PCC1_RBASE + 0x94); | 69 | val = readl(PCC1_RBASE + 0x94); |
70 | 70 | ||
71 | if (!(val & 0x20000000)) { | 71 | if (!(val & 0x20000000)) { |
72 | writel(0x03000003, (PCC1_RBASE + 0x94)); | 72 | writel(0x03000003, (PCC1_RBASE + 0x94)); |
73 | writel(0x43000003, (PCC1_RBASE + 0x94)); | 73 | writel(0x43000003, (PCC1_RBASE + 0x94)); |
74 | } | 74 | } |
75 | 75 | ||
76 | /* Enable QSPI as a wakeup source on B0 */ | 76 | /* Enable QSPI as a wakeup source on B0 */ |
77 | if (soc_rev() >= CHIP_REV_2_0) | 77 | if (soc_rev() >= CHIP_REV_2_0) |
78 | setbits_le32(SIM0_RBASE + WKPU_WAKEUP_EN, WKPU_QSPI_CHANNEL); | 78 | setbits_le32(SIM0_RBASE + WKPU_WAKEUP_EN, WKPU_QSPI_CHANNEL); |
79 | return 0; | 79 | return 0; |
80 | } | 80 | } |
81 | #endif | 81 | #endif |
82 | 82 | ||
83 | int board_early_init_f(void) | 83 | int board_early_init_f(void) |
84 | { | 84 | { |
85 | setup_iomux_uart(); | 85 | setup_iomux_uart(); |
86 | 86 | ||
87 | return 0; | 87 | return 0; |
88 | } | 88 | } |
89 | 89 | ||
90 | int board_init(void) | 90 | int board_init(void) |
91 | { | 91 | { |
92 | /* address of boot parameters */ | 92 | /* address of boot parameters */ |
93 | gd->bd->bi_boot_params = PHYS_SDRAM + 0x100; | 93 | gd->bd->bi_boot_params = PHYS_SDRAM + 0x100; |
94 | 94 | ||
95 | #ifdef CONFIG_FSL_QSPI | 95 | #ifdef CONFIG_FSL_QSPI |
96 | board_qspi_init(); | 96 | board_qspi_init(); |
97 | #endif | 97 | #endif |
98 | 98 | ||
99 | return 0; | 99 | return 0; |
100 | } | 100 | } |
101 | 101 | ||
102 | #if IS_ENABLED(CONFIG_OF_BOARD_SETUP) | 102 | #if IS_ENABLED(CONFIG_OF_BOARD_SETUP) |
103 | int ft_board_setup(void *blob, bd_t *bd) | 103 | int ft_board_setup(void *blob, bd_t *bd) |
104 | { | 104 | { |
105 | const char *path; | 105 | const char *path; |
106 | int rc, nodeoff; | 106 | int rc, nodeoff; |
107 | 107 | ||
108 | if (get_boot_device() == USB_BOOT) { | 108 | if (get_boot_device() == USB_BOOT) { |
109 | path = fdt_get_alias(blob, "mmc0"); | 109 | path = fdt_get_alias(blob, "mmc0"); |
110 | if (!path) { | 110 | if (!path) { |
111 | puts("Not found mmc0\n"); | 111 | puts("Not found mmc0\n"); |
112 | return 0; | 112 | return 0; |
113 | } | 113 | } |
114 | 114 | ||
115 | nodeoff = fdt_path_offset(blob, path); | 115 | nodeoff = fdt_path_offset(blob, path); |
116 | if (nodeoff < 0) | 116 | if (nodeoff < 0) |
117 | return 0; | 117 | return 0; |
118 | 118 | ||
119 | printf("Found usdhc0 node\n"); | 119 | printf("Found usdhc0 node\n"); |
120 | if (fdt_get_property(blob, nodeoff, "vqmmc-supply", | 120 | if (fdt_get_property(blob, nodeoff, "vqmmc-supply", |
121 | NULL) != NULL) { | 121 | NULL) != NULL) { |
122 | rc = fdt_delprop(blob, nodeoff, "vqmmc-supply"); | 122 | rc = fdt_delprop(blob, nodeoff, "vqmmc-supply"); |
123 | if (!rc) { | 123 | if (!rc) { |
124 | puts("Removed vqmmc-supply property\n"); | 124 | puts("Removed vqmmc-supply property\n"); |
125 | add: | 125 | add: |
126 | rc = fdt_setprop(blob, nodeoff, | 126 | rc = fdt_setprop(blob, nodeoff, |
127 | "no-1-8-v", NULL, 0); | 127 | "no-1-8-v", NULL, 0); |
128 | if (rc == -FDT_ERR_NOSPACE) { | 128 | if (rc == -FDT_ERR_NOSPACE) { |
129 | rc = fdt_increase_size(blob, 32); | 129 | rc = fdt_increase_size(blob, 32); |
130 | if (!rc) | 130 | if (!rc) |
131 | goto add; | 131 | goto add; |
132 | } else if (rc) { | 132 | } else if (rc) { |
133 | printf("Failed to add no-1-8-v property, %d\n", rc); | 133 | printf("Failed to add no-1-8-v property, %d\n", rc); |
134 | } else { | 134 | } else { |
135 | puts("Added no-1-8-v property\n"); | 135 | puts("Added no-1-8-v property\n"); |
136 | } | 136 | } |
137 | } else { | 137 | } else { |
138 | printf("Failed to remove vqmmc-supply property, %d\n", rc); | 138 | printf("Failed to remove vqmmc-supply property, %d\n", rc); |
139 | } | 139 | } |
140 | } | 140 | } |
141 | } | 141 | } |
142 | 142 | ||
143 | return 0; | 143 | return 0; |
144 | } | 144 | } |
145 | #endif | 145 | #endif |
146 | 146 | ||
147 | #ifdef CONFIG_BOOTLOADER_MENU | 147 | #ifdef CONFIG_BOOTLOADER_MENU |
148 | static iomux_cfg_t const vol_pad[] = { | 148 | static iomux_cfg_t const vol_pad[] = { |
149 | MX7ULP_PAD_PTA3__PTA3 | MUX_PAD_CTRL(PAD_CTL_IBE_ENABLE), | 149 | MX7ULP_PAD_PTA3__PTA3 | MUX_PAD_CTRL(PAD_CTL_IBE_ENABLE), |
150 | }; | 150 | }; |
151 | #define VOLP_GPIO IMX_GPIO_NR(1, 3) | 151 | #define VOLP_GPIO IMX_GPIO_NR(1, 3) |
152 | bool is_vol_key_pressed(void); | 152 | bool is_vol_key_pressed(void); |
153 | int show_bootloader_menu(void); | 153 | int show_bootloader_menu(void); |
154 | #endif | 154 | #endif |
155 | 155 | ||
156 | int board_late_init(void) | 156 | int board_late_init(void) |
157 | { | 157 | { |
158 | env_set("tee", "no"); | 158 | env_set("tee", "no"); |
159 | #ifdef CONFIG_IMX_OPTEE | 159 | #ifdef CONFIG_IMX_OPTEE |
160 | env_set("tee", "yes"); | 160 | env_set("tee", "yes"); |
161 | #endif | 161 | #endif |
162 | 162 | ||
163 | #ifdef CONFIG_ENV_IS_IN_MMC | 163 | #ifdef CONFIG_ENV_IS_IN_MMC |
164 | board_late_mmc_env_init(); | 164 | board_late_mmc_env_init(); |
165 | #endif | 165 | #endif |
166 | 166 | ||
167 | #ifdef CONFIG_BOOTLOADER_MENU | 167 | #ifdef CONFIG_BOOTLOADER_MENU |
168 | mx7ulp_iomux_setup_multiple_pads(vol_pad, ARRAY_SIZE(vol_pad)); | 168 | mx7ulp_iomux_setup_multiple_pads(vol_pad, ARRAY_SIZE(vol_pad)); |
169 | if (gpio_request(VOLP_GPIO, "volp")) | 169 | if (gpio_request(VOLP_GPIO, "volp")) |
170 | printf("request error\n"); | 170 | printf("request error\n"); |
171 | gpio_direction_input(VOLP_GPIO); | 171 | gpio_direction_input(VOLP_GPIO); |
172 | 172 | ||
173 | if (is_vol_key_pressed()) | 173 | if (is_vol_key_pressed()) |
174 | show_bootloader_menu(); | 174 | show_bootloader_menu(); |
175 | #endif | 175 | #endif |
176 | 176 | ||
177 | return 0; | 177 | return 0; |
178 | } | 178 | } |
179 | 179 | ||
180 | #ifdef CONFIG_FSL_FASTBOOT | 180 | #ifdef CONFIG_FSL_FASTBOOT |
181 | #ifdef CONFIG_ANDROID_RECOVERY | 181 | #ifdef CONFIG_ANDROID_RECOVERY |
182 | int is_recovery_key_pressing(void) | 182 | int is_recovery_key_pressing(void) |
183 | { | 183 | { |
184 | return 0; /*TODO*/ | 184 | return 0; /*TODO*/ |
185 | } | 185 | } |
186 | #endif /*CONFIG_ANDROID_RECOVERY*/ | 186 | #endif /*CONFIG_ANDROID_RECOVERY*/ |
187 | #endif /*CONFIG_FSL_FASTBOOT*/ | 187 | #endif /*CONFIG_FSL_FASTBOOT*/ |
188 | 188 | ||
189 | #ifdef CONFIG_ANDROID_SUPPORT | 189 | #ifdef CONFIG_ANDROID_SUPPORT |
190 | bool is_power_key_pressed(void) { | 190 | bool is_power_key_pressed(void) { |
191 | /* the onoff button is 'pressed' by default on evk board */ | 191 | /* the onoff button is 'pressed' by default on evk board */ |
192 | return (bool)(!(readl(SNVS_HPSR_REVB) & (0x1 << 6))); | 192 | return (bool)(!(readl(SNVS_HPSR_REVB) & (0x1 << 6))); |
193 | } | 193 | } |
194 | 194 | ||
195 | #ifdef CONFIG_BOOTLOADER_MENU | 195 | #ifdef CONFIG_BOOTLOADER_MENU |
196 | char bootloader_menu[4][40] = { | 196 | char bootloader_menu[4][40] = { |
197 | " * Power off the device\n", | 197 | " * Power off the device\n", |
198 | " * Start the device normally\n", | 198 | " * Start the device normally\n", |
199 | " * Restart the bootloader\n", | 199 | " * Restart the bootloader\n", |
200 | " * Boot into recovery mode\n" | 200 | " * Boot into recovery mode\n" |
201 | }; | 201 | }; |
202 | 202 | ||
203 | bool is_vol_key_pressed(void) { | 203 | bool is_vol_key_pressed(void) { |
204 | int ret = 0; | 204 | int ret = 0; |
205 | ret = gpio_get_value(VOLP_GPIO); | 205 | ret = gpio_get_value(VOLP_GPIO); |
206 | return (bool)(!!ret); | 206 | return (bool)(!!ret); |
207 | } | 207 | } |
208 | 208 | ||
209 | int show_bootloader_menu(void) { | 209 | int show_bootloader_menu(void) { |
210 | struct udevice *dev, *dev_console; | 210 | struct udevice *dev, *dev_console; |
211 | uint32_t focus = 0, i; | 211 | uint32_t focus = 0, i; |
212 | bool stop_menu = false; | 212 | bool stop_menu = false; |
213 | 213 | ||
214 | /* clear screen first */ | 214 | /* clear screen first */ |
215 | if (uclass_first_device_err(UCLASS_VIDEO, &dev)) { | 215 | if (uclass_first_device_err(UCLASS_VIDEO, &dev)) { |
216 | printf("no video device found!\n"); | 216 | printf("no video device found!\n"); |
217 | return -1; | 217 | return -1; |
218 | } | 218 | } |
219 | video_clear(dev); | 219 | video_clear(dev); |
220 | 220 | ||
221 | if (uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev_console)) { | 221 | if (uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev_console)) { |
222 | printf("no text console device found!\n"); | 222 | printf("no text console device found!\n"); |
223 | return -1; | 223 | return -1; |
224 | } | 224 | } |
225 | 225 | ||
226 | vidconsole_position_cursor(dev_console, 0, 1); | 226 | vidconsole_position_cursor(dev_console, 0, 1); |
227 | vidconsole_put_string(dev_console, "Press 'vol+' to choose an item, press\n"); | 227 | vidconsole_put_string(dev_console, "Press 'vol+' to choose an item, press\n"); |
228 | vidconsole_put_string(dev_console, "power key to confirm:\n"); | 228 | vidconsole_put_string(dev_console, "power key to confirm:\n"); |
229 | while (!stop_menu) { | 229 | while (!stop_menu) { |
230 | /* reset the cursor position. */ | 230 | /* reset the cursor position. */ |
231 | vidconsole_position_cursor(dev_console, 0, 4); | 231 | vidconsole_position_cursor(dev_console, 0, 4); |
232 | /* show menu */ | 232 | /* show menu */ |
233 | for (i = 0; i < 4; i++) { | 233 | for (i = 0; i < 4; i++) { |
234 | /* reverse color for the 'focus' line. */ | 234 | /* reverse color for the 'focus' line. */ |
235 | if (i == focus) | 235 | if (i == focus) |
236 | vidconsole_put_string(dev_console, "\x1b[7m"); | 236 | vidconsole_put_string(dev_console, "\x1b[7m"); |
237 | /* show text */ | 237 | /* show text */ |
238 | vidconsole_put_string(dev_console, bootloader_menu[i]); | 238 | vidconsole_put_string(dev_console, bootloader_menu[i]); |
239 | /* reset color back for the 'next' line. */ | 239 | /* reset color back for the 'next' line. */ |
240 | if (i == focus) | 240 | if (i == focus) |
241 | vidconsole_put_string(dev_console, "\x1b[0m"); | 241 | vidconsole_put_string(dev_console, "\x1b[0m"); |
242 | } | 242 | } |
243 | /* check button status */ | 243 | /* check button status */ |
244 | while (1) { | 244 | while (1) { |
245 | if (is_power_key_pressed()) { | 245 | if (is_power_key_pressed()) { |
246 | switch (focus) { | 246 | switch (focus) { |
247 | case 0: /*TODO*/ | 247 | case 0: /*TODO*/ |
248 | case 1: | 248 | case 1: |
249 | break; | 249 | break; |
250 | case 2: | 250 | case 2: |
251 | do_reset(NULL, 0, 0, NULL); | 251 | do_reset(NULL, 0, 0, NULL); |
252 | case 3: | 252 | case 3: |
253 | board_recovery_setup(); | 253 | board_recovery_setup(); |
254 | break; | 254 | break; |
255 | default: | 255 | default: |
256 | break; | 256 | break; |
257 | } | 257 | } |
258 | stop_menu = true; | 258 | stop_menu = true; |
259 | break; | 259 | break; |
260 | } else if (is_vol_key_pressed()) { | 260 | } else if (is_vol_key_pressed()) { |
261 | focus++; | 261 | focus++; |
262 | printf("\nfocus is %d\n", focus); | ||
263 | if (focus > 3) | 262 | if (focus > 3) |
264 | focus = 0; | 263 | focus = 0; |
265 | mdelay(400); | 264 | mdelay(400); |
266 | break; | 265 | break; |
267 | } | 266 | } |
268 | } | 267 | } |
269 | } | 268 | } |
270 | 269 | ||
271 | /* clear screen before exit */ | 270 | /* clear screen before exit */ |
272 | video_clear(dev); | 271 | video_clear(dev); |
273 | return 0; | 272 | return 0; |
274 | } | 273 | } |
275 | #endif /* CONFIG_BOOTLOADER_MENU */ | 274 | #endif /* CONFIG_BOOTLOADER_MENU */ |
276 | #endif /* CONFIG_ANDROID_SUPPORT*/ | 275 | #endif /* CONFIG_ANDROID_SUPPORT*/ |
277 | 276 |