1 /*
2  * Copyright (C) 2013, ISEE 2007 SL - http://www.isee.biz/
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation version 2.
7  *
8  * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9  * kind, whether express or implied; without even the implied warranty
10  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  */
13 
14 #ifndef __CONFIG_IGEP003X_H
15 #define __CONFIG_IGEP003X_H
16 
17 #include <configs/ti_am335x_common.h>
18 
19 /* Clock defines */
20 #define V_OSCK				24000000  /* Clock output from T2 */
21 #define V_SCLK				(V_OSCK)
22 
23 #define CONFIG_ENV_SIZE			(96 << 10)	/*  96 KiB */
24 
25 #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
26 
27 #ifndef CONFIG_SPL_BUILD
28 #define CONFIG_EXTRA_ENV_SETTINGS \
29 	DEFAULT_LINUX_BOOT_ENV \
30 	"bootdir=/boot\0" \
31 	"bootfile=zImage\0" \
32 	"console=ttyO0,115200n8\0" \
33 	"mmcdev=0\0" \
34 	"mmcroot=/dev/mmcblk0p2 rw\0" \
35 	"mmcrootfstype=ext4 rootwait\0" \
36 	"mmcargs=setenv bootargs console=${console} " \
37 		"${optargs} " \
38 		"root=${mmcroot} " \
39 		"rootfstype=${mmcrootfstype}\0" \
40 		"bootenv=uEnv.txt\0" \
41 	"loadbootenv=load mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
42 	"importbootenv=echo Importing environment from mmc ...; " \
43 		"env import -t ${loadaddr} ${filesize}\0" \
44 	"mmcload=load mmc ${mmcdev}:2 ${loadaddr} ${bootdir}/${bootfile}; " \
45 		"load mmc ${mmcdev}:2 ${fdtaddr} ${bootdir}/${fdtfile}\0" \
46 	"mmcboot=mmc dev ${mmcdev}; " \
47 		"if mmc rescan; then " \
48 			"echo SD/MMC found on device ${mmcdev};" \
49 			"if run loadbootenv; then " \
50 				"echo Loaded environment from ${bootenv};" \
51 				"run importbootenv;" \
52 			"fi;" \
53 			"if test -n $uenvcmd; then " \
54 				"echo Running uenvcmd ...;" \
55 				"run uenvcmd;" \
56 			"fi;" \
57 			"if run mmcload; then " \
58 				"run mmcargs; " \
59 				"bootz ${loadaddr} - ${fdtaddr};" \
60 			"fi;" \
61 		"fi;\0" \
62 	"mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \
63 	"mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
64 	"nandroot=ubi0:rootfs rw ubi.mtd=1\0" \
65 	"nandrootfstype=ubifs rootwait\0" \
66 	"nandload=ubi part UBI; " \
67 		"ubi read ${loadaddr} kernel; " \
68 		"ubi read ${fdtaddr} dtb \0" \
69 	"nandargs=setenv bootargs console=${console} " \
70 		"${optargs} " \
71 		"root=${nandroot} " \
72 		"rootfstype=${nandrootfstype} \0" \
73 	"nandboot=echo Booting from nand ...; " \
74 		"run nandargs; " \
75 		"run nandload; " \
76 		"bootz ${loadaddr} - ${fdtaddr} \0" \
77 	"netload=tftpboot ${loadaddr} ${bootfile}; " \
78 		"tftpboot ${fdtaddr} ${fdtfile} \0" \
79 	"netargs=setenv bootargs console=${console} " \
80 		"${optargs} " \
81 		"root=/dev/nfs " \
82 		"ip=${ipaddr} nfsroot=${serverip}:${rootnfs},v3,tcp \0" \
83 	"netboot=echo Booting from net ...; " \
84 		"run netargs; " \
85 		"run netload; " \
86 		"bootz ${loadaddr} - ${fdtaddr} \0" \
87 	"findfdt="\
88 		"if test ${board_name} = igep0033; then " \
89 			"setenv fdtfile am335x-igep-base0033.dtb; fi; " \
90 		"if test ${board_name} = igep0034; then " \
91 			"setenv fdtfile am335x-igep-base0040.dtb; fi; " \
92 		"if test ${board_name} = igep0034-lite; then " \
93 			"setenv fdtfile am335x-igep-base0040-lite.dtb; fi; " \
94 		"if test ${fdtfile} = ''; then " \
95 			"echo WARNING: Could not determine device tree to use; fi; \0"
96 #endif
97 
98 #define CONFIG_BOOTCOMMAND \
99 	"run findfdt;" \
100 	"run mmcboot;" \
101 	"run nandboot;" \
102 	"run netboot;"
103 
104 /* NS16550 Configuration */
105 #define CONFIG_SYS_NS16550_COM1		0x44e09000	/* UART0 */
106 
107 /* Ethernet support */
108 #define CONFIG_PHY_SMSC
109 
110 /* NAND support */
111 #define CONFIG_SYS_NAND_ONFI_DETECTION	1
112 
113 #define CONFIG_MTD_PARTITIONS
114 #define CONFIG_MTD_DEVICE
115 
116 /* SPL */
117 
118 /* UBI configuration */
119 #define CONFIG_SPL_UBI			1
120 #define CONFIG_SPL_UBI_MAX_VOL_LEBS	256
121 #define CONFIG_SPL_UBI_MAX_PEB_SIZE	(256*1024)
122 #define CONFIG_SPL_UBI_MAX_PEBS		4096
123 #define CONFIG_SPL_UBI_VOL_IDS		8
124 #define CONFIG_SPL_UBI_LOAD_MONITOR_ID	0
125 #define CONFIG_SPL_UBI_LOAD_KERNEL_ID	3
126 #define CONFIG_SPL_UBI_LOAD_ARGS_ID	4
127 #define CONFIG_SPL_UBI_PEB_OFFSET	4
128 #define CONFIG_SPL_UBI_VID_OFFSET	512
129 #define CONFIG_SPL_UBI_LEB_START	2048
130 #define CONFIG_SPL_UBI_INFO_ADDR	0x88080000
131 
132 /* environment organization */
133 #define CONFIG_ENV_UBI_PART		"UBI"
134 #define CONFIG_ENV_UBI_VOLUME		"config"
135 #define CONFIG_ENV_UBI_VOLUME_REDUND	"config_r"
136 
137 /* NAND config */
138 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
139 #define CONFIG_SYS_NAND_PAGE_COUNT	(CONFIG_SYS_NAND_BLOCK_SIZE / \
140 					 CONFIG_SYS_NAND_PAGE_SIZE)
141 #define CONFIG_SYS_NAND_PAGE_SIZE	2048
142 #define CONFIG_SYS_NAND_OOBSIZE		64
143 #define CONFIG_SYS_NAND_BLOCK_SIZE	(128*1024)
144 #define CONFIG_SYS_NAND_BAD_BLOCK_POS	NAND_LARGE_BADBLOCK_POS
145 #define CONFIG_SYS_NAND_ECCPOS		{ 2, 3, 4, 5, 6, 7, 8, 9, \
146 					 10, 11, 12, 13, 14, 15, 16, 17, \
147 					 18, 19, 20, 21, 22, 23, 24, 25, \
148 					 26, 27, 28, 29, 30, 31, 32, 33, \
149 					 34, 35, 36, 37, 38, 39, 40, 41, \
150 					 42, 43, 44, 45, 46, 47, 48, 49, \
151 					 50, 51, 52, 53, 54, 55, 56, 57, }
152 
153 #define CONFIG_SYS_NAND_ECCSIZE		512
154 #define CONFIG_SYS_NAND_ECCBYTES	14
155 #define CONFIG_NAND_OMAP_ECCSCHEME	OMAP_ECC_BCH8_CODE_HW
156 
157 #endif	/* ! __CONFIG_IGEP003X_H */
158