kconfig: introduce kconfig for UBI
[platform/kernel/u-boot.git] / include / configs / platinum.h
1 /*
2  * Copyright (C) 2014, Barco (www.barco.com)
3  *
4  * SPDX-License-Identifier:     GPL-2.0+
5  */
6
7 #ifndef __PLATINUM_CONFIG_H__
8 #define __PLATINUM_CONFIG_H__
9
10 /* SPL */
11
12 /* Location in NAND to read U-Boot from */
13 #define CONFIG_SYS_NAND_U_BOOT_OFFS     (14 * 1024 * 1024)
14
15 #include "imx6_spl.h"                  /* common IMX6 SPL configuration */
16 #include "mx6_common.h"
17
18 /*
19  * Console configuration
20  */
21
22 #define CONFIG_CMD_BMODE
23 #define CONFIG_CMD_MTDPARTS
24 #define CONFIG_CMD_NAND
25 #define CONFIG_CMD_NAND_TRIMFFS
26 #define CONFIG_CMD_UBIFS
27
28 /*
29  * Hardware configuration
30  */
31
32 /* UART config */
33 #define CONFIG_MXC_UART
34 #define CONFIG_MXC_UART_BASE                    UART1_BASE
35
36 /* I2C config */
37 #define CONFIG_SYS_I2C
38 #define CONFIG_SYS_I2C_MXC
39 #define CONFIG_SYS_I2C_MXC_I2C1         /* enable I2C bus 1 */
40 #define CONFIG_SYS_I2C_MXC_I2C2         /* enable I2C bus 2 */
41 #define CONFIG_SYS_I2C_MXC_I2C3         /* enable I2C bus 3 */
42 #define CONFIG_SYS_I2C_SPEED                    100000
43
44 /* MMC config */
45 #define CONFIG_SYS_FSL_ESDHC_ADDR               0
46 #define CONFIG_SYS_FSL_USDHC_NUM                1
47
48 /* Ethernet config */
49 #define CONFIG_FEC_MXC
50 #define CONFIG_MII
51 #define IMX_FEC_BASE                            ENET_BASE_ADDR
52
53 #define CONFIG_PHYLIB
54
55 /* USB config */
56 #define CONFIG_USB_EHCI
57 #define CONFIG_USB_EHCI_MX6
58 #define CONFIG_MXC_USB_PORT                     1
59 #define CONFIG_MXC_USB_PORTSC                   (PORT_PTS_UTMI | PORT_PTS_PTW)
60 #define CONFIG_MXC_USB_FLAGS                    0
61
62 /* Memory config */
63 #define CONFIG_NR_DRAM_BANKS                    1
64 #define PHYS_SDRAM                              MMDC0_ARB_BASE_ADDR
65 #ifndef PHYS_SDRAM_SIZE
66 #define PHYS_SDRAM_SIZE                         (1024 << 20)
67 #endif
68
69 #define CONFIG_SYS_SDRAM_BASE                   PHYS_SDRAM
70 #define CONFIG_SYS_INIT_RAM_ADDR                IRAM_BASE_ADDR
71 #define CONFIG_SYS_INIT_RAM_SIZE                IRAM_SIZE
72
73 #define CONFIG_SYS_INIT_SP_OFFSET               (CONFIG_SYS_INIT_RAM_SIZE - \
74                                                  GENERATED_GBL_DATA_SIZE)
75 #define CONFIG_SYS_INIT_SP_ADDR                 (CONFIG_SYS_INIT_RAM_ADDR + \
76                                                  CONFIG_SYS_INIT_SP_OFFSET)
77
78 #define CONFIG_SYS_MALLOC_LEN                   (16 * 1024 * 1024)
79
80 #ifdef CONFIG_CMD_NAND
81
82 /* NAND config */
83 #define CONFIG_NAND_MXS
84 #ifndef CONFIG_SYS_NAND_MAX_CHIPS
85 #define CONFIG_SYS_NAND_MAX_CHIPS               2
86 #endif
87 #define CONFIG_SYS_MAX_NAND_DEVICE              1
88 #define CONFIG_SYS_NAND_BASE                    0x40000000
89 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
90 #define CONFIG_SYS_NAND_ONFI_DETECTION
91
92 /* DMA config, needed for GPMI/MXS NAND support */
93 #define CONFIG_APBH_DMA
94 #define CONFIG_APBH_DMA_BURST
95 #define CONFIG_APBH_DMA_BURST8
96
97 /* Environment in NAND */
98 #define CONFIG_ENV_IS_IN_NAND
99 #define CONFIG_ENV_OFFSET               (16 << 20)
100 #define CONFIG_ENV_SECT_SIZE            (128 << 10)
101 #define CONFIG_ENV_SIZE                 CONFIG_ENV_SECT_SIZE
102 #define CONFIG_ENV_OFFSET_REDUND        (CONFIG_ENV_OFFSET + (512 << 10))
103 #define CONFIG_ENV_SIZE_REDUND          CONFIG_ENV_SIZE
104
105 #else /* CONFIG_CMD_NAND */
106
107 /* Environment in MMC */
108 #define CONFIG_ENV_SIZE                 (8 << 10)
109 #define CONFIG_ENV_IS_IN_MMC
110 #define CONFIG_ENV_OFFSET               (6 * 64 * 1024)
111 #define CONFIG_SYS_MMC_ENV_DEV          0
112
113 #endif /* CONFIG_CMD_NAND */
114
115 /*
116  * U-Boot configuration
117  */
118
119 /* Board startup config */
120 #define CONFIG_BOARD_EARLY_INIT_F
121 #define CONFIG_MISC_INIT_R
122
123 #define CONFIG_SYS_MEMTEST_START                PHYS_SDRAM
124 #define CONFIG_SYS_MEMTEST_END                  (CONFIG_SYS_MEMTEST_START + \
125                                                  PHYS_SDRAM_SIZE - (12 << 20))
126
127 #define CONFIG_BOOTCOMMAND                      "run bootubi_scr"
128
129 /* Miscellaneous configurable options */
130 #define CONFIG_PREBOOT
131
132 /* Print Buffer Size */
133 #define CONFIG_SYS_PBSIZE                       (CONFIG_SYS_CBSIZE + \
134                                                  sizeof(CONFIG_SYS_PROMPT) + 16)
135
136 /* MTD/UBI/UBIFS config */
137 #define CONFIG_LZO
138 #define CONFIG_MTD_DEVICE
139 #define CONFIG_MTD_PARTITIONS
140 #define CONFIG_RBTREE
141
142 #if (CONFIG_SYS_NAND_MAX_CHIPS == 1)
143 #define MTDIDS_DEFAULT          "nand0=gpmi-nand"
144 #define MTDPARTS_DEFAULT        "mtdparts=gpmi-nand:14M(spl),2M(uboot)," \
145                                 "512k(env1),512k(env2),-(ubi)"
146 #elif (CONFIG_SYS_NAND_MAX_CHIPS == 2)
147 #define MTDIDS_DEFAULT          "nand0=gpmi-nand"
148 #define MTDPARTS_DEFAULT        "mtdparts=gpmi-nand:14M(spl),2M(uboot)," \
149                                 "512k(env1),512k(env2),495M(ubi0)," \
150                                 "14M(res0),2M(res1)," \
151                                 "512k(res2),512k(res3),-(ubi1)"
152 #endif
153
154 /*
155  * Environment configuration
156  */
157
158 #if (CONFIG_SYS_NAND_MAX_CHIPS == 1)
159 #define CONFIG_COMMON_ENV_UBI                                           \
160         "setubipartition=env set ubipartition ubi\0"                    \
161         "setubirfs=env set ubirfs $ubipartition:rootfs$boot_vol\0"
162 #elif (CONFIG_SYS_NAND_MAX_CHIPS == 2)
163 #define CONFIG_COMMON_ENV_UBI                                           \
164         "setubipartition=env set ubipartition ubi$boot_vol\0"           \
165         "setubirfs=env set ubirfs ubi0:rootfs\0"
166 #endif
167
168 #define CONFIG_COMMON_ENV_MISC                                          \
169         "user=user\0"                                                   \
170         "project="CONFIG_PLATINUM_PROJECT"\0"                           \
171         "uimage=uImage\0"                                               \
172         "dtb="CONFIG_PLATINUM_CPU"-platinum-"CONFIG_PLATINUM_PROJECT".dtb\0" \
173         "serverip=serverip\0"                                           \
174         "memaddrlinux=0x10800000\0"                                     \
175         "memaddrsrc=0x11000000\0"                                       \
176         "memaddrdtb=0x12000000\0"                                       \
177         "console=ttymxc0\0"                                             \
178         "baudrate=115200\0"                                             \
179         "boot_scr=boot.uboot\0"                                         \
180         "boot_vol=0\0"                                                  \
181         "mtdids="MTDIDS_DEFAULT"\0"                                     \
182         "mtdparts="MTDPARTS_DEFAULT"\0"                                 \
183         "mmcfs=ext2\0"                                                  \
184         "mmcrootpart=1\0"                                               \
185         \
186         "setnfspath=env set nfspath /home/nfs/$user/$project/root\0"    \
187         "settftpfilelinux=env set tftpfilelinux $user/$project/$uimage\0" \
188         "settftpfiledtb=env set tftpfiledtb $user/$project/$dtb\0"      \
189         "setubifilelinux=env set ubifilelinux boot/$uimage\0"           \
190         "setubipfiledtb=env set ubifiledtb boot/$dtb\0"                 \
191         "setmmcrootdev=env set mmcrootdev /dev/mmcblk0p$mmcrootpart\0"  \
192         "setmmcfilelinux=env set mmcfilelinux /boot/$uimage\0"          \
193         "setmmcfiledtb=env set mmcfiledtb /boot/$dtb\0"                 \
194         \
195         "loadtftpkernel=dhcp $memaddrlinux $tftpfilelinux\0"            \
196         "loadtftpdtb=dhcp $memaddrdtb $tftpfiledtb\0"                   \
197         "loadubikernel=ubifsload $memaddrlinux $ubifilelinux\0"         \
198         "loadubidtb=ubifsload $memaddrdtb $ubifiledtb\0"                \
199         "loadmmckernel=${mmcfs}load mmc 0:$mmcrootpart $memaddrlinux "  \
200                 "$mmcfilelinux\0"                                       \
201         "loadmmcdtb=${mmcfs}load mmc 0:$mmcrootpart $memaddrdtb "       \
202                 "$mmcfiledtb\0"                                         \
203         \
204         "ubipart=ubi part $ubipartition\0"                              \
205         "ubimount=ubifsmount $ubirfs\0"                                 \
206         \
207         "setbootargscommon=env set bootargs $bootargs "                 \
208                 "console=$console,$baudrate enable_wait_mode=off\0"     \
209         "setbootargsmtd=env set bootargs $bootargs $mtdparts\0"         \
210         "setbootargsdhcp=env set bootargs $bootargs ip=dhcp\0"          \
211         "setbootargsubirfs=env set bootargs $bootargs "                 \
212                 "ubi.mtd=$ubipartition root=$ubirfs rootfstype=ubifs\0" \
213         "setbootargsnfsrfs=env set bootargs $bootargs root=/dev/nfs "   \
214                 "nfsroot=$serverip:$nfspath,v3,tcp\0"                   \
215         "setbootargsmmcrfs=env set bootargs $bootargs "                 \
216                 "root=$mmcrootdev rootwait rw\0"                        \
217         \
218         "bootnet=run settftpfilelinux settftpfiledtb setnfspath "       \
219                 "setbootargscommon setbootargsmtd setbootargsdhcp "     \
220                         "setbootargsnfsrfs;"                            \
221                         "run loadtftpkernel loadtftpdtb;"               \
222                         "bootm $memaddrlinux - $memaddrdtb\0"           \
223         "bootnet_ubirfs=run settftpfilelinux settftpfiledtb;"           \
224                         "run setubipartition setubirfs;"                \
225                         "run setbootargscommon setbootargsmtd "         \
226                                 "setbootargsubirfs;"                    \
227                         "run loadtftpkernel loadtftpdtb;"               \
228                         "bootm $memaddrlinux - $memaddrdtb\0"           \
229         "bootubi=run setubipartition setubirfs setubifilelinux "        \
230                                 "setubipfiledtb;"                       \
231                         "run setbootargscommon setbootargsmtd "         \
232                                 "setbootargsubirfs;"                    \
233                         "run ubipart ubimount loadubikernel loadubidtb;" \
234                         "bootm $memaddrlinux - $memaddrdtb\0"           \
235         "bootubi_scr=run setubipartition setubirfs;"                    \
236                         "run ubipart ubimount;"                         \
237                         "if ubifsload ${memaddrsrc} boot/${boot_scr}; " \
238                         "then source ${memaddrsrc}; else run bootubi; fi\0" \
239         "bootmmc=run setmmcrootdev setmmcfilelinux setmmcfiledtb "      \
240                         "setbootargscommon setbootargsmmcrfs;"          \
241                         "run loadmmckernel loadmmcdtb;"                 \
242                         "bootm $memaddrlinux - $memaddrdtb\0"           \
243         \
244         "bootcmd="CONFIG_BOOTCOMMAND"\0"
245
246 #define CONFIG_COMMON_ENV_SETTINGS                      CONFIG_COMMON_ENV_MISC \
247                                                         CONFIG_COMMON_ENV_UBI
248 #endif /* __PLATINUM_CONFIG_H__ */