1 /*
2  * (C) Copyright 2010
3  * Texas Instruments Incorporated.
4  * Aneesh V       <aneesh@ti.com>
5  * Steve Sakoman  <steve@sakoman.com>
6  *
7  * TI OMAP4 common configuration settings
8  *
9  * SPDX-License-Identifier:	GPL-2.0+
10  */
11 
12 #ifndef __CONFIG_TI_OMAP4_COMMON_H
13 #define __CONFIG_TI_OMAP4_COMMON_H
14 
15 /*
16  * High Level Configuration Options
17  */
18 #define CONFIG_OMAP4430		1	/* which is in a 4430 */
19 #define CONFIG_MISC_INIT_R
20 #define CONFIG_ARCH_CPU_INIT
21 #define CONFIG_DISPLAY_CPUINFO		1
22 #define CONFIG_DISPLAY_BOARDINFO	1
23 
24 #define CONFIG_SYS_THUMB_BUILD
25 
26 #ifndef CONFIG_SYS_L2CACHE_OFF
27 #define CONFIG_SYS_L2_PL310		1
28 #define CONFIG_SYS_PL310_BASE	0x48242000
29 #endif
30 #define CONFIG_SYS_CACHELINE_SIZE	32
31 
32 /* Get CPU defs */
33 #include <asm/arch/cpu.h>
34 #include <asm/arch/omap.h>
35 
36 /* Use General purpose timer 1 */
37 #define CONFIG_SYS_TIMERBASE		GPT2_BASE
38 
39 /*
40  * Total Size Environment - 128k
41  */
42 #define CONFIG_ENV_SIZE			(128 << 10)
43 
44 /*
45  * For the DDR timing information we can either dynamically determine
46  * the timings to use or use pre-determined timings (based on using the
47  * dynamic method.  Default to the static timing infomation.
48  */
49 #define CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS
50 #ifndef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS
51 #define CONFIG_SYS_AUTOMATIC_SDRAM_DETECTION
52 #define CONFIG_SYS_DEFAULT_LPDDR2_TIMINGS
53 #endif
54 
55 #include <configs/ti_armv7_omap.h>
56 
57 /*
58  * Hardware drivers
59  */
60 #define CONFIG_SYS_NS16550_CLK		48000000
61 #if defined(CONFIG_SPL_BUILD) || !defined(CONFIG_DM_SERIAL)
62 #define CONFIG_SYS_NS16550_SERIAL
63 #define CONFIG_SYS_NS16550_REG_SIZE	(-4)
64 #define CONFIG_SYS_NS16550_COM3		UART3_BASE
65 #endif
66 #define CONFIG_CONS_INDEX		3
67 
68 /* TWL6030 */
69 #ifndef CONFIG_SPL_BUILD
70 #define CONFIG_TWL6030_POWER		1
71 #endif
72 
73 /* USB */
74 #define CONFIG_USB_MUSB_UDC			1
75 #define CONFIG_USB_OMAP3		1
76 
77 /* USB device configuration */
78 #define CONFIG_USB_DEVICE		1
79 #define CONFIG_USB_TTY			1
80 #define CONFIG_SYS_CONSOLE_IS_IN_ENV	1
81 
82 /*
83  * Environment setup
84  */
85 #define BOOTENV_DEV_LEGACY_MMC(devtypeu, devtypel, instance) \
86 	"bootcmd_" #devtypel #instance "=" \
87 	"setenv mmcdev " #instance"; "\
88 	"setenv bootpart " #instance":2 ; "\
89 	"run mmcboot\0"
90 
91 #define BOOTENV_DEV_NAME_LEGACY_MMC(devtypeu, devtypel, instance) \
92 	#devtypel #instance " "
93 
94 #define BOOTENV_DEV_NAME_NAND(devtypeu, devtypel, instance) \
95 	#devtypel #instance " "
96 
97 #define BOOT_TARGET_DEVICES(func) \
98 	func(MMC, mmc, 0) \
99 	func(LEGACY_MMC, legacy_mmc, 0) \
100 	func(MMC, mmc, 1) \
101 	func(LEGACY_MMC, legacy_mmc, 1) \
102 	func(PXE, pxe, na) \
103 	func(DHCP, dhcp, na)
104 
105 #define CONFIG_BOOTCOMMAND \
106 	"run findfdt; " \
107 	"run distro_bootcmd"
108 
109 #include <config_distro_bootcmd.h>
110 
111 #define CONFIG_EXTRA_ENV_SETTINGS \
112 	DEFAULT_LINUX_BOOT_ENV \
113 	DEFAULT_MMC_TI_ARGS \
114 	"console=ttyO2,115200n8\0" \
115 	"fdtfile=undefined\0" \
116 	"bootpart=0:2\0" \
117 	"bootdir=/boot\0" \
118 	"bootfile=zImage\0" \
119 	"usbtty=cdc_acm\0" \
120 	"vram=16M\0" \
121 	"loadbootscript=load mmc ${mmcdev} ${loadaddr} boot.scr\0" \
122 	"bootscript=echo Running bootscript from mmc${mmcdev} ...; " \
123 		"source ${loadaddr}\0" \
124 	"loadbootenv=load mmc ${mmcdev} ${loadaddr} uEnv.txt\0" \
125 	"importbootenv=echo Importing environment from mmc${mmcdev} ...; " \
126 		"env import -t ${loadaddr} ${filesize}\0" \
127 	"loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
128 	"loaduimage=load mmc ${mmcdev} ${loadaddr} uImage\0" \
129 	"mmcboot=echo Booting from mmc${mmcdev} ...; " \
130 		"run args_mmc; " \
131 		"bootz ${loadaddr} - ${fdtaddr}\0" \
132 	"uimageboot=echo Booting from mmc${mmcdev} ...; " \
133 		"run args_mmc; " \
134 		"bootm ${loadaddr}\0" \
135 	"findfdt="\
136 		"if test $board_name = sdp4430; then " \
137 			"setenv fdtfile omap4-sdp.dtb; fi; " \
138 		"if test $board_name = panda; then " \
139 			"setenv fdtfile omap4-panda.dtb; fi;" \
140 		"if test $board_name = panda-a4; then " \
141 			"setenv fdtfile omap4-panda-a4.dtb; fi;" \
142 		"if test $board_name = panda-es; then " \
143 			"setenv fdtfile omap4-panda-es.dtb; fi;" \
144 		"if test $board_name = duovero; then " \
145 			"setenv fdtfile omap4-duovero-parlor.dtb; fi;" \
146 		"if test $fdtfile = undefined; then " \
147 			"echo WARNING: Could not determine device tree to use; fi; \0" \
148 	"loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
149 	BOOTENV
150 
151 /*
152  * Defines for SPL
153  * It is known that this will break HS devices. Since the current size of
154  * SPL is overlapped with public stack and breaking non HS devices to boot.
155  * So moving TEXT_BASE down to non-HS limit.
156  */
157 #define CONFIG_SPL_TEXT_BASE		0x40300000
158 #define CONFIG_SPL_MAX_SIZE		(0x4030C000 - CONFIG_SPL_TEXT_BASE)
159 #define CONFIG_SPL_DISPLAY_PRINT
160 #define CONFIG_SPL_LDSCRIPT "$(CPUDIR)/omap-common/u-boot-spl.lds"
161 #define CONFIG_SYS_SPL_ARGS_ADDR	(CONFIG_SYS_SDRAM_BASE + \
162 					 (128 << 20))
163 
164 #ifdef CONFIG_NAND
165 #define CONFIG_SPL_NAND_AM33XX_BCH	/* ELM support */
166 #endif
167 
168 #ifdef CONFIG_SPL_BUILD
169 /* No need for i2c in SPL mode as we will use SRI2C for PMIC access on OMAP4 */
170 #undef CONFIG_SYS_I2C
171 #undef CONFIG_SYS_I2C_OMAP24XX
172 #undef CONFIG_SPL_I2C_SUPPORT
173 #endif
174 
175 #endif /* __CONFIG_TI_OMAP4_COMMON_H */
176