1 /*
2  * GE B1x5v2
3  *
4  * Copyright 2018-2020 GE Inc.
5  * Copyright 2018-2020 Collabora Ltd.
6  *
7  * SPDX-License-Identifier:    GPL-2.0+
8  */
9 
10 #ifndef __GE_B1X5V2_CONFIG_H
11 #define __GE_B1X5V2_CONFIG_H
12 
13 #include "mx6_common.h"
14 
15 #include "imx6_spl.h"
16 #define CONFIG_SPL_TARGET		"u-boot-with-spl.imx"
17 
18 /* Size of malloc() pool */
19 #define CONFIG_SYS_MALLOC_LEN		(10 * SZ_1M)
20 
21 /* PWM */
22 #define CONFIG_IMX6_PWM_PER_CLK		66000000
23 
24 /* UART */
25 #define CONFIG_MXC_UART_BASE		UART3_BASE
26 
27 #if CONFIG_MXC_UART_BASE == UART2_BASE
28 /* UART2 requires CONFIG_DEBUG_UART_BASE=0x21e8000 */
29 #define CONSOLE_DEVICE "ttymxc1" /* System on Module debug connector */
30 #else
31 /* UART3 requires CONFIG_DEBUG_UART_BASE=0x21ec000 */
32 #define CONSOLE_DEVICE "ttymxc2" /* Base board debug connector */
33 #endif
34 
35 /* USB */
36 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
37 #define CONFIG_MXC_USB_PORTSC		(PORT_PTS_UTMI | PORT_PTS_PTW)
38 #define CONFIG_MXC_USB_FLAGS		0
39 #define CONFIG_USB_MAX_CONTROLLER_COUNT 2 /* Enabled USB controller number */
40 #define CONFIG_USBD_HS
41 
42 /* Video */
43 #define CONFIG_HIDE_LOGO_VERSION
44 #define CONFIG_IMX_VIDEO_SKIP
45 
46 /* Memory */
47 #define PHYS_SDRAM		       MMDC0_ARB_BASE_ADDR
48 
49 #define CONFIG_SYS_SDRAM_BASE	       PHYS_SDRAM
50 #define CONFIG_SYS_INIT_RAM_ADDR       IRAM_BASE_ADDR
51 #define CONFIG_SYS_INIT_RAM_SIZE       IRAM_SIZE
52 
53 #define CONFIG_SYS_INIT_SP_OFFSET \
54 	(CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
55 #define CONFIG_SYS_INIT_SP_ADDR \
56 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
57 
58 /* Command definition */
59 #define CONFIG_EXTRA_ENV_SETTINGS \
60 	"image=/boot/fitImage\0" \
61 	"fdt_addr_r=0x18000000\0" \
62 	"splash_addr_r=0x20000000\0" \
63 	"mmcdev=2\0" \
64 	"mmcpart=1\0" \
65 	"console=console="CONSOLE_DEVICE",115200\0" \
66 	"quiet=quiet loglevel=0\0" \
67 	"rootdev=/dev/mmcblk1p\0" \
68 	"setargs=setenv bootargs ${console} ${quiet} ${fsckforcerepair} " \
69 		"bootcause=${bootcause} vt.global_cursor_default=0 vt.cur_default=1 " \
70 		"root=${rootdev}${mmcpart} video=HDMI-A-1:${resolution} rootwait ro\0" \
71 	"loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
72 	"showsplashscreen=load mmc ${mmcdev}:${mmcpart} ${splash_addr_r} /boot/splashscreen-${resolution}.bmp; " \
73 		"bmp display ${splash_addr_r};\0" \
74 	"setconfidx=" \
75 		"if test \"${devicetype}\" = \"B105v2\"; then " \
76 			"setenv confidx 1; " \
77 		"elif test \"${devicetype}\" = \"B125v2\"; then " \
78 			"setenv confidx 2; " \
79 		"elif test \"${devicetype}\" = \"B155v2\"; then " \
80 			"setenv confidx 3; " \
81 		"elif test \"${devicetype}\" = \"B105Pv2\"; then " \
82 			"setenv confidx 4; " \
83 		"elif test \"${devicetype}\" = \"B125Pv2\"; then " \
84 			"setenv confidx 5; " \
85 		"fi;\0" \
86 	"set_default_type=setenv devicetype B155v2; setenv resolution 1366x768;" \
87 		"setenv fdtfile imx6dl-b155v2.dtb; run setconfidx;\0" \
88 	"checkconfidx=env exists confidx || run set_default_type;\0" \
89 	"checkfsckforcerepair=" \
90 		"if test \"${bootcount}\" > \"3\" ; then " \
91 			"setenv fsckforcerepair fsck.repair=1; " \
92 		"fi;\0" \
93 	"helix=run setconfidx; run checkconfidx; run checkfsckforcerepair; run setargs; " \
94 		"regulator dev LED_VCC; regulator enable; " \
95 		"regulator dev 5V0_AUDIO; regulator enable; " \
96 		"bootm ${loadaddr}#conf@${confidx};\0" \
97 	"failbootcmd=" \
98 		"echo reached failbootcmd;" \
99 		"cls; setcurs 5 4; " \
100 		"lcdputs \"Monitor failed to start. Try again, or contact GE Service for support.\"; " \
101 		"bootcount reset; \0" \
102 	"hasfirstboot=" \
103 		"load mmc ${mmcdev}:${mmcpart} ${loadaddr} " \
104 		"/boot/bootcause/firstboot;\0" \
105 	"swappartitions=" \
106 		"setexpr mmcpart 3 - ${mmcpart};\0" \
107 	"doboot=" \
108 		"echo Booting from mmc:${mmcdev}:${mmcpart} ...; " \
109 		"run helix;\0" \
110 	"altbootcmd=" \
111 		"setenv mmcpart 1; run hasfirstboot || setenv mmcpart 2; " \
112 		"run hasfirstboot || setenv mmcpart 0; " \
113 		"if test ${mmcpart} != 0; then " \
114 			"setenv bootcause REVERT; " \
115 			"run swappartitions loadimage doboot; " \
116 		"fi; " \
117 		"run failbootcmd\0" \
118 	"tryboot=" \
119 		"setenv mmcpart 1; run hasfirstboot || setenv mmcpart 2; " \
120 		"run loadimage || run swappartitions && run loadimage || " \
121 		"setenv mmcpart 0 && echo MISSING IMAGE;" \
122 		"run showsplashscreen; sleep 1; " \
123 		"run doboot; run failbootcmd;\0" \
124 
125 #define CONFIG_BOOTCOMMAND "run tryboot;"
126 
127 #endif /* __GE_B1X5V2_CONFIG_H */
128