Commit fc843a02acad62e231a3e779cebd1712688146fc

Authored by Simon Glass
Committed by Tom Rini
1 parent 75eb9976b7

Kconfig: Add a CONFIG_IDE option

At present IDE support is controlled by CONFIG_CMD_IDE. Add a separate
CONFIG_IDE option so that IDE support can be enabled without requiring
the 'ide' command.

Update existing users and move the ide driver into drivers/block since
it should not be in common/.

Signed-off-by: Simon Glass <sjg@chromium.org>

Showing 38 changed files with 1291 additions and 1284 deletions Inline Diff

1 # 1 #
2 # (C) Copyright 2000 - 2013 2 # (C) Copyright 2000 - 2013
3 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. 3 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 # 4 #
5 # SPDX-License-Identifier: GPL-2.0+ 5 # SPDX-License-Identifier: GPL-2.0+
6 # 6 #
7 7
8 Summary: 8 Summary:
9 ======== 9 ========
10 10
11 This directory contains the source code for U-Boot, a boot loader for 11 This directory contains the source code for U-Boot, a boot loader for
12 Embedded boards based on PowerPC, ARM, MIPS and several other 12 Embedded boards based on PowerPC, ARM, MIPS and several other
13 processors, which can be installed in a boot ROM and used to 13 processors, which can be installed in a boot ROM and used to
14 initialize and test the hardware or to download and run application 14 initialize and test the hardware or to download and run application
15 code. 15 code.
16 16
17 The development of U-Boot is closely related to Linux: some parts of 17 The development of U-Boot is closely related to Linux: some parts of
18 the source code originate in the Linux source tree, we have some 18 the source code originate in the Linux source tree, we have some
19 header files in common, and special provision has been made to 19 header files in common, and special provision has been made to
20 support booting of Linux images. 20 support booting of Linux images.
21 21
22 Some attention has been paid to make this software easily 22 Some attention has been paid to make this software easily
23 configurable and extendable. For instance, all monitor commands are 23 configurable and extendable. For instance, all monitor commands are
24 implemented with the same call interface, so that it's very easy to 24 implemented with the same call interface, so that it's very easy to
25 add new commands. Also, instead of permanently adding rarely used 25 add new commands. Also, instead of permanently adding rarely used
26 code (for instance hardware test utilities) to the monitor, you can 26 code (for instance hardware test utilities) to the monitor, you can
27 load and run it dynamically. 27 load and run it dynamically.
28 28
29 29
30 Status: 30 Status:
31 ======= 31 =======
32 32
33 In general, all boards for which a configuration option exists in the 33 In general, all boards for which a configuration option exists in the
34 Makefile have been tested to some extent and can be considered 34 Makefile have been tested to some extent and can be considered
35 "working". In fact, many of them are used in production systems. 35 "working". In fact, many of them are used in production systems.
36 36
37 In case of problems see the CHANGELOG file to find out who contributed 37 In case of problems see the CHANGELOG file to find out who contributed
38 the specific port. In addition, there are various MAINTAINERS files 38 the specific port. In addition, there are various MAINTAINERS files
39 scattered throughout the U-Boot source identifying the people or 39 scattered throughout the U-Boot source identifying the people or
40 companies responsible for various boards and subsystems. 40 companies responsible for various boards and subsystems.
41 41
42 Note: As of August, 2010, there is no longer a CHANGELOG file in the 42 Note: As of August, 2010, there is no longer a CHANGELOG file in the
43 actual U-Boot source tree; however, it can be created dynamically 43 actual U-Boot source tree; however, it can be created dynamically
44 from the Git log using: 44 from the Git log using:
45 45
46 make CHANGELOG 46 make CHANGELOG
47 47
48 48
49 Where to get help: 49 Where to get help:
50 ================== 50 ==================
51 51
52 In case you have questions about, problems with or contributions for 52 In case you have questions about, problems with or contributions for
53 U-Boot, you should send a message to the U-Boot mailing list at 53 U-Boot, you should send a message to the U-Boot mailing list at
54 <u-boot@lists.denx.de>. There is also an archive of previous traffic 54 <u-boot@lists.denx.de>. There is also an archive of previous traffic
55 on the mailing list - please search the archive before asking FAQ's. 55 on the mailing list - please search the archive before asking FAQ's.
56 Please see http://lists.denx.de/pipermail/u-boot and 56 Please see http://lists.denx.de/pipermail/u-boot and
57 http://dir.gmane.org/gmane.comp.boot-loaders.u-boot 57 http://dir.gmane.org/gmane.comp.boot-loaders.u-boot
58 58
59 59
60 Where to get source code: 60 Where to get source code:
61 ========================= 61 =========================
62 62
63 The U-Boot source code is maintained in the Git repository at 63 The U-Boot source code is maintained in the Git repository at
64 git://www.denx.de/git/u-boot.git ; you can browse it online at 64 git://www.denx.de/git/u-boot.git ; you can browse it online at
65 http://www.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=summary 65 http://www.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=summary
66 66
67 The "snapshot" links on this page allow you to download tarballs of 67 The "snapshot" links on this page allow you to download tarballs of
68 any version you might be interested in. Official releases are also 68 any version you might be interested in. Official releases are also
69 available for FTP download from the ftp://ftp.denx.de/pub/u-boot/ 69 available for FTP download from the ftp://ftp.denx.de/pub/u-boot/
70 directory. 70 directory.
71 71
72 Pre-built (and tested) images are available from 72 Pre-built (and tested) images are available from
73 ftp://ftp.denx.de/pub/u-boot/images/ 73 ftp://ftp.denx.de/pub/u-boot/images/
74 74
75 75
76 Where we come from: 76 Where we come from:
77 =================== 77 ===================
78 78
79 - start from 8xxrom sources 79 - start from 8xxrom sources
80 - create PPCBoot project (http://sourceforge.net/projects/ppcboot) 80 - create PPCBoot project (http://sourceforge.net/projects/ppcboot)
81 - clean up code 81 - clean up code
82 - make it easier to add custom boards 82 - make it easier to add custom boards
83 - make it possible to add other [PowerPC] CPUs 83 - make it possible to add other [PowerPC] CPUs
84 - extend functions, especially: 84 - extend functions, especially:
85 * Provide extended interface to Linux boot loader 85 * Provide extended interface to Linux boot loader
86 * S-Record download 86 * S-Record download
87 * network boot 87 * network boot
88 * PCMCIA / CompactFlash / ATA disk / SCSI ... boot 88 * PCMCIA / CompactFlash / ATA disk / SCSI ... boot
89 - create ARMBoot project (http://sourceforge.net/projects/armboot) 89 - create ARMBoot project (http://sourceforge.net/projects/armboot)
90 - add other CPU families (starting with ARM) 90 - add other CPU families (starting with ARM)
91 - create U-Boot project (http://sourceforge.net/projects/u-boot) 91 - create U-Boot project (http://sourceforge.net/projects/u-boot)
92 - current project page: see http://www.denx.de/wiki/U-Boot 92 - current project page: see http://www.denx.de/wiki/U-Boot
93 93
94 94
95 Names and Spelling: 95 Names and Spelling:
96 =================== 96 ===================
97 97
98 The "official" name of this project is "Das U-Boot". The spelling 98 The "official" name of this project is "Das U-Boot". The spelling
99 "U-Boot" shall be used in all written text (documentation, comments 99 "U-Boot" shall be used in all written text (documentation, comments
100 in source files etc.). Example: 100 in source files etc.). Example:
101 101
102 This is the README file for the U-Boot project. 102 This is the README file for the U-Boot project.
103 103
104 File names etc. shall be based on the string "u-boot". Examples: 104 File names etc. shall be based on the string "u-boot". Examples:
105 105
106 include/asm-ppc/u-boot.h 106 include/asm-ppc/u-boot.h
107 107
108 #include <asm/u-boot.h> 108 #include <asm/u-boot.h>
109 109
110 Variable names, preprocessor constants etc. shall be either based on 110 Variable names, preprocessor constants etc. shall be either based on
111 the string "u_boot" or on "U_BOOT". Example: 111 the string "u_boot" or on "U_BOOT". Example:
112 112
113 U_BOOT_VERSION u_boot_logo 113 U_BOOT_VERSION u_boot_logo
114 IH_OS_U_BOOT u_boot_hush_start 114 IH_OS_U_BOOT u_boot_hush_start
115 115
116 116
117 Versioning: 117 Versioning:
118 =========== 118 ===========
119 119
120 Starting with the release in October 2008, the names of the releases 120 Starting with the release in October 2008, the names of the releases
121 were changed from numerical release numbers without deeper meaning 121 were changed from numerical release numbers without deeper meaning
122 into a time stamp based numbering. Regular releases are identified by 122 into a time stamp based numbering. Regular releases are identified by
123 names consisting of the calendar year and month of the release date. 123 names consisting of the calendar year and month of the release date.
124 Additional fields (if present) indicate release candidates or bug fix 124 Additional fields (if present) indicate release candidates or bug fix
125 releases in "stable" maintenance trees. 125 releases in "stable" maintenance trees.
126 126
127 Examples: 127 Examples:
128 U-Boot v2009.11 - Release November 2009 128 U-Boot v2009.11 - Release November 2009
129 U-Boot v2009.11.1 - Release 1 in version November 2009 stable tree 129 U-Boot v2009.11.1 - Release 1 in version November 2009 stable tree
130 U-Boot v2010.09-rc1 - Release candidate 1 for September 2010 release 130 U-Boot v2010.09-rc1 - Release candidate 1 for September 2010 release
131 131
132 132
133 Directory Hierarchy: 133 Directory Hierarchy:
134 ==================== 134 ====================
135 135
136 /arch Architecture specific files 136 /arch Architecture specific files
137 /arc Files generic to ARC architecture 137 /arc Files generic to ARC architecture
138 /arm Files generic to ARM architecture 138 /arm Files generic to ARM architecture
139 /avr32 Files generic to AVR32 architecture 139 /avr32 Files generic to AVR32 architecture
140 /m68k Files generic to m68k architecture 140 /m68k Files generic to m68k architecture
141 /microblaze Files generic to microblaze architecture 141 /microblaze Files generic to microblaze architecture
142 /mips Files generic to MIPS architecture 142 /mips Files generic to MIPS architecture
143 /nds32 Files generic to NDS32 architecture 143 /nds32 Files generic to NDS32 architecture
144 /nios2 Files generic to Altera NIOS2 architecture 144 /nios2 Files generic to Altera NIOS2 architecture
145 /openrisc Files generic to OpenRISC architecture 145 /openrisc Files generic to OpenRISC architecture
146 /powerpc Files generic to PowerPC architecture 146 /powerpc Files generic to PowerPC architecture
147 /sandbox Files generic to HW-independent "sandbox" 147 /sandbox Files generic to HW-independent "sandbox"
148 /sh Files generic to SH architecture 148 /sh Files generic to SH architecture
149 /x86 Files generic to x86 architecture 149 /x86 Files generic to x86 architecture
150 /api Machine/arch independent API for external apps 150 /api Machine/arch independent API for external apps
151 /board Board dependent files 151 /board Board dependent files
152 /cmd U-Boot commands functions 152 /cmd U-Boot commands functions
153 /common Misc architecture independent functions 153 /common Misc architecture independent functions
154 /configs Board default configuration files 154 /configs Board default configuration files
155 /disk Code for disk drive partition handling 155 /disk Code for disk drive partition handling
156 /doc Documentation (don't expect too much) 156 /doc Documentation (don't expect too much)
157 /drivers Commonly used device drivers 157 /drivers Commonly used device drivers
158 /dts Contains Makefile for building internal U-Boot fdt. 158 /dts Contains Makefile for building internal U-Boot fdt.
159 /examples Example code for standalone applications, etc. 159 /examples Example code for standalone applications, etc.
160 /fs Filesystem code (cramfs, ext2, jffs2, etc.) 160 /fs Filesystem code (cramfs, ext2, jffs2, etc.)
161 /include Header Files 161 /include Header Files
162 /lib Library routines generic to all architectures 162 /lib Library routines generic to all architectures
163 /Licenses Various license files 163 /Licenses Various license files
164 /net Networking code 164 /net Networking code
165 /post Power On Self Test 165 /post Power On Self Test
166 /scripts Various build scripts and Makefiles 166 /scripts Various build scripts and Makefiles
167 /test Various unit test files 167 /test Various unit test files
168 /tools Tools to build S-Record or U-Boot images, etc. 168 /tools Tools to build S-Record or U-Boot images, etc.
169 169
170 Software Configuration: 170 Software Configuration:
171 ======================= 171 =======================
172 172
173 Configuration is usually done using C preprocessor defines; the 173 Configuration is usually done using C preprocessor defines; the
174 rationale behind that is to avoid dead code whenever possible. 174 rationale behind that is to avoid dead code whenever possible.
175 175
176 There are two classes of configuration variables: 176 There are two classes of configuration variables:
177 177
178 * Configuration _OPTIONS_: 178 * Configuration _OPTIONS_:
179 These are selectable by the user and have names beginning with 179 These are selectable by the user and have names beginning with
180 "CONFIG_". 180 "CONFIG_".
181 181
182 * Configuration _SETTINGS_: 182 * Configuration _SETTINGS_:
183 These depend on the hardware etc. and should not be meddled with if 183 These depend on the hardware etc. and should not be meddled with if
184 you don't know what you're doing; they have names beginning with 184 you don't know what you're doing; they have names beginning with
185 "CONFIG_SYS_". 185 "CONFIG_SYS_".
186 186
187 Previously, all configuration was done by hand, which involved creating 187 Previously, all configuration was done by hand, which involved creating
188 symbolic links and editing configuration files manually. More recently, 188 symbolic links and editing configuration files manually. More recently,
189 U-Boot has added the Kbuild infrastructure used by the Linux kernel, 189 U-Boot has added the Kbuild infrastructure used by the Linux kernel,
190 allowing you to use the "make menuconfig" command to configure your 190 allowing you to use the "make menuconfig" command to configure your
191 build. 191 build.
192 192
193 193
194 Selection of Processor Architecture and Board Type: 194 Selection of Processor Architecture and Board Type:
195 --------------------------------------------------- 195 ---------------------------------------------------
196 196
197 For all supported boards there are ready-to-use default 197 For all supported boards there are ready-to-use default
198 configurations available; just type "make <board_name>_defconfig". 198 configurations available; just type "make <board_name>_defconfig".
199 199
200 Example: For a TQM823L module type: 200 Example: For a TQM823L module type:
201 201
202 cd u-boot 202 cd u-boot
203 make TQM823L_defconfig 203 make TQM823L_defconfig
204 204
205 Note: If you're looking for the default configuration file for a board 205 Note: If you're looking for the default configuration file for a board
206 you're sure used to be there but is now missing, check the file 206 you're sure used to be there but is now missing, check the file
207 doc/README.scrapyard for a list of no longer supported boards. 207 doc/README.scrapyard for a list of no longer supported boards.
208 208
209 Sandbox Environment: 209 Sandbox Environment:
210 -------------------- 210 --------------------
211 211
212 U-Boot can be built natively to run on a Linux host using the 'sandbox' 212 U-Boot can be built natively to run on a Linux host using the 'sandbox'
213 board. This allows feature development which is not board- or architecture- 213 board. This allows feature development which is not board- or architecture-
214 specific to be undertaken on a native platform. The sandbox is also used to 214 specific to be undertaken on a native platform. The sandbox is also used to
215 run some of U-Boot's tests. 215 run some of U-Boot's tests.
216 216
217 See board/sandbox/README.sandbox for more details. 217 See board/sandbox/README.sandbox for more details.
218 218
219 219
220 Board Initialisation Flow: 220 Board Initialisation Flow:
221 -------------------------- 221 --------------------------
222 222
223 This is the intended start-up flow for boards. This should apply for both 223 This is the intended start-up flow for boards. This should apply for both
224 SPL and U-Boot proper (i.e. they both follow the same rules). 224 SPL and U-Boot proper (i.e. they both follow the same rules).
225 225
226 Note: "SPL" stands for "Secondary Program Loader," which is explained in 226 Note: "SPL" stands for "Secondary Program Loader," which is explained in
227 more detail later in this file. 227 more detail later in this file.
228 228
229 At present, SPL mostly uses a separate code path, but the function names 229 At present, SPL mostly uses a separate code path, but the function names
230 and roles of each function are the same. Some boards or architectures 230 and roles of each function are the same. Some boards or architectures
231 may not conform to this. At least most ARM boards which use 231 may not conform to this. At least most ARM boards which use
232 CONFIG_SPL_FRAMEWORK conform to this. 232 CONFIG_SPL_FRAMEWORK conform to this.
233 233
234 Execution typically starts with an architecture-specific (and possibly 234 Execution typically starts with an architecture-specific (and possibly
235 CPU-specific) start.S file, such as: 235 CPU-specific) start.S file, such as:
236 236
237 - arch/arm/cpu/armv7/start.S 237 - arch/arm/cpu/armv7/start.S
238 - arch/powerpc/cpu/mpc83xx/start.S 238 - arch/powerpc/cpu/mpc83xx/start.S
239 - arch/mips/cpu/start.S 239 - arch/mips/cpu/start.S
240 240
241 and so on. From there, three functions are called; the purpose and 241 and so on. From there, three functions are called; the purpose and
242 limitations of each of these functions are described below. 242 limitations of each of these functions are described below.
243 243
244 lowlevel_init(): 244 lowlevel_init():
245 - purpose: essential init to permit execution to reach board_init_f() 245 - purpose: essential init to permit execution to reach board_init_f()
246 - no global_data or BSS 246 - no global_data or BSS
247 - there is no stack (ARMv7 may have one but it will soon be removed) 247 - there is no stack (ARMv7 may have one but it will soon be removed)
248 - must not set up SDRAM or use console 248 - must not set up SDRAM or use console
249 - must only do the bare minimum to allow execution to continue to 249 - must only do the bare minimum to allow execution to continue to
250 board_init_f() 250 board_init_f()
251 - this is almost never needed 251 - this is almost never needed
252 - return normally from this function 252 - return normally from this function
253 253
254 board_init_f(): 254 board_init_f():
255 - purpose: set up the machine ready for running board_init_r(): 255 - purpose: set up the machine ready for running board_init_r():
256 i.e. SDRAM and serial UART 256 i.e. SDRAM and serial UART
257 - global_data is available 257 - global_data is available
258 - stack is in SRAM 258 - stack is in SRAM
259 - BSS is not available, so you cannot use global/static variables, 259 - BSS is not available, so you cannot use global/static variables,
260 only stack variables and global_data 260 only stack variables and global_data
261 261
262 Non-SPL-specific notes: 262 Non-SPL-specific notes:
263 - dram_init() is called to set up DRAM. If already done in SPL this 263 - dram_init() is called to set up DRAM. If already done in SPL this
264 can do nothing 264 can do nothing
265 265
266 SPL-specific notes: 266 SPL-specific notes:
267 - you can override the entire board_init_f() function with your own 267 - you can override the entire board_init_f() function with your own
268 version as needed. 268 version as needed.
269 - preloader_console_init() can be called here in extremis 269 - preloader_console_init() can be called here in extremis
270 - should set up SDRAM, and anything needed to make the UART work 270 - should set up SDRAM, and anything needed to make the UART work
271 - these is no need to clear BSS, it will be done by crt0.S 271 - these is no need to clear BSS, it will be done by crt0.S
272 - must return normally from this function (don't call board_init_r() 272 - must return normally from this function (don't call board_init_r()
273 directly) 273 directly)
274 274
275 Here the BSS is cleared. For SPL, if CONFIG_SPL_STACK_R is defined, then at 275 Here the BSS is cleared. For SPL, if CONFIG_SPL_STACK_R is defined, then at
276 this point the stack and global_data are relocated to below 276 this point the stack and global_data are relocated to below
277 CONFIG_SPL_STACK_R_ADDR. For non-SPL, U-Boot is relocated to run at the top of 277 CONFIG_SPL_STACK_R_ADDR. For non-SPL, U-Boot is relocated to run at the top of
278 memory. 278 memory.
279 279
280 board_init_r(): 280 board_init_r():
281 - purpose: main execution, common code 281 - purpose: main execution, common code
282 - global_data is available 282 - global_data is available
283 - SDRAM is available 283 - SDRAM is available
284 - BSS is available, all static/global variables can be used 284 - BSS is available, all static/global variables can be used
285 - execution eventually continues to main_loop() 285 - execution eventually continues to main_loop()
286 286
287 Non-SPL-specific notes: 287 Non-SPL-specific notes:
288 - U-Boot is relocated to the top of memory and is now running from 288 - U-Boot is relocated to the top of memory and is now running from
289 there. 289 there.
290 290
291 SPL-specific notes: 291 SPL-specific notes:
292 - stack is optionally in SDRAM, if CONFIG_SPL_STACK_R is defined and 292 - stack is optionally in SDRAM, if CONFIG_SPL_STACK_R is defined and
293 CONFIG_SPL_STACK_R_ADDR points into SDRAM 293 CONFIG_SPL_STACK_R_ADDR points into SDRAM
294 - preloader_console_init() can be called here - typically this is 294 - preloader_console_init() can be called here - typically this is
295 done by selecting CONFIG_SPL_BOARD_INIT and then supplying a 295 done by selecting CONFIG_SPL_BOARD_INIT and then supplying a
296 spl_board_init() function containing this call 296 spl_board_init() function containing this call
297 - loads U-Boot or (in falcon mode) Linux 297 - loads U-Boot or (in falcon mode) Linux
298 298
299 299
300 300
301 Configuration Options: 301 Configuration Options:
302 ---------------------- 302 ----------------------
303 303
304 Configuration depends on the combination of board and CPU type; all 304 Configuration depends on the combination of board and CPU type; all
305 such information is kept in a configuration file 305 such information is kept in a configuration file
306 "include/configs/<board_name>.h". 306 "include/configs/<board_name>.h".
307 307
308 Example: For a TQM823L module, all configuration settings are in 308 Example: For a TQM823L module, all configuration settings are in
309 "include/configs/TQM823L.h". 309 "include/configs/TQM823L.h".
310 310
311 311
312 Many of the options are named exactly as the corresponding Linux 312 Many of the options are named exactly as the corresponding Linux
313 kernel configuration options. The intention is to make it easier to 313 kernel configuration options. The intention is to make it easier to
314 build a config tool - later. 314 build a config tool - later.
315 315
316 316
317 The following options need to be configured: 317 The following options need to be configured:
318 318
319 - CPU Type: Define exactly one, e.g. CONFIG_MPC85XX. 319 - CPU Type: Define exactly one, e.g. CONFIG_MPC85XX.
320 320
321 - Board Type: Define exactly one, e.g. CONFIG_MPC8540ADS. 321 - Board Type: Define exactly one, e.g. CONFIG_MPC8540ADS.
322 322
323 - CPU Daughterboard Type: (if CONFIG_ATSTK1000 is defined) 323 - CPU Daughterboard Type: (if CONFIG_ATSTK1000 is defined)
324 Define exactly one, e.g. CONFIG_ATSTK1002 324 Define exactly one, e.g. CONFIG_ATSTK1002
325 325
326 - Marvell Family Member 326 - Marvell Family Member
327 CONFIG_SYS_MVFS - define it if you want to enable 327 CONFIG_SYS_MVFS - define it if you want to enable
328 multiple fs option at one time 328 multiple fs option at one time
329 for marvell soc family 329 for marvell soc family
330 330
331 - 8xx CPU Options: (if using an MPC8xx CPU) 331 - 8xx CPU Options: (if using an MPC8xx CPU)
332 CONFIG_8xx_GCLK_FREQ - deprecated: CPU clock if 332 CONFIG_8xx_GCLK_FREQ - deprecated: CPU clock if
333 get_gclk_freq() cannot work 333 get_gclk_freq() cannot work
334 e.g. if there is no 32KHz 334 e.g. if there is no 32KHz
335 reference PIT/RTC clock 335 reference PIT/RTC clock
336 CONFIG_8xx_OSCLK - PLL input clock (either EXTCLK 336 CONFIG_8xx_OSCLK - PLL input clock (either EXTCLK
337 or XTAL/EXTAL) 337 or XTAL/EXTAL)
338 338
339 - 859/866/885 CPU options: (if using a MPC859 or MPC866 or MPC885 CPU): 339 - 859/866/885 CPU options: (if using a MPC859 or MPC866 or MPC885 CPU):
340 CONFIG_SYS_8xx_CPUCLK_MIN 340 CONFIG_SYS_8xx_CPUCLK_MIN
341 CONFIG_SYS_8xx_CPUCLK_MAX 341 CONFIG_SYS_8xx_CPUCLK_MAX
342 CONFIG_8xx_CPUCLK_DEFAULT 342 CONFIG_8xx_CPUCLK_DEFAULT
343 See doc/README.MPC866 343 See doc/README.MPC866
344 344
345 CONFIG_SYS_MEASURE_CPUCLK 345 CONFIG_SYS_MEASURE_CPUCLK
346 346
347 Define this to measure the actual CPU clock instead 347 Define this to measure the actual CPU clock instead
348 of relying on the correctness of the configured 348 of relying on the correctness of the configured
349 values. Mostly useful for board bringup to make sure 349 values. Mostly useful for board bringup to make sure
350 the PLL is locked at the intended frequency. Note 350 the PLL is locked at the intended frequency. Note
351 that this requires a (stable) reference clock (32 kHz 351 that this requires a (stable) reference clock (32 kHz
352 RTC clock or CONFIG_SYS_8XX_XIN) 352 RTC clock or CONFIG_SYS_8XX_XIN)
353 353
354 CONFIG_SYS_DELAYED_ICACHE 354 CONFIG_SYS_DELAYED_ICACHE
355 355
356 Define this option if you want to enable the 356 Define this option if you want to enable the
357 ICache only when Code runs from RAM. 357 ICache only when Code runs from RAM.
358 358
359 - 85xx CPU Options: 359 - 85xx CPU Options:
360 CONFIG_SYS_PPC64 360 CONFIG_SYS_PPC64
361 361
362 Specifies that the core is a 64-bit PowerPC implementation (implements 362 Specifies that the core is a 64-bit PowerPC implementation (implements
363 the "64" category of the Power ISA). This is necessary for ePAPR 363 the "64" category of the Power ISA). This is necessary for ePAPR
364 compliance, among other possible reasons. 364 compliance, among other possible reasons.
365 365
366 CONFIG_SYS_FSL_TBCLK_DIV 366 CONFIG_SYS_FSL_TBCLK_DIV
367 367
368 Defines the core time base clock divider ratio compared to the 368 Defines the core time base clock divider ratio compared to the
369 system clock. On most PQ3 devices this is 8, on newer QorIQ 369 system clock. On most PQ3 devices this is 8, on newer QorIQ
370 devices it can be 16 or 32. The ratio varies from SoC to Soc. 370 devices it can be 16 or 32. The ratio varies from SoC to Soc.
371 371
372 CONFIG_SYS_FSL_PCIE_COMPAT 372 CONFIG_SYS_FSL_PCIE_COMPAT
373 373
374 Defines the string to utilize when trying to match PCIe device 374 Defines the string to utilize when trying to match PCIe device
375 tree nodes for the given platform. 375 tree nodes for the given platform.
376 376
377 CONFIG_SYS_FSL_ERRATUM_A004510 377 CONFIG_SYS_FSL_ERRATUM_A004510
378 378
379 Enables a workaround for erratum A004510. If set, 379 Enables a workaround for erratum A004510. If set,
380 then CONFIG_SYS_FSL_ERRATUM_A004510_SVR_REV and 380 then CONFIG_SYS_FSL_ERRATUM_A004510_SVR_REV and
381 CONFIG_SYS_FSL_CORENET_SNOOPVEC_COREONLY must be set. 381 CONFIG_SYS_FSL_CORENET_SNOOPVEC_COREONLY must be set.
382 382
383 CONFIG_SYS_FSL_ERRATUM_A004510_SVR_REV 383 CONFIG_SYS_FSL_ERRATUM_A004510_SVR_REV
384 CONFIG_SYS_FSL_ERRATUM_A004510_SVR_REV2 (optional) 384 CONFIG_SYS_FSL_ERRATUM_A004510_SVR_REV2 (optional)
385 385
386 Defines one or two SoC revisions (low 8 bits of SVR) 386 Defines one or two SoC revisions (low 8 bits of SVR)
387 for which the A004510 workaround should be applied. 387 for which the A004510 workaround should be applied.
388 388
389 The rest of SVR is either not relevant to the decision 389 The rest of SVR is either not relevant to the decision
390 of whether the erratum is present (e.g. p2040 versus 390 of whether the erratum is present (e.g. p2040 versus
391 p2041) or is implied by the build target, which controls 391 p2041) or is implied by the build target, which controls
392 whether CONFIG_SYS_FSL_ERRATUM_A004510 is set. 392 whether CONFIG_SYS_FSL_ERRATUM_A004510 is set.
393 393
394 See Freescale App Note 4493 for more information about 394 See Freescale App Note 4493 for more information about
395 this erratum. 395 this erratum.
396 396
397 CONFIG_A003399_NOR_WORKAROUND 397 CONFIG_A003399_NOR_WORKAROUND
398 Enables a workaround for IFC erratum A003399. It is only 398 Enables a workaround for IFC erratum A003399. It is only
399 required during NOR boot. 399 required during NOR boot.
400 400
401 CONFIG_A008044_WORKAROUND 401 CONFIG_A008044_WORKAROUND
402 Enables a workaround for T1040/T1042 erratum A008044. It is only 402 Enables a workaround for T1040/T1042 erratum A008044. It is only
403 required during NAND boot and valid for Rev 1.0 SoC revision 403 required during NAND boot and valid for Rev 1.0 SoC revision
404 404
405 CONFIG_SYS_FSL_CORENET_SNOOPVEC_COREONLY 405 CONFIG_SYS_FSL_CORENET_SNOOPVEC_COREONLY
406 406
407 This is the value to write into CCSR offset 0x18600 407 This is the value to write into CCSR offset 0x18600
408 according to the A004510 workaround. 408 according to the A004510 workaround.
409 409
410 CONFIG_SYS_FSL_DSP_DDR_ADDR 410 CONFIG_SYS_FSL_DSP_DDR_ADDR
411 This value denotes start offset of DDR memory which is 411 This value denotes start offset of DDR memory which is
412 connected exclusively to the DSP cores. 412 connected exclusively to the DSP cores.
413 413
414 CONFIG_SYS_FSL_DSP_M2_RAM_ADDR 414 CONFIG_SYS_FSL_DSP_M2_RAM_ADDR
415 This value denotes start offset of M2 memory 415 This value denotes start offset of M2 memory
416 which is directly connected to the DSP core. 416 which is directly connected to the DSP core.
417 417
418 CONFIG_SYS_FSL_DSP_M3_RAM_ADDR 418 CONFIG_SYS_FSL_DSP_M3_RAM_ADDR
419 This value denotes start offset of M3 memory which is directly 419 This value denotes start offset of M3 memory which is directly
420 connected to the DSP core. 420 connected to the DSP core.
421 421
422 CONFIG_SYS_FSL_DSP_CCSRBAR_DEFAULT 422 CONFIG_SYS_FSL_DSP_CCSRBAR_DEFAULT
423 This value denotes start offset of DSP CCSR space. 423 This value denotes start offset of DSP CCSR space.
424 424
425 CONFIG_SYS_FSL_SINGLE_SOURCE_CLK 425 CONFIG_SYS_FSL_SINGLE_SOURCE_CLK
426 Single Source Clock is clocking mode present in some of FSL SoC's. 426 Single Source Clock is clocking mode present in some of FSL SoC's.
427 In this mode, a single differential clock is used to supply 427 In this mode, a single differential clock is used to supply
428 clocks to the sysclock, ddrclock and usbclock. 428 clocks to the sysclock, ddrclock and usbclock.
429 429
430 CONFIG_SYS_CPC_REINIT_F 430 CONFIG_SYS_CPC_REINIT_F
431 This CONFIG is defined when the CPC is configured as SRAM at the 431 This CONFIG is defined when the CPC is configured as SRAM at the
432 time of U-Boot entry and is required to be re-initialized. 432 time of U-Boot entry and is required to be re-initialized.
433 433
434 CONFIG_DEEP_SLEEP 434 CONFIG_DEEP_SLEEP
435 Indicates this SoC supports deep sleep feature. If deep sleep is 435 Indicates this SoC supports deep sleep feature. If deep sleep is
436 supported, core will start to execute uboot when wakes up. 436 supported, core will start to execute uboot when wakes up.
437 437
438 - Generic CPU options: 438 - Generic CPU options:
439 CONFIG_SYS_GENERIC_GLOBAL_DATA 439 CONFIG_SYS_GENERIC_GLOBAL_DATA
440 Defines global data is initialized in generic board board_init_f(). 440 Defines global data is initialized in generic board board_init_f().
441 If this macro is defined, global data is created and cleared in 441 If this macro is defined, global data is created and cleared in
442 generic board board_init_f(). Without this macro, architecture/board 442 generic board board_init_f(). Without this macro, architecture/board
443 should initialize global data before calling board_init_f(). 443 should initialize global data before calling board_init_f().
444 444
445 CONFIG_SYS_BIG_ENDIAN, CONFIG_SYS_LITTLE_ENDIAN 445 CONFIG_SYS_BIG_ENDIAN, CONFIG_SYS_LITTLE_ENDIAN
446 446
447 Defines the endianess of the CPU. Implementation of those 447 Defines the endianess of the CPU. Implementation of those
448 values is arch specific. 448 values is arch specific.
449 449
450 CONFIG_SYS_FSL_DDR 450 CONFIG_SYS_FSL_DDR
451 Freescale DDR driver in use. This type of DDR controller is 451 Freescale DDR driver in use. This type of DDR controller is
452 found in mpc83xx, mpc85xx, mpc86xx as well as some ARM core 452 found in mpc83xx, mpc85xx, mpc86xx as well as some ARM core
453 SoCs. 453 SoCs.
454 454
455 CONFIG_SYS_FSL_DDR_ADDR 455 CONFIG_SYS_FSL_DDR_ADDR
456 Freescale DDR memory-mapped register base. 456 Freescale DDR memory-mapped register base.
457 457
458 CONFIG_SYS_FSL_DDR_EMU 458 CONFIG_SYS_FSL_DDR_EMU
459 Specify emulator support for DDR. Some DDR features such as 459 Specify emulator support for DDR. Some DDR features such as
460 deskew training are not available. 460 deskew training are not available.
461 461
462 CONFIG_SYS_FSL_DDRC_GEN1 462 CONFIG_SYS_FSL_DDRC_GEN1
463 Freescale DDR1 controller. 463 Freescale DDR1 controller.
464 464
465 CONFIG_SYS_FSL_DDRC_GEN2 465 CONFIG_SYS_FSL_DDRC_GEN2
466 Freescale DDR2 controller. 466 Freescale DDR2 controller.
467 467
468 CONFIG_SYS_FSL_DDRC_GEN3 468 CONFIG_SYS_FSL_DDRC_GEN3
469 Freescale DDR3 controller. 469 Freescale DDR3 controller.
470 470
471 CONFIG_SYS_FSL_DDRC_GEN4 471 CONFIG_SYS_FSL_DDRC_GEN4
472 Freescale DDR4 controller. 472 Freescale DDR4 controller.
473 473
474 CONFIG_SYS_FSL_DDRC_ARM_GEN3 474 CONFIG_SYS_FSL_DDRC_ARM_GEN3
475 Freescale DDR3 controller for ARM-based SoCs. 475 Freescale DDR3 controller for ARM-based SoCs.
476 476
477 CONFIG_SYS_FSL_DDR1 477 CONFIG_SYS_FSL_DDR1
478 Board config to use DDR1. It can be enabled for SoCs with 478 Board config to use DDR1. It can be enabled for SoCs with
479 Freescale DDR1 or DDR2 controllers, depending on the board 479 Freescale DDR1 or DDR2 controllers, depending on the board
480 implemetation. 480 implemetation.
481 481
482 CONFIG_SYS_FSL_DDR2 482 CONFIG_SYS_FSL_DDR2
483 Board config to use DDR2. It can be enabled for SoCs with 483 Board config to use DDR2. It can be enabled for SoCs with
484 Freescale DDR2 or DDR3 controllers, depending on the board 484 Freescale DDR2 or DDR3 controllers, depending on the board
485 implementation. 485 implementation.
486 486
487 CONFIG_SYS_FSL_DDR3 487 CONFIG_SYS_FSL_DDR3
488 Board config to use DDR3. It can be enabled for SoCs with 488 Board config to use DDR3. It can be enabled for SoCs with
489 Freescale DDR3 or DDR3L controllers. 489 Freescale DDR3 or DDR3L controllers.
490 490
491 CONFIG_SYS_FSL_DDR3L 491 CONFIG_SYS_FSL_DDR3L
492 Board config to use DDR3L. It can be enabled for SoCs with 492 Board config to use DDR3L. It can be enabled for SoCs with
493 DDR3L controllers. 493 DDR3L controllers.
494 494
495 CONFIG_SYS_FSL_DDR4 495 CONFIG_SYS_FSL_DDR4
496 Board config to use DDR4. It can be enabled for SoCs with 496 Board config to use DDR4. It can be enabled for SoCs with
497 DDR4 controllers. 497 DDR4 controllers.
498 498
499 CONFIG_SYS_FSL_IFC_BE 499 CONFIG_SYS_FSL_IFC_BE
500 Defines the IFC controller register space as Big Endian 500 Defines the IFC controller register space as Big Endian
501 501
502 CONFIG_SYS_FSL_IFC_LE 502 CONFIG_SYS_FSL_IFC_LE
503 Defines the IFC controller register space as Little Endian 503 Defines the IFC controller register space as Little Endian
504 504
505 CONFIG_SYS_FSL_IFC_CLK_DIV 505 CONFIG_SYS_FSL_IFC_CLK_DIV
506 Defines divider of platform clock(clock input to IFC controller). 506 Defines divider of platform clock(clock input to IFC controller).
507 507
508 CONFIG_SYS_FSL_LBC_CLK_DIV 508 CONFIG_SYS_FSL_LBC_CLK_DIV
509 Defines divider of platform clock(clock input to eLBC controller). 509 Defines divider of platform clock(clock input to eLBC controller).
510 510
511 CONFIG_SYS_FSL_PBL_PBI 511 CONFIG_SYS_FSL_PBL_PBI
512 It enables addition of RCW (Power on reset configuration) in built image. 512 It enables addition of RCW (Power on reset configuration) in built image.
513 Please refer doc/README.pblimage for more details 513 Please refer doc/README.pblimage for more details
514 514
515 CONFIG_SYS_FSL_PBL_RCW 515 CONFIG_SYS_FSL_PBL_RCW
516 It adds PBI(pre-boot instructions) commands in u-boot build image. 516 It adds PBI(pre-boot instructions) commands in u-boot build image.
517 PBI commands can be used to configure SoC before it starts the execution. 517 PBI commands can be used to configure SoC before it starts the execution.
518 Please refer doc/README.pblimage for more details 518 Please refer doc/README.pblimage for more details
519 519
520 CONFIG_SPL_FSL_PBL 520 CONFIG_SPL_FSL_PBL
521 It adds a target to create boot binary having SPL binary in PBI format 521 It adds a target to create boot binary having SPL binary in PBI format
522 concatenated with u-boot binary. 522 concatenated with u-boot binary.
523 523
524 CONFIG_SYS_FSL_DDR_BE 524 CONFIG_SYS_FSL_DDR_BE
525 Defines the DDR controller register space as Big Endian 525 Defines the DDR controller register space as Big Endian
526 526
527 CONFIG_SYS_FSL_DDR_LE 527 CONFIG_SYS_FSL_DDR_LE
528 Defines the DDR controller register space as Little Endian 528 Defines the DDR controller register space as Little Endian
529 529
530 CONFIG_SYS_FSL_DDR_SDRAM_BASE_PHY 530 CONFIG_SYS_FSL_DDR_SDRAM_BASE_PHY
531 Physical address from the view of DDR controllers. It is the 531 Physical address from the view of DDR controllers. It is the
532 same as CONFIG_SYS_DDR_SDRAM_BASE for all Power SoCs. But 532 same as CONFIG_SYS_DDR_SDRAM_BASE for all Power SoCs. But
533 it could be different for ARM SoCs. 533 it could be different for ARM SoCs.
534 534
535 CONFIG_SYS_FSL_DDR_INTLV_256B 535 CONFIG_SYS_FSL_DDR_INTLV_256B
536 DDR controller interleaving on 256-byte. This is a special 536 DDR controller interleaving on 256-byte. This is a special
537 interleaving mode, handled by Dickens for Freescale layerscape 537 interleaving mode, handled by Dickens for Freescale layerscape
538 SoCs with ARM core. 538 SoCs with ARM core.
539 539
540 CONFIG_SYS_FSL_DDR_MAIN_NUM_CTRLS 540 CONFIG_SYS_FSL_DDR_MAIN_NUM_CTRLS
541 Number of controllers used as main memory. 541 Number of controllers used as main memory.
542 542
543 CONFIG_SYS_FSL_OTHER_DDR_NUM_CTRLS 543 CONFIG_SYS_FSL_OTHER_DDR_NUM_CTRLS
544 Number of controllers used for other than main memory. 544 Number of controllers used for other than main memory.
545 545
546 CONFIG_SYS_FSL_HAS_DP_DDR 546 CONFIG_SYS_FSL_HAS_DP_DDR
547 Defines the SoC has DP-DDR used for DPAA. 547 Defines the SoC has DP-DDR used for DPAA.
548 548
549 CONFIG_SYS_FSL_SEC_BE 549 CONFIG_SYS_FSL_SEC_BE
550 Defines the SEC controller register space as Big Endian 550 Defines the SEC controller register space as Big Endian
551 551
552 CONFIG_SYS_FSL_SEC_LE 552 CONFIG_SYS_FSL_SEC_LE
553 Defines the SEC controller register space as Little Endian 553 Defines the SEC controller register space as Little Endian
554 554
555 - MIPS CPU options: 555 - MIPS CPU options:
556 CONFIG_SYS_INIT_SP_OFFSET 556 CONFIG_SYS_INIT_SP_OFFSET
557 557
558 Offset relative to CONFIG_SYS_SDRAM_BASE for initial stack 558 Offset relative to CONFIG_SYS_SDRAM_BASE for initial stack
559 pointer. This is needed for the temporary stack before 559 pointer. This is needed for the temporary stack before
560 relocation. 560 relocation.
561 561
562 CONFIG_SYS_MIPS_CACHE_MODE 562 CONFIG_SYS_MIPS_CACHE_MODE
563 563
564 Cache operation mode for the MIPS CPU. 564 Cache operation mode for the MIPS CPU.
565 See also arch/mips/include/asm/mipsregs.h. 565 See also arch/mips/include/asm/mipsregs.h.
566 Possible values are: 566 Possible values are:
567 CONF_CM_CACHABLE_NO_WA 567 CONF_CM_CACHABLE_NO_WA
568 CONF_CM_CACHABLE_WA 568 CONF_CM_CACHABLE_WA
569 CONF_CM_UNCACHED 569 CONF_CM_UNCACHED
570 CONF_CM_CACHABLE_NONCOHERENT 570 CONF_CM_CACHABLE_NONCOHERENT
571 CONF_CM_CACHABLE_CE 571 CONF_CM_CACHABLE_CE
572 CONF_CM_CACHABLE_COW 572 CONF_CM_CACHABLE_COW
573 CONF_CM_CACHABLE_CUW 573 CONF_CM_CACHABLE_CUW
574 CONF_CM_CACHABLE_ACCELERATED 574 CONF_CM_CACHABLE_ACCELERATED
575 575
576 CONFIG_SYS_XWAY_EBU_BOOTCFG 576 CONFIG_SYS_XWAY_EBU_BOOTCFG
577 577
578 Special option for Lantiq XWAY SoCs for booting from NOR flash. 578 Special option for Lantiq XWAY SoCs for booting from NOR flash.
579 See also arch/mips/cpu/mips32/start.S. 579 See also arch/mips/cpu/mips32/start.S.
580 580
581 CONFIG_XWAY_SWAP_BYTES 581 CONFIG_XWAY_SWAP_BYTES
582 582
583 Enable compilation of tools/xway-swap-bytes needed for Lantiq 583 Enable compilation of tools/xway-swap-bytes needed for Lantiq
584 XWAY SoCs for booting from NOR flash. The U-Boot image needs to 584 XWAY SoCs for booting from NOR flash. The U-Boot image needs to
585 be swapped if a flash programmer is used. 585 be swapped if a flash programmer is used.
586 586
587 - ARM options: 587 - ARM options:
588 CONFIG_SYS_EXCEPTION_VECTORS_HIGH 588 CONFIG_SYS_EXCEPTION_VECTORS_HIGH
589 589
590 Select high exception vectors of the ARM core, e.g., do not 590 Select high exception vectors of the ARM core, e.g., do not
591 clear the V bit of the c1 register of CP15. 591 clear the V bit of the c1 register of CP15.
592 592
593 COUNTER_FREQUENCY 593 COUNTER_FREQUENCY
594 Generic timer clock source frequency. 594 Generic timer clock source frequency.
595 595
596 COUNTER_FREQUENCY_REAL 596 COUNTER_FREQUENCY_REAL
597 Generic timer clock source frequency if the real clock is 597 Generic timer clock source frequency if the real clock is
598 different from COUNTER_FREQUENCY, and can only be determined 598 different from COUNTER_FREQUENCY, and can only be determined
599 at run time. 599 at run time.
600 600
601 - Tegra SoC options: 601 - Tegra SoC options:
602 CONFIG_TEGRA_SUPPORT_NON_SECURE 602 CONFIG_TEGRA_SUPPORT_NON_SECURE
603 603
604 Support executing U-Boot in non-secure (NS) mode. Certain 604 Support executing U-Boot in non-secure (NS) mode. Certain
605 impossible actions will be skipped if the CPU is in NS mode, 605 impossible actions will be skipped if the CPU is in NS mode,
606 such as ARM architectural timer initialization. 606 such as ARM architectural timer initialization.
607 607
608 - Linux Kernel Interface: 608 - Linux Kernel Interface:
609 CONFIG_CLOCKS_IN_MHZ 609 CONFIG_CLOCKS_IN_MHZ
610 610
611 U-Boot stores all clock information in Hz 611 U-Boot stores all clock information in Hz
612 internally. For binary compatibility with older Linux 612 internally. For binary compatibility with older Linux
613 kernels (which expect the clocks passed in the 613 kernels (which expect the clocks passed in the
614 bd_info data to be in MHz) the environment variable 614 bd_info data to be in MHz) the environment variable
615 "clocks_in_mhz" can be defined so that U-Boot 615 "clocks_in_mhz" can be defined so that U-Boot
616 converts clock data to MHZ before passing it to the 616 converts clock data to MHZ before passing it to the
617 Linux kernel. 617 Linux kernel.
618 When CONFIG_CLOCKS_IN_MHZ is defined, a definition of 618 When CONFIG_CLOCKS_IN_MHZ is defined, a definition of
619 "clocks_in_mhz=1" is automatically included in the 619 "clocks_in_mhz=1" is automatically included in the
620 default environment. 620 default environment.
621 621
622 CONFIG_MEMSIZE_IN_BYTES [relevant for MIPS only] 622 CONFIG_MEMSIZE_IN_BYTES [relevant for MIPS only]
623 623
624 When transferring memsize parameter to Linux, some versions 624 When transferring memsize parameter to Linux, some versions
625 expect it to be in bytes, others in MB. 625 expect it to be in bytes, others in MB.
626 Define CONFIG_MEMSIZE_IN_BYTES to make it in bytes. 626 Define CONFIG_MEMSIZE_IN_BYTES to make it in bytes.
627 627
628 CONFIG_OF_LIBFDT 628 CONFIG_OF_LIBFDT
629 629
630 New kernel versions are expecting firmware settings to be 630 New kernel versions are expecting firmware settings to be
631 passed using flattened device trees (based on open firmware 631 passed using flattened device trees (based on open firmware
632 concepts). 632 concepts).
633 633
634 CONFIG_OF_LIBFDT 634 CONFIG_OF_LIBFDT
635 * New libfdt-based support 635 * New libfdt-based support
636 * Adds the "fdt" command 636 * Adds the "fdt" command
637 * The bootm command automatically updates the fdt 637 * The bootm command automatically updates the fdt
638 638
639 OF_CPU - The proper name of the cpus node (only required for 639 OF_CPU - The proper name of the cpus node (only required for
640 MPC512X and MPC5xxx based boards). 640 MPC512X and MPC5xxx based boards).
641 OF_SOC - The proper name of the soc node (only required for 641 OF_SOC - The proper name of the soc node (only required for
642 MPC512X and MPC5xxx based boards). 642 MPC512X and MPC5xxx based boards).
643 OF_TBCLK - The timebase frequency. 643 OF_TBCLK - The timebase frequency.
644 OF_STDOUT_PATH - The path to the console device 644 OF_STDOUT_PATH - The path to the console device
645 645
646 boards with QUICC Engines require OF_QE to set UCC MAC 646 boards with QUICC Engines require OF_QE to set UCC MAC
647 addresses 647 addresses
648 648
649 CONFIG_OF_BOARD_SETUP 649 CONFIG_OF_BOARD_SETUP
650 650
651 Board code has addition modification that it wants to make 651 Board code has addition modification that it wants to make
652 to the flat device tree before handing it off to the kernel 652 to the flat device tree before handing it off to the kernel
653 653
654 CONFIG_OF_SYSTEM_SETUP 654 CONFIG_OF_SYSTEM_SETUP
655 655
656 Other code has addition modification that it wants to make 656 Other code has addition modification that it wants to make
657 to the flat device tree before handing it off to the kernel. 657 to the flat device tree before handing it off to the kernel.
658 This causes ft_system_setup() to be called before booting 658 This causes ft_system_setup() to be called before booting
659 the kernel. 659 the kernel.
660 660
661 CONFIG_OF_IDE_FIXUP 661 CONFIG_OF_IDE_FIXUP
662 662
663 U-Boot can detect if an IDE device is present or not. 663 U-Boot can detect if an IDE device is present or not.
664 If not, and this new config option is activated, U-Boot 664 If not, and this new config option is activated, U-Boot
665 removes the ATA node from the DTS before booting Linux, 665 removes the ATA node from the DTS before booting Linux,
666 so the Linux IDE driver does not probe the device and 666 so the Linux IDE driver does not probe the device and
667 crash. This is needed for buggy hardware (uc101) where 667 crash. This is needed for buggy hardware (uc101) where
668 no pull down resistor is connected to the signal IDE5V_DD7. 668 no pull down resistor is connected to the signal IDE5V_DD7.
669 669
670 CONFIG_MACH_TYPE [relevant for ARM only][mandatory] 670 CONFIG_MACH_TYPE [relevant for ARM only][mandatory]
671 671
672 This setting is mandatory for all boards that have only one 672 This setting is mandatory for all boards that have only one
673 machine type and must be used to specify the machine type 673 machine type and must be used to specify the machine type
674 number as it appears in the ARM machine registry 674 number as it appears in the ARM machine registry
675 (see http://www.arm.linux.org.uk/developer/machines/). 675 (see http://www.arm.linux.org.uk/developer/machines/).
676 Only boards that have multiple machine types supported 676 Only boards that have multiple machine types supported
677 in a single configuration file and the machine type is 677 in a single configuration file and the machine type is
678 runtime discoverable, do not have to use this setting. 678 runtime discoverable, do not have to use this setting.
679 679
680 - vxWorks boot parameters: 680 - vxWorks boot parameters:
681 681
682 bootvx constructs a valid bootline using the following 682 bootvx constructs a valid bootline using the following
683 environments variables: bootdev, bootfile, ipaddr, netmask, 683 environments variables: bootdev, bootfile, ipaddr, netmask,
684 serverip, gatewayip, hostname, othbootargs. 684 serverip, gatewayip, hostname, othbootargs.
685 It loads the vxWorks image pointed bootfile. 685 It loads the vxWorks image pointed bootfile.
686 686
687 Note: If a "bootargs" environment is defined, it will overwride 687 Note: If a "bootargs" environment is defined, it will overwride
688 the defaults discussed just above. 688 the defaults discussed just above.
689 689
690 - Cache Configuration: 690 - Cache Configuration:
691 CONFIG_SYS_ICACHE_OFF - Do not enable instruction cache in U-Boot 691 CONFIG_SYS_ICACHE_OFF - Do not enable instruction cache in U-Boot
692 CONFIG_SYS_DCACHE_OFF - Do not enable data cache in U-Boot 692 CONFIG_SYS_DCACHE_OFF - Do not enable data cache in U-Boot
693 CONFIG_SYS_L2CACHE_OFF- Do not enable L2 cache in U-Boot 693 CONFIG_SYS_L2CACHE_OFF- Do not enable L2 cache in U-Boot
694 694
695 - Cache Configuration for ARM: 695 - Cache Configuration for ARM:
696 CONFIG_SYS_L2_PL310 - Enable support for ARM PL310 L2 cache 696 CONFIG_SYS_L2_PL310 - Enable support for ARM PL310 L2 cache
697 controller 697 controller
698 CONFIG_SYS_PL310_BASE - Physical base address of PL310 698 CONFIG_SYS_PL310_BASE - Physical base address of PL310
699 controller register space 699 controller register space
700 700
701 - Serial Ports: 701 - Serial Ports:
702 CONFIG_PL010_SERIAL 702 CONFIG_PL010_SERIAL
703 703
704 Define this if you want support for Amba PrimeCell PL010 UARTs. 704 Define this if you want support for Amba PrimeCell PL010 UARTs.
705 705
706 CONFIG_PL011_SERIAL 706 CONFIG_PL011_SERIAL
707 707
708 Define this if you want support for Amba PrimeCell PL011 UARTs. 708 Define this if you want support for Amba PrimeCell PL011 UARTs.
709 709
710 CONFIG_PL011_CLOCK 710 CONFIG_PL011_CLOCK
711 711
712 If you have Amba PrimeCell PL011 UARTs, set this variable to 712 If you have Amba PrimeCell PL011 UARTs, set this variable to
713 the clock speed of the UARTs. 713 the clock speed of the UARTs.
714 714
715 CONFIG_PL01x_PORTS 715 CONFIG_PL01x_PORTS
716 716
717 If you have Amba PrimeCell PL010 or PL011 UARTs on your board, 717 If you have Amba PrimeCell PL010 or PL011 UARTs on your board,
718 define this to a list of base addresses for each (supported) 718 define this to a list of base addresses for each (supported)
719 port. See e.g. include/configs/versatile.h 719 port. See e.g. include/configs/versatile.h
720 720
721 CONFIG_SERIAL_HW_FLOW_CONTROL 721 CONFIG_SERIAL_HW_FLOW_CONTROL
722 722
723 Define this variable to enable hw flow control in serial driver. 723 Define this variable to enable hw flow control in serial driver.
724 Current user of this option is drivers/serial/nsl16550.c driver 724 Current user of this option is drivers/serial/nsl16550.c driver
725 725
726 - Console Interface: 726 - Console Interface:
727 Depending on board, define exactly one serial port 727 Depending on board, define exactly one serial port
728 (like CONFIG_8xx_CONS_SMC1, CONFIG_8xx_CONS_SMC2, 728 (like CONFIG_8xx_CONS_SMC1, CONFIG_8xx_CONS_SMC2,
729 CONFIG_8xx_CONS_SCC1, ...), or switch off the serial 729 CONFIG_8xx_CONS_SCC1, ...), or switch off the serial
730 console by defining CONFIG_8xx_CONS_NONE 730 console by defining CONFIG_8xx_CONS_NONE
731 731
732 Note: if CONFIG_8xx_CONS_NONE is defined, the serial 732 Note: if CONFIG_8xx_CONS_NONE is defined, the serial
733 port routines must be defined elsewhere 733 port routines must be defined elsewhere
734 (i.e. serial_init(), serial_getc(), ...) 734 (i.e. serial_init(), serial_getc(), ...)
735 735
736 - Console Baudrate: 736 - Console Baudrate:
737 CONFIG_BAUDRATE - in bps 737 CONFIG_BAUDRATE - in bps
738 Select one of the baudrates listed in 738 Select one of the baudrates listed in
739 CONFIG_SYS_BAUDRATE_TABLE, see below. 739 CONFIG_SYS_BAUDRATE_TABLE, see below.
740 CONFIG_SYS_BRGCLK_PRESCALE, baudrate prescale 740 CONFIG_SYS_BRGCLK_PRESCALE, baudrate prescale
741 741
742 - Console Rx buffer length 742 - Console Rx buffer length
743 With CONFIG_SYS_SMC_RXBUFLEN it is possible to define 743 With CONFIG_SYS_SMC_RXBUFLEN it is possible to define
744 the maximum receive buffer length for the SMC. 744 the maximum receive buffer length for the SMC.
745 This option is actual only for 82xx and 8xx possible. 745 This option is actual only for 82xx and 8xx possible.
746 If using CONFIG_SYS_SMC_RXBUFLEN also CONFIG_SYS_MAXIDLE 746 If using CONFIG_SYS_SMC_RXBUFLEN also CONFIG_SYS_MAXIDLE
747 must be defined, to setup the maximum idle timeout for 747 must be defined, to setup the maximum idle timeout for
748 the SMC. 748 the SMC.
749 749
750 - Autoboot Command: 750 - Autoboot Command:
751 CONFIG_BOOTCOMMAND 751 CONFIG_BOOTCOMMAND
752 Only needed when CONFIG_BOOTDELAY is enabled; 752 Only needed when CONFIG_BOOTDELAY is enabled;
753 define a command string that is automatically executed 753 define a command string that is automatically executed
754 when no character is read on the console interface 754 when no character is read on the console interface
755 within "Boot Delay" after reset. 755 within "Boot Delay" after reset.
756 756
757 CONFIG_BOOTARGS 757 CONFIG_BOOTARGS
758 This can be used to pass arguments to the bootm 758 This can be used to pass arguments to the bootm
759 command. The value of CONFIG_BOOTARGS goes into the 759 command. The value of CONFIG_BOOTARGS goes into the
760 environment value "bootargs". 760 environment value "bootargs".
761 761
762 CONFIG_RAMBOOT and CONFIG_NFSBOOT 762 CONFIG_RAMBOOT and CONFIG_NFSBOOT
763 The value of these goes into the environment as 763 The value of these goes into the environment as
764 "ramboot" and "nfsboot" respectively, and can be used 764 "ramboot" and "nfsboot" respectively, and can be used
765 as a convenience, when switching between booting from 765 as a convenience, when switching between booting from
766 RAM and NFS. 766 RAM and NFS.
767 767
768 - Bootcount: 768 - Bootcount:
769 CONFIG_BOOTCOUNT_LIMIT 769 CONFIG_BOOTCOUNT_LIMIT
770 Implements a mechanism for detecting a repeating reboot 770 Implements a mechanism for detecting a repeating reboot
771 cycle, see: 771 cycle, see:
772 http://www.denx.de/wiki/view/DULG/UBootBootCountLimit 772 http://www.denx.de/wiki/view/DULG/UBootBootCountLimit
773 773
774 CONFIG_BOOTCOUNT_ENV 774 CONFIG_BOOTCOUNT_ENV
775 If no softreset save registers are found on the hardware 775 If no softreset save registers are found on the hardware
776 "bootcount" is stored in the environment. To prevent a 776 "bootcount" is stored in the environment. To prevent a
777 saveenv on all reboots, the environment variable 777 saveenv on all reboots, the environment variable
778 "upgrade_available" is used. If "upgrade_available" is 778 "upgrade_available" is used. If "upgrade_available" is
779 0, "bootcount" is always 0, if "upgrade_available" is 779 0, "bootcount" is always 0, if "upgrade_available" is
780 1 "bootcount" is incremented in the environment. 780 1 "bootcount" is incremented in the environment.
781 So the Userspace Applikation must set the "upgrade_available" 781 So the Userspace Applikation must set the "upgrade_available"
782 and "bootcount" variable to 0, if a boot was successfully. 782 and "bootcount" variable to 0, if a boot was successfully.
783 783
784 - Pre-Boot Commands: 784 - Pre-Boot Commands:
785 CONFIG_PREBOOT 785 CONFIG_PREBOOT
786 786
787 When this option is #defined, the existence of the 787 When this option is #defined, the existence of the
788 environment variable "preboot" will be checked 788 environment variable "preboot" will be checked
789 immediately before starting the CONFIG_BOOTDELAY 789 immediately before starting the CONFIG_BOOTDELAY
790 countdown and/or running the auto-boot command resp. 790 countdown and/or running the auto-boot command resp.
791 entering interactive mode. 791 entering interactive mode.
792 792
793 This feature is especially useful when "preboot" is 793 This feature is especially useful when "preboot" is
794 automatically generated or modified. For an example 794 automatically generated or modified. For an example
795 see the LWMON board specific code: here "preboot" is 795 see the LWMON board specific code: here "preboot" is
796 modified when the user holds down a certain 796 modified when the user holds down a certain
797 combination of keys on the (special) keyboard when 797 combination of keys on the (special) keyboard when
798 booting the systems 798 booting the systems
799 799
800 - Serial Download Echo Mode: 800 - Serial Download Echo Mode:
801 CONFIG_LOADS_ECHO 801 CONFIG_LOADS_ECHO
802 If defined to 1, all characters received during a 802 If defined to 1, all characters received during a
803 serial download (using the "loads" command) are 803 serial download (using the "loads" command) are
804 echoed back. This might be needed by some terminal 804 echoed back. This might be needed by some terminal
805 emulations (like "cu"), but may as well just take 805 emulations (like "cu"), but may as well just take
806 time on others. This setting #define's the initial 806 time on others. This setting #define's the initial
807 value of the "loads_echo" environment variable. 807 value of the "loads_echo" environment variable.
808 808
809 - Kgdb Serial Baudrate: (if CONFIG_CMD_KGDB is defined) 809 - Kgdb Serial Baudrate: (if CONFIG_CMD_KGDB is defined)
810 CONFIG_KGDB_BAUDRATE 810 CONFIG_KGDB_BAUDRATE
811 Select one of the baudrates listed in 811 Select one of the baudrates listed in
812 CONFIG_SYS_BAUDRATE_TABLE, see below. 812 CONFIG_SYS_BAUDRATE_TABLE, see below.
813 813
814 - Monitor Functions: 814 - Monitor Functions:
815 Monitor commands can be included or excluded 815 Monitor commands can be included or excluded
816 from the build by using the #include files 816 from the build by using the #include files
817 <config_cmd_all.h> and #undef'ing unwanted 817 <config_cmd_all.h> and #undef'ing unwanted
818 commands, or adding #define's for wanted commands. 818 commands, or adding #define's for wanted commands.
819 819
820 The default command configuration includes all commands 820 The default command configuration includes all commands
821 except those marked below with a "*". 821 except those marked below with a "*".
822 822
823 CONFIG_CMD_AES AES 128 CBC encrypt/decrypt 823 CONFIG_CMD_AES AES 128 CBC encrypt/decrypt
824 CONFIG_CMD_ASKENV * ask for env variable 824 CONFIG_CMD_ASKENV * ask for env variable
825 CONFIG_CMD_BDI bdinfo 825 CONFIG_CMD_BDI bdinfo
826 CONFIG_CMD_BOOTD bootd 826 CONFIG_CMD_BOOTD bootd
827 CONFIG_CMD_BOOTI * ARM64 Linux kernel Image support 827 CONFIG_CMD_BOOTI * ARM64 Linux kernel Image support
828 CONFIG_CMD_CACHE * icache, dcache 828 CONFIG_CMD_CACHE * icache, dcache
829 CONFIG_CMD_CONSOLE coninfo 829 CONFIG_CMD_CONSOLE coninfo
830 CONFIG_CMD_CRC32 * crc32 830 CONFIG_CMD_CRC32 * crc32
831 CONFIG_CMD_DHCP * DHCP support 831 CONFIG_CMD_DHCP * DHCP support
832 CONFIG_CMD_DIAG * Diagnostics 832 CONFIG_CMD_DIAG * Diagnostics
833 CONFIG_CMD_ECHO echo arguments 833 CONFIG_CMD_ECHO echo arguments
834 CONFIG_CMD_EDITENV edit env variable 834 CONFIG_CMD_EDITENV edit env variable
835 CONFIG_CMD_ELF * bootelf, bootvx 835 CONFIG_CMD_ELF * bootelf, bootvx
836 CONFIG_CMD_ENV_EXISTS * check existence of env variable 836 CONFIG_CMD_ENV_EXISTS * check existence of env variable
837 CONFIG_CMD_EXPORTENV * export the environment 837 CONFIG_CMD_EXPORTENV * export the environment
838 CONFIG_CMD_EXT2 * ext2 command support 838 CONFIG_CMD_EXT2 * ext2 command support
839 CONFIG_CMD_EXT4 * ext4 command support 839 CONFIG_CMD_EXT4 * ext4 command support
840 CONFIG_CMD_FS_GENERIC * filesystem commands (e.g. load, ls) 840 CONFIG_CMD_FS_GENERIC * filesystem commands (e.g. load, ls)
841 that work for multiple fs types 841 that work for multiple fs types
842 CONFIG_CMD_FS_UUID * Look up a filesystem UUID 842 CONFIG_CMD_FS_UUID * Look up a filesystem UUID
843 CONFIG_CMD_SAVEENV saveenv 843 CONFIG_CMD_SAVEENV saveenv
844 CONFIG_CMD_FAT * FAT command support 844 CONFIG_CMD_FAT * FAT command support
845 CONFIG_CMD_FLASH flinfo, erase, protect 845 CONFIG_CMD_FLASH flinfo, erase, protect
846 CONFIG_CMD_FPGA FPGA device initialization support 846 CONFIG_CMD_FPGA FPGA device initialization support
847 CONFIG_CMD_GO * the 'go' command (exec code) 847 CONFIG_CMD_GO * the 'go' command (exec code)
848 CONFIG_CMD_GREPENV * search environment 848 CONFIG_CMD_GREPENV * search environment
849 CONFIG_CMD_I2C * I2C serial bus support 849 CONFIG_CMD_I2C * I2C serial bus support
850 CONFIG_CMD_IMI iminfo 850 CONFIG_CMD_IMI iminfo
851 CONFIG_CMD_IMLS List all images found in NOR flash 851 CONFIG_CMD_IMLS List all images found in NOR flash
852 CONFIG_CMD_IMLS_NAND * List all images found in NAND flash 852 CONFIG_CMD_IMLS_NAND * List all images found in NAND flash
853 CONFIG_CMD_IMMAP * IMMR dump support 853 CONFIG_CMD_IMMAP * IMMR dump support
854 CONFIG_CMD_IOTRACE * I/O tracing for debugging 854 CONFIG_CMD_IOTRACE * I/O tracing for debugging
855 CONFIG_CMD_IMPORTENV * import an environment 855 CONFIG_CMD_IMPORTENV * import an environment
856 CONFIG_CMD_INI * import data from an ini file into the env 856 CONFIG_CMD_INI * import data from an ini file into the env
857 CONFIG_CMD_IRQ * irqinfo 857 CONFIG_CMD_IRQ * irqinfo
858 CONFIG_CMD_ITEST Integer/string test of 2 values 858 CONFIG_CMD_ITEST Integer/string test of 2 values
859 CONFIG_CMD_JFFS2 * JFFS2 Support 859 CONFIG_CMD_JFFS2 * JFFS2 Support
860 CONFIG_CMD_KGDB * kgdb 860 CONFIG_CMD_KGDB * kgdb
861 CONFIG_CMD_LDRINFO * ldrinfo (display Blackfin loader) 861 CONFIG_CMD_LDRINFO * ldrinfo (display Blackfin loader)
862 CONFIG_CMD_LINK_LOCAL * link-local IP address auto-configuration 862 CONFIG_CMD_LINK_LOCAL * link-local IP address auto-configuration
863 (169.254.*.*) 863 (169.254.*.*)
864 CONFIG_CMD_LOADB loadb 864 CONFIG_CMD_LOADB loadb
865 CONFIG_CMD_LOADS loads 865 CONFIG_CMD_LOADS loads
866 CONFIG_CMD_MD5SUM * print md5 message digest 866 CONFIG_CMD_MD5SUM * print md5 message digest
867 (requires CONFIG_CMD_MEMORY and CONFIG_MD5) 867 (requires CONFIG_CMD_MEMORY and CONFIG_MD5)
868 CONFIG_CMD_MEMINFO * Display detailed memory information 868 CONFIG_CMD_MEMINFO * Display detailed memory information
869 CONFIG_CMD_MEMORY md, mm, nm, mw, cp, cmp, crc, base, 869 CONFIG_CMD_MEMORY md, mm, nm, mw, cp, cmp, crc, base,
870 loop, loopw 870 loop, loopw
871 CONFIG_CMD_MEMTEST * mtest 871 CONFIG_CMD_MEMTEST * mtest
872 CONFIG_CMD_MISC Misc functions like sleep etc 872 CONFIG_CMD_MISC Misc functions like sleep etc
873 CONFIG_CMD_MMC * MMC memory mapped support 873 CONFIG_CMD_MMC * MMC memory mapped support
874 CONFIG_CMD_MII * MII utility commands 874 CONFIG_CMD_MII * MII utility commands
875 CONFIG_CMD_MTDPARTS * MTD partition support 875 CONFIG_CMD_MTDPARTS * MTD partition support
876 CONFIG_CMD_NAND * NAND support 876 CONFIG_CMD_NAND * NAND support
877 CONFIG_CMD_NET bootp, tftpboot, rarpboot 877 CONFIG_CMD_NET bootp, tftpboot, rarpboot
878 CONFIG_CMD_NFS NFS support 878 CONFIG_CMD_NFS NFS support
879 CONFIG_CMD_PCA953X * PCA953x I2C gpio commands 879 CONFIG_CMD_PCA953X * PCA953x I2C gpio commands
880 CONFIG_CMD_PCA953X_INFO * PCA953x I2C gpio info command 880 CONFIG_CMD_PCA953X_INFO * PCA953x I2C gpio info command
881 CONFIG_CMD_PCI * pciinfo 881 CONFIG_CMD_PCI * pciinfo
882 CONFIG_CMD_PCMCIA * PCMCIA support 882 CONFIG_CMD_PCMCIA * PCMCIA support
883 CONFIG_CMD_PING * send ICMP ECHO_REQUEST to network 883 CONFIG_CMD_PING * send ICMP ECHO_REQUEST to network
884 host 884 host
885 CONFIG_CMD_PORTIO * Port I/O 885 CONFIG_CMD_PORTIO * Port I/O
886 CONFIG_CMD_READ * Read raw data from partition 886 CONFIG_CMD_READ * Read raw data from partition
887 CONFIG_CMD_REGINFO * Register dump 887 CONFIG_CMD_REGINFO * Register dump
888 CONFIG_CMD_RUN run command in env variable 888 CONFIG_CMD_RUN run command in env variable
889 CONFIG_CMD_SANDBOX * sb command to access sandbox features 889 CONFIG_CMD_SANDBOX * sb command to access sandbox features
890 CONFIG_CMD_SAVES * save S record dump 890 CONFIG_CMD_SAVES * save S record dump
891 CONFIG_SCSI * SCSI Support 891 CONFIG_SCSI * SCSI Support
892 CONFIG_CMD_SDRAM * print SDRAM configuration information 892 CONFIG_CMD_SDRAM * print SDRAM configuration information
893 (requires CONFIG_CMD_I2C) 893 (requires CONFIG_CMD_I2C)
894 CONFIG_CMD_SETGETDCR Support for DCR Register access 894 CONFIG_CMD_SETGETDCR Support for DCR Register access
895 (4xx only) 895 (4xx only)
896 CONFIG_CMD_SF * Read/write/erase SPI NOR flash 896 CONFIG_CMD_SF * Read/write/erase SPI NOR flash
897 CONFIG_CMD_SHA1SUM * print sha1 memory digest 897 CONFIG_CMD_SHA1SUM * print sha1 memory digest
898 (requires CONFIG_CMD_MEMORY) 898 (requires CONFIG_CMD_MEMORY)
899 CONFIG_CMD_SOFTSWITCH * Soft switch setting command for BF60x 899 CONFIG_CMD_SOFTSWITCH * Soft switch setting command for BF60x
900 CONFIG_CMD_SOURCE "source" command Support 900 CONFIG_CMD_SOURCE "source" command Support
901 CONFIG_CMD_SPI * SPI serial bus support 901 CONFIG_CMD_SPI * SPI serial bus support
902 CONFIG_CMD_TFTPSRV * TFTP transfer in server mode 902 CONFIG_CMD_TFTPSRV * TFTP transfer in server mode
903 CONFIG_CMD_TFTPPUT * TFTP put command (upload) 903 CONFIG_CMD_TFTPPUT * TFTP put command (upload)
904 CONFIG_CMD_TIME * run command and report execution time (ARM specific) 904 CONFIG_CMD_TIME * run command and report execution time (ARM specific)
905 CONFIG_CMD_TIMER * access to the system tick timer 905 CONFIG_CMD_TIMER * access to the system tick timer
906 CONFIG_CMD_USB * USB support 906 CONFIG_CMD_USB * USB support
907 CONFIG_CMD_CDP * Cisco Discover Protocol support 907 CONFIG_CMD_CDP * Cisco Discover Protocol support
908 CONFIG_CMD_MFSL * Microblaze FSL support 908 CONFIG_CMD_MFSL * Microblaze FSL support
909 CONFIG_CMD_XIMG Load part of Multi Image 909 CONFIG_CMD_XIMG Load part of Multi Image
910 CONFIG_CMD_UUID * Generate random UUID or GUID string 910 CONFIG_CMD_UUID * Generate random UUID or GUID string
911 911
912 EXAMPLE: If you want all functions except of network 912 EXAMPLE: If you want all functions except of network
913 support you can write: 913 support you can write:
914 914
915 #include "config_cmd_all.h" 915 #include "config_cmd_all.h"
916 #undef CONFIG_CMD_NET 916 #undef CONFIG_CMD_NET
917 917
918 Other Commands: 918 Other Commands:
919 fdt (flattened device tree) command: CONFIG_OF_LIBFDT 919 fdt (flattened device tree) command: CONFIG_OF_LIBFDT
920 920
921 Note: Don't enable the "icache" and "dcache" commands 921 Note: Don't enable the "icache" and "dcache" commands
922 (configuration option CONFIG_CMD_CACHE) unless you know 922 (configuration option CONFIG_CMD_CACHE) unless you know
923 what you (and your U-Boot users) are doing. Data 923 what you (and your U-Boot users) are doing. Data
924 cache cannot be enabled on systems like the 8xx or 924 cache cannot be enabled on systems like the 8xx or
925 8260 (where accesses to the IMMR region must be 925 8260 (where accesses to the IMMR region must be
926 uncached), and it cannot be disabled on all other 926 uncached), and it cannot be disabled on all other
927 systems where we (mis-) use the data cache to hold an 927 systems where we (mis-) use the data cache to hold an
928 initial stack and some data. 928 initial stack and some data.
929 929
930 930
931 XXX - this list needs to get updated! 931 XXX - this list needs to get updated!
932 932
933 - Removal of commands 933 - Removal of commands
934 If no commands are needed to boot, you can disable 934 If no commands are needed to boot, you can disable
935 CONFIG_CMDLINE to remove them. In this case, the command line 935 CONFIG_CMDLINE to remove them. In this case, the command line
936 will not be available, and when U-Boot wants to execute the 936 will not be available, and when U-Boot wants to execute the
937 boot command (on start-up) it will call board_run_command() 937 boot command (on start-up) it will call board_run_command()
938 instead. This can reduce image size significantly for very 938 instead. This can reduce image size significantly for very
939 simple boot procedures. 939 simple boot procedures.
940 940
941 - Regular expression support: 941 - Regular expression support:
942 CONFIG_REGEX 942 CONFIG_REGEX
943 If this variable is defined, U-Boot is linked against 943 If this variable is defined, U-Boot is linked against
944 the SLRE (Super Light Regular Expression) library, 944 the SLRE (Super Light Regular Expression) library,
945 which adds regex support to some commands, as for 945 which adds regex support to some commands, as for
946 example "env grep" and "setexpr". 946 example "env grep" and "setexpr".
947 947
948 - Device tree: 948 - Device tree:
949 CONFIG_OF_CONTROL 949 CONFIG_OF_CONTROL
950 If this variable is defined, U-Boot will use a device tree 950 If this variable is defined, U-Boot will use a device tree
951 to configure its devices, instead of relying on statically 951 to configure its devices, instead of relying on statically
952 compiled #defines in the board file. This option is 952 compiled #defines in the board file. This option is
953 experimental and only available on a few boards. The device 953 experimental and only available on a few boards. The device
954 tree is available in the global data as gd->fdt_blob. 954 tree is available in the global data as gd->fdt_blob.
955 955
956 U-Boot needs to get its device tree from somewhere. This can 956 U-Boot needs to get its device tree from somewhere. This can
957 be done using one of the three options below: 957 be done using one of the three options below:
958 958
959 CONFIG_OF_EMBED 959 CONFIG_OF_EMBED
960 If this variable is defined, U-Boot will embed a device tree 960 If this variable is defined, U-Boot will embed a device tree
961 binary in its image. This device tree file should be in the 961 binary in its image. This device tree file should be in the
962 board directory and called <soc>-<board>.dts. The binary file 962 board directory and called <soc>-<board>.dts. The binary file
963 is then picked up in board_init_f() and made available through 963 is then picked up in board_init_f() and made available through
964 the global data structure as gd->blob. 964 the global data structure as gd->blob.
965 965
966 CONFIG_OF_SEPARATE 966 CONFIG_OF_SEPARATE
967 If this variable is defined, U-Boot will build a device tree 967 If this variable is defined, U-Boot will build a device tree
968 binary. It will be called u-boot.dtb. Architecture-specific 968 binary. It will be called u-boot.dtb. Architecture-specific
969 code will locate it at run-time. Generally this works by: 969 code will locate it at run-time. Generally this works by:
970 970
971 cat u-boot.bin u-boot.dtb >image.bin 971 cat u-boot.bin u-boot.dtb >image.bin
972 972
973 and in fact, U-Boot does this for you, creating a file called 973 and in fact, U-Boot does this for you, creating a file called
974 u-boot-dtb.bin which is useful in the common case. You can 974 u-boot-dtb.bin which is useful in the common case. You can
975 still use the individual files if you need something more 975 still use the individual files if you need something more
976 exotic. 976 exotic.
977 977
978 CONFIG_OF_BOARD 978 CONFIG_OF_BOARD
979 If this variable is defined, U-Boot will use the device tree 979 If this variable is defined, U-Boot will use the device tree
980 provided by the board at runtime instead of embedding one with 980 provided by the board at runtime instead of embedding one with
981 the image. Only boards defining board_fdt_blob_setup() support 981 the image. Only boards defining board_fdt_blob_setup() support
982 this option (see include/fdtdec.h file). 982 this option (see include/fdtdec.h file).
983 983
984 - Watchdog: 984 - Watchdog:
985 CONFIG_WATCHDOG 985 CONFIG_WATCHDOG
986 If this variable is defined, it enables watchdog 986 If this variable is defined, it enables watchdog
987 support for the SoC. There must be support in the SoC 987 support for the SoC. There must be support in the SoC
988 specific code for a watchdog. For the 8xx and 8260 988 specific code for a watchdog. For the 8xx and 8260
989 CPUs, the SIU Watchdog feature is enabled in the SYPCR 989 CPUs, the SIU Watchdog feature is enabled in the SYPCR
990 register. When supported for a specific SoC is 990 register. When supported for a specific SoC is
991 available, then no further board specific code should 991 available, then no further board specific code should
992 be needed to use it. 992 be needed to use it.
993 993
994 CONFIG_HW_WATCHDOG 994 CONFIG_HW_WATCHDOG
995 When using a watchdog circuitry external to the used 995 When using a watchdog circuitry external to the used
996 SoC, then define this variable and provide board 996 SoC, then define this variable and provide board
997 specific code for the "hw_watchdog_reset" function. 997 specific code for the "hw_watchdog_reset" function.
998 998
999 CONFIG_AT91_HW_WDT_TIMEOUT 999 CONFIG_AT91_HW_WDT_TIMEOUT
1000 specify the timeout in seconds. default 2 seconds. 1000 specify the timeout in seconds. default 2 seconds.
1001 1001
1002 - U-Boot Version: 1002 - U-Boot Version:
1003 CONFIG_VERSION_VARIABLE 1003 CONFIG_VERSION_VARIABLE
1004 If this variable is defined, an environment variable 1004 If this variable is defined, an environment variable
1005 named "ver" is created by U-Boot showing the U-Boot 1005 named "ver" is created by U-Boot showing the U-Boot
1006 version as printed by the "version" command. 1006 version as printed by the "version" command.
1007 Any change to this variable will be reverted at the 1007 Any change to this variable will be reverted at the
1008 next reset. 1008 next reset.
1009 1009
1010 - Real-Time Clock: 1010 - Real-Time Clock:
1011 1011
1012 When CONFIG_CMD_DATE is selected, the type of the RTC 1012 When CONFIG_CMD_DATE is selected, the type of the RTC
1013 has to be selected, too. Define exactly one of the 1013 has to be selected, too. Define exactly one of the
1014 following options: 1014 following options:
1015 1015
1016 CONFIG_RTC_MPC8xx - use internal RTC of MPC8xx 1016 CONFIG_RTC_MPC8xx - use internal RTC of MPC8xx
1017 CONFIG_RTC_PCF8563 - use Philips PCF8563 RTC 1017 CONFIG_RTC_PCF8563 - use Philips PCF8563 RTC
1018 CONFIG_RTC_MC13XXX - use MC13783 or MC13892 RTC 1018 CONFIG_RTC_MC13XXX - use MC13783 or MC13892 RTC
1019 CONFIG_RTC_MC146818 - use MC146818 RTC 1019 CONFIG_RTC_MC146818 - use MC146818 RTC
1020 CONFIG_RTC_DS1307 - use Maxim, Inc. DS1307 RTC 1020 CONFIG_RTC_DS1307 - use Maxim, Inc. DS1307 RTC
1021 CONFIG_RTC_DS1337 - use Maxim, Inc. DS1337 RTC 1021 CONFIG_RTC_DS1337 - use Maxim, Inc. DS1337 RTC
1022 CONFIG_RTC_DS1338 - use Maxim, Inc. DS1338 RTC 1022 CONFIG_RTC_DS1338 - use Maxim, Inc. DS1338 RTC
1023 CONFIG_RTC_DS1339 - use Maxim, Inc. DS1339 RTC 1023 CONFIG_RTC_DS1339 - use Maxim, Inc. DS1339 RTC
1024 CONFIG_RTC_DS164x - use Dallas DS164x RTC 1024 CONFIG_RTC_DS164x - use Dallas DS164x RTC
1025 CONFIG_RTC_ISL1208 - use Intersil ISL1208 RTC 1025 CONFIG_RTC_ISL1208 - use Intersil ISL1208 RTC
1026 CONFIG_RTC_MAX6900 - use Maxim, Inc. MAX6900 RTC 1026 CONFIG_RTC_MAX6900 - use Maxim, Inc. MAX6900 RTC
1027 CONFIG_SYS_RTC_DS1337_NOOSC - Turn off the OSC output for DS1337 1027 CONFIG_SYS_RTC_DS1337_NOOSC - Turn off the OSC output for DS1337
1028 CONFIG_SYS_RV3029_TCR - enable trickle charger on 1028 CONFIG_SYS_RV3029_TCR - enable trickle charger on
1029 RV3029 RTC. 1029 RV3029 RTC.
1030 1030
1031 Note that if the RTC uses I2C, then the I2C interface 1031 Note that if the RTC uses I2C, then the I2C interface
1032 must also be configured. See I2C Support, below. 1032 must also be configured. See I2C Support, below.
1033 1033
1034 - GPIO Support: 1034 - GPIO Support:
1035 CONFIG_PCA953X - use NXP's PCA953X series I2C GPIO 1035 CONFIG_PCA953X - use NXP's PCA953X series I2C GPIO
1036 1036
1037 The CONFIG_SYS_I2C_PCA953X_WIDTH option specifies a list of 1037 The CONFIG_SYS_I2C_PCA953X_WIDTH option specifies a list of
1038 chip-ngpio pairs that tell the PCA953X driver the number of 1038 chip-ngpio pairs that tell the PCA953X driver the number of
1039 pins supported by a particular chip. 1039 pins supported by a particular chip.
1040 1040
1041 Note that if the GPIO device uses I2C, then the I2C interface 1041 Note that if the GPIO device uses I2C, then the I2C interface
1042 must also be configured. See I2C Support, below. 1042 must also be configured. See I2C Support, below.
1043 1043
1044 - I/O tracing: 1044 - I/O tracing:
1045 When CONFIG_IO_TRACE is selected, U-Boot intercepts all I/O 1045 When CONFIG_IO_TRACE is selected, U-Boot intercepts all I/O
1046 accesses and can checksum them or write a list of them out 1046 accesses and can checksum them or write a list of them out
1047 to memory. See the 'iotrace' command for details. This is 1047 to memory. See the 'iotrace' command for details. This is
1048 useful for testing device drivers since it can confirm that 1048 useful for testing device drivers since it can confirm that
1049 the driver behaves the same way before and after a code 1049 the driver behaves the same way before and after a code
1050 change. Currently this is supported on sandbox and arm. To 1050 change. Currently this is supported on sandbox and arm. To
1051 add support for your architecture, add '#include <iotrace.h>' 1051 add support for your architecture, add '#include <iotrace.h>'
1052 to the bottom of arch/<arch>/include/asm/io.h and test. 1052 to the bottom of arch/<arch>/include/asm/io.h and test.
1053 1053
1054 Example output from the 'iotrace stats' command is below. 1054 Example output from the 'iotrace stats' command is below.
1055 Note that if the trace buffer is exhausted, the checksum will 1055 Note that if the trace buffer is exhausted, the checksum will
1056 still continue to operate. 1056 still continue to operate.
1057 1057
1058 iotrace is enabled 1058 iotrace is enabled
1059 Start: 10000000 (buffer start address) 1059 Start: 10000000 (buffer start address)
1060 Size: 00010000 (buffer size) 1060 Size: 00010000 (buffer size)
1061 Offset: 00000120 (current buffer offset) 1061 Offset: 00000120 (current buffer offset)
1062 Output: 10000120 (start + offset) 1062 Output: 10000120 (start + offset)
1063 Count: 00000018 (number of trace records) 1063 Count: 00000018 (number of trace records)
1064 CRC32: 9526fb66 (CRC32 of all trace records) 1064 CRC32: 9526fb66 (CRC32 of all trace records)
1065 1065
1066 - Timestamp Support: 1066 - Timestamp Support:
1067 1067
1068 When CONFIG_TIMESTAMP is selected, the timestamp 1068 When CONFIG_TIMESTAMP is selected, the timestamp
1069 (date and time) of an image is printed by image 1069 (date and time) of an image is printed by image
1070 commands like bootm or iminfo. This option is 1070 commands like bootm or iminfo. This option is
1071 automatically enabled when you select CONFIG_CMD_DATE . 1071 automatically enabled when you select CONFIG_CMD_DATE .
1072 1072
1073 - Partition Labels (disklabels) Supported: 1073 - Partition Labels (disklabels) Supported:
1074 Zero or more of the following: 1074 Zero or more of the following:
1075 CONFIG_MAC_PARTITION Apple's MacOS partition table. 1075 CONFIG_MAC_PARTITION Apple's MacOS partition table.
1076 CONFIG_DOS_PARTITION MS Dos partition table, traditional on the 1076 CONFIG_DOS_PARTITION MS Dos partition table, traditional on the
1077 Intel architecture, USB sticks, etc. 1077 Intel architecture, USB sticks, etc.
1078 CONFIG_ISO_PARTITION ISO partition table, used on CDROM etc. 1078 CONFIG_ISO_PARTITION ISO partition table, used on CDROM etc.
1079 CONFIG_EFI_PARTITION GPT partition table, common when EFI is the 1079 CONFIG_EFI_PARTITION GPT partition table, common when EFI is the
1080 bootloader. Note 2TB partition limit; see 1080 bootloader. Note 2TB partition limit; see
1081 disk/part_efi.c 1081 disk/part_efi.c
1082 CONFIG_MTD_PARTITIONS Memory Technology Device partition table. 1082 CONFIG_MTD_PARTITIONS Memory Technology Device partition table.
1083 1083
1084 If IDE or SCSI support is enabled (CONFIG_CMD_IDE or 1084 If IDE or SCSI support is enabled (CONFIG_IDE or
1085 CONFIG_SCSI) you must configure support for at 1085 CONFIG_SCSI) you must configure support for at
1086 least one non-MTD partition type as well. 1086 least one non-MTD partition type as well.
1087 1087
1088 - IDE Reset method: 1088 - IDE Reset method:
1089 CONFIG_IDE_RESET_ROUTINE - this is defined in several 1089 CONFIG_IDE_RESET_ROUTINE - this is defined in several
1090 board configurations files but used nowhere! 1090 board configurations files but used nowhere!
1091 1091
1092 CONFIG_IDE_RESET - is this is defined, IDE Reset will 1092 CONFIG_IDE_RESET - is this is defined, IDE Reset will
1093 be performed by calling the function 1093 be performed by calling the function
1094 ide_set_reset(int reset) 1094 ide_set_reset(int reset)
1095 which has to be defined in a board specific file 1095 which has to be defined in a board specific file
1096 1096
1097 - ATAPI Support: 1097 - ATAPI Support:
1098 CONFIG_ATAPI 1098 CONFIG_ATAPI
1099 1099
1100 Set this to enable ATAPI support. 1100 Set this to enable ATAPI support.
1101 1101
1102 - LBA48 Support 1102 - LBA48 Support
1103 CONFIG_LBA48 1103 CONFIG_LBA48
1104 1104
1105 Set this to enable support for disks larger than 137GB 1105 Set this to enable support for disks larger than 137GB
1106 Also look at CONFIG_SYS_64BIT_LBA. 1106 Also look at CONFIG_SYS_64BIT_LBA.
1107 Whithout these , LBA48 support uses 32bit variables and will 'only' 1107 Whithout these , LBA48 support uses 32bit variables and will 'only'
1108 support disks up to 2.1TB. 1108 support disks up to 2.1TB.
1109 1109
1110 CONFIG_SYS_64BIT_LBA: 1110 CONFIG_SYS_64BIT_LBA:
1111 When enabled, makes the IDE subsystem use 64bit sector addresses. 1111 When enabled, makes the IDE subsystem use 64bit sector addresses.
1112 Default is 32bit. 1112 Default is 32bit.
1113 1113
1114 - SCSI Support: 1114 - SCSI Support:
1115 At the moment only there is only support for the 1115 At the moment only there is only support for the
1116 SYM53C8XX SCSI controller; define 1116 SYM53C8XX SCSI controller; define
1117 CONFIG_SCSI_SYM53C8XX to enable it. 1117 CONFIG_SCSI_SYM53C8XX to enable it.
1118 1118
1119 CONFIG_SYS_SCSI_MAX_LUN [8], CONFIG_SYS_SCSI_MAX_SCSI_ID [7] and 1119 CONFIG_SYS_SCSI_MAX_LUN [8], CONFIG_SYS_SCSI_MAX_SCSI_ID [7] and
1120 CONFIG_SYS_SCSI_MAX_DEVICE [CONFIG_SYS_SCSI_MAX_SCSI_ID * 1120 CONFIG_SYS_SCSI_MAX_DEVICE [CONFIG_SYS_SCSI_MAX_SCSI_ID *
1121 CONFIG_SYS_SCSI_MAX_LUN] can be adjusted to define the 1121 CONFIG_SYS_SCSI_MAX_LUN] can be adjusted to define the
1122 maximum numbers of LUNs, SCSI ID's and target 1122 maximum numbers of LUNs, SCSI ID's and target
1123 devices. 1123 devices.
1124 CONFIG_SYS_SCSI_SYM53C8XX_CCF to fix clock timing (80Mhz) 1124 CONFIG_SYS_SCSI_SYM53C8XX_CCF to fix clock timing (80Mhz)
1125 1125
1126 The environment variable 'scsidevs' is set to the number of 1126 The environment variable 'scsidevs' is set to the number of
1127 SCSI devices found during the last scan. 1127 SCSI devices found during the last scan.
1128 1128
1129 - NETWORK Support (PCI): 1129 - NETWORK Support (PCI):
1130 CONFIG_E1000 1130 CONFIG_E1000
1131 Support for Intel 8254x/8257x gigabit chips. 1131 Support for Intel 8254x/8257x gigabit chips.
1132 1132
1133 CONFIG_E1000_SPI 1133 CONFIG_E1000_SPI
1134 Utility code for direct access to the SPI bus on Intel 8257x. 1134 Utility code for direct access to the SPI bus on Intel 8257x.
1135 This does not do anything useful unless you set at least one 1135 This does not do anything useful unless you set at least one
1136 of CONFIG_CMD_E1000 or CONFIG_E1000_SPI_GENERIC. 1136 of CONFIG_CMD_E1000 or CONFIG_E1000_SPI_GENERIC.
1137 1137
1138 CONFIG_E1000_SPI_GENERIC 1138 CONFIG_E1000_SPI_GENERIC
1139 Allow generic access to the SPI bus on the Intel 8257x, for 1139 Allow generic access to the SPI bus on the Intel 8257x, for
1140 example with the "sspi" command. 1140 example with the "sspi" command.
1141 1141
1142 CONFIG_CMD_E1000 1142 CONFIG_CMD_E1000
1143 Management command for E1000 devices. When used on devices 1143 Management command for E1000 devices. When used on devices
1144 with SPI support you can reprogram the EEPROM from U-Boot. 1144 with SPI support you can reprogram the EEPROM from U-Boot.
1145 1145
1146 CONFIG_EEPRO100 1146 CONFIG_EEPRO100
1147 Support for Intel 82557/82559/82559ER chips. 1147 Support for Intel 82557/82559/82559ER chips.
1148 Optional CONFIG_EEPRO100_SROM_WRITE enables EEPROM 1148 Optional CONFIG_EEPRO100_SROM_WRITE enables EEPROM
1149 write routine for first time initialisation. 1149 write routine for first time initialisation.
1150 1150
1151 CONFIG_TULIP 1151 CONFIG_TULIP
1152 Support for Digital 2114x chips. 1152 Support for Digital 2114x chips.
1153 Optional CONFIG_TULIP_SELECT_MEDIA for board specific 1153 Optional CONFIG_TULIP_SELECT_MEDIA for board specific
1154 modem chip initialisation (KS8761/QS6611). 1154 modem chip initialisation (KS8761/QS6611).
1155 1155
1156 CONFIG_NATSEMI 1156 CONFIG_NATSEMI
1157 Support for National dp83815 chips. 1157 Support for National dp83815 chips.
1158 1158
1159 CONFIG_NS8382X 1159 CONFIG_NS8382X
1160 Support for National dp8382[01] gigabit chips. 1160 Support for National dp8382[01] gigabit chips.
1161 1161
1162 - NETWORK Support (other): 1162 - NETWORK Support (other):
1163 1163
1164 CONFIG_DRIVER_AT91EMAC 1164 CONFIG_DRIVER_AT91EMAC
1165 Support for AT91RM9200 EMAC. 1165 Support for AT91RM9200 EMAC.
1166 1166
1167 CONFIG_RMII 1167 CONFIG_RMII
1168 Define this to use reduced MII inteface 1168 Define this to use reduced MII inteface
1169 1169
1170 CONFIG_DRIVER_AT91EMAC_QUIET 1170 CONFIG_DRIVER_AT91EMAC_QUIET
1171 If this defined, the driver is quiet. 1171 If this defined, the driver is quiet.
1172 The driver doen't show link status messages. 1172 The driver doen't show link status messages.
1173 1173
1174 CONFIG_CALXEDA_XGMAC 1174 CONFIG_CALXEDA_XGMAC
1175 Support for the Calxeda XGMAC device 1175 Support for the Calxeda XGMAC device
1176 1176
1177 CONFIG_LAN91C96 1177 CONFIG_LAN91C96
1178 Support for SMSC's LAN91C96 chips. 1178 Support for SMSC's LAN91C96 chips.
1179 1179
1180 CONFIG_LAN91C96_USE_32_BIT 1180 CONFIG_LAN91C96_USE_32_BIT
1181 Define this to enable 32 bit addressing 1181 Define this to enable 32 bit addressing
1182 1182
1183 CONFIG_SMC91111 1183 CONFIG_SMC91111
1184 Support for SMSC's LAN91C111 chip 1184 Support for SMSC's LAN91C111 chip
1185 1185
1186 CONFIG_SMC91111_BASE 1186 CONFIG_SMC91111_BASE
1187 Define this to hold the physical address 1187 Define this to hold the physical address
1188 of the device (I/O space) 1188 of the device (I/O space)
1189 1189
1190 CONFIG_SMC_USE_32_BIT 1190 CONFIG_SMC_USE_32_BIT
1191 Define this if data bus is 32 bits 1191 Define this if data bus is 32 bits
1192 1192
1193 CONFIG_SMC_USE_IOFUNCS 1193 CONFIG_SMC_USE_IOFUNCS
1194 Define this to use i/o functions instead of macros 1194 Define this to use i/o functions instead of macros
1195 (some hardware wont work with macros) 1195 (some hardware wont work with macros)
1196 1196
1197 CONFIG_DRIVER_TI_EMAC 1197 CONFIG_DRIVER_TI_EMAC
1198 Support for davinci emac 1198 Support for davinci emac
1199 1199
1200 CONFIG_SYS_DAVINCI_EMAC_PHY_COUNT 1200 CONFIG_SYS_DAVINCI_EMAC_PHY_COUNT
1201 Define this if you have more then 3 PHYs. 1201 Define this if you have more then 3 PHYs.
1202 1202
1203 CONFIG_FTGMAC100 1203 CONFIG_FTGMAC100
1204 Support for Faraday's FTGMAC100 Gigabit SoC Ethernet 1204 Support for Faraday's FTGMAC100 Gigabit SoC Ethernet
1205 1205
1206 CONFIG_FTGMAC100_EGIGA 1206 CONFIG_FTGMAC100_EGIGA
1207 Define this to use GE link update with gigabit PHY. 1207 Define this to use GE link update with gigabit PHY.
1208 Define this if FTGMAC100 is connected to gigabit PHY. 1208 Define this if FTGMAC100 is connected to gigabit PHY.
1209 If your system has 10/100 PHY only, it might not occur 1209 If your system has 10/100 PHY only, it might not occur
1210 wrong behavior. Because PHY usually return timeout or 1210 wrong behavior. Because PHY usually return timeout or
1211 useless data when polling gigabit status and gigabit 1211 useless data when polling gigabit status and gigabit
1212 control registers. This behavior won't affect the 1212 control registers. This behavior won't affect the
1213 correctnessof 10/100 link speed update. 1213 correctnessof 10/100 link speed update.
1214 1214
1215 CONFIG_SMC911X 1215 CONFIG_SMC911X
1216 Support for SMSC's LAN911x and LAN921x chips 1216 Support for SMSC's LAN911x and LAN921x chips
1217 1217
1218 CONFIG_SMC911X_BASE 1218 CONFIG_SMC911X_BASE
1219 Define this to hold the physical address 1219 Define this to hold the physical address
1220 of the device (I/O space) 1220 of the device (I/O space)
1221 1221
1222 CONFIG_SMC911X_32_BIT 1222 CONFIG_SMC911X_32_BIT
1223 Define this if data bus is 32 bits 1223 Define this if data bus is 32 bits
1224 1224
1225 CONFIG_SMC911X_16_BIT 1225 CONFIG_SMC911X_16_BIT
1226 Define this if data bus is 16 bits. If your processor 1226 Define this if data bus is 16 bits. If your processor
1227 automatically converts one 32 bit word to two 16 bit 1227 automatically converts one 32 bit word to two 16 bit
1228 words you may also try CONFIG_SMC911X_32_BIT. 1228 words you may also try CONFIG_SMC911X_32_BIT.
1229 1229
1230 CONFIG_SH_ETHER 1230 CONFIG_SH_ETHER
1231 Support for Renesas on-chip Ethernet controller 1231 Support for Renesas on-chip Ethernet controller
1232 1232
1233 CONFIG_SH_ETHER_USE_PORT 1233 CONFIG_SH_ETHER_USE_PORT
1234 Define the number of ports to be used 1234 Define the number of ports to be used
1235 1235
1236 CONFIG_SH_ETHER_PHY_ADDR 1236 CONFIG_SH_ETHER_PHY_ADDR
1237 Define the ETH PHY's address 1237 Define the ETH PHY's address
1238 1238
1239 CONFIG_SH_ETHER_CACHE_WRITEBACK 1239 CONFIG_SH_ETHER_CACHE_WRITEBACK
1240 If this option is set, the driver enables cache flush. 1240 If this option is set, the driver enables cache flush.
1241 1241
1242 - PWM Support: 1242 - PWM Support:
1243 CONFIG_PWM_IMX 1243 CONFIG_PWM_IMX
1244 Support for PWM module on the imx6. 1244 Support for PWM module on the imx6.
1245 1245
1246 - TPM Support: 1246 - TPM Support:
1247 CONFIG_TPM 1247 CONFIG_TPM
1248 Support TPM devices. 1248 Support TPM devices.
1249 1249
1250 CONFIG_TPM_TIS_INFINEON 1250 CONFIG_TPM_TIS_INFINEON
1251 Support for Infineon i2c bus TPM devices. Only one device 1251 Support for Infineon i2c bus TPM devices. Only one device
1252 per system is supported at this time. 1252 per system is supported at this time.
1253 1253
1254 CONFIG_TPM_TIS_I2C_BURST_LIMITATION 1254 CONFIG_TPM_TIS_I2C_BURST_LIMITATION
1255 Define the burst count bytes upper limit 1255 Define the burst count bytes upper limit
1256 1256
1257 CONFIG_TPM_ST33ZP24 1257 CONFIG_TPM_ST33ZP24
1258 Support for STMicroelectronics TPM devices. Requires DM_TPM support. 1258 Support for STMicroelectronics TPM devices. Requires DM_TPM support.
1259 1259
1260 CONFIG_TPM_ST33ZP24_I2C 1260 CONFIG_TPM_ST33ZP24_I2C
1261 Support for STMicroelectronics ST33ZP24 I2C devices. 1261 Support for STMicroelectronics ST33ZP24 I2C devices.
1262 Requires TPM_ST33ZP24 and I2C. 1262 Requires TPM_ST33ZP24 and I2C.
1263 1263
1264 CONFIG_TPM_ST33ZP24_SPI 1264 CONFIG_TPM_ST33ZP24_SPI
1265 Support for STMicroelectronics ST33ZP24 SPI devices. 1265 Support for STMicroelectronics ST33ZP24 SPI devices.
1266 Requires TPM_ST33ZP24 and SPI. 1266 Requires TPM_ST33ZP24 and SPI.
1267 1267
1268 CONFIG_TPM_ATMEL_TWI 1268 CONFIG_TPM_ATMEL_TWI
1269 Support for Atmel TWI TPM device. Requires I2C support. 1269 Support for Atmel TWI TPM device. Requires I2C support.
1270 1270
1271 CONFIG_TPM_TIS_LPC 1271 CONFIG_TPM_TIS_LPC
1272 Support for generic parallel port TPM devices. Only one device 1272 Support for generic parallel port TPM devices. Only one device
1273 per system is supported at this time. 1273 per system is supported at this time.
1274 1274
1275 CONFIG_TPM_TIS_BASE_ADDRESS 1275 CONFIG_TPM_TIS_BASE_ADDRESS
1276 Base address where the generic TPM device is mapped 1276 Base address where the generic TPM device is mapped
1277 to. Contemporary x86 systems usually map it at 1277 to. Contemporary x86 systems usually map it at
1278 0xfed40000. 1278 0xfed40000.
1279 1279
1280 CONFIG_CMD_TPM 1280 CONFIG_CMD_TPM
1281 Add tpm monitor functions. 1281 Add tpm monitor functions.
1282 Requires CONFIG_TPM. If CONFIG_TPM_AUTH_SESSIONS is set, also 1282 Requires CONFIG_TPM. If CONFIG_TPM_AUTH_SESSIONS is set, also
1283 provides monitor access to authorized functions. 1283 provides monitor access to authorized functions.
1284 1284
1285 CONFIG_TPM 1285 CONFIG_TPM
1286 Define this to enable the TPM support library which provides 1286 Define this to enable the TPM support library which provides
1287 functional interfaces to some TPM commands. 1287 functional interfaces to some TPM commands.
1288 Requires support for a TPM device. 1288 Requires support for a TPM device.
1289 1289
1290 CONFIG_TPM_AUTH_SESSIONS 1290 CONFIG_TPM_AUTH_SESSIONS
1291 Define this to enable authorized functions in the TPM library. 1291 Define this to enable authorized functions in the TPM library.
1292 Requires CONFIG_TPM and CONFIG_SHA1. 1292 Requires CONFIG_TPM and CONFIG_SHA1.
1293 1293
1294 - USB Support: 1294 - USB Support:
1295 At the moment only the UHCI host controller is 1295 At the moment only the UHCI host controller is
1296 supported (PIP405, MIP405, MPC5200); define 1296 supported (PIP405, MIP405, MPC5200); define
1297 CONFIG_USB_UHCI to enable it. 1297 CONFIG_USB_UHCI to enable it.
1298 define CONFIG_USB_KEYBOARD to enable the USB Keyboard 1298 define CONFIG_USB_KEYBOARD to enable the USB Keyboard
1299 and define CONFIG_USB_STORAGE to enable the USB 1299 and define CONFIG_USB_STORAGE to enable the USB
1300 storage devices. 1300 storage devices.
1301 Note: 1301 Note:
1302 Supported are USB Keyboards and USB Floppy drives 1302 Supported are USB Keyboards and USB Floppy drives
1303 (TEAC FD-05PUB). 1303 (TEAC FD-05PUB).
1304 MPC5200 USB requires additional defines: 1304 MPC5200 USB requires additional defines:
1305 CONFIG_USB_CLOCK 1305 CONFIG_USB_CLOCK
1306 for 528 MHz Clock: 0x0001bbbb 1306 for 528 MHz Clock: 0x0001bbbb
1307 CONFIG_PSC3_USB 1307 CONFIG_PSC3_USB
1308 for USB on PSC3 1308 for USB on PSC3
1309 CONFIG_USB_CONFIG 1309 CONFIG_USB_CONFIG
1310 for differential drivers: 0x00001000 1310 for differential drivers: 0x00001000
1311 for single ended drivers: 0x00005000 1311 for single ended drivers: 0x00005000
1312 for differential drivers on PSC3: 0x00000100 1312 for differential drivers on PSC3: 0x00000100
1313 for single ended drivers on PSC3: 0x00004100 1313 for single ended drivers on PSC3: 0x00004100
1314 CONFIG_SYS_USB_EVENT_POLL 1314 CONFIG_SYS_USB_EVENT_POLL
1315 May be defined to allow interrupt polling 1315 May be defined to allow interrupt polling
1316 instead of using asynchronous interrupts 1316 instead of using asynchronous interrupts
1317 1317
1318 CONFIG_USB_EHCI_TXFIFO_THRESH enables setting of the 1318 CONFIG_USB_EHCI_TXFIFO_THRESH enables setting of the
1319 txfilltuning field in the EHCI controller on reset. 1319 txfilltuning field in the EHCI controller on reset.
1320 1320
1321 CONFIG_USB_DWC2_REG_ADDR the physical CPU address of the DWC2 1321 CONFIG_USB_DWC2_REG_ADDR the physical CPU address of the DWC2
1322 HW module registers. 1322 HW module registers.
1323 1323
1324 - USB Device: 1324 - USB Device:
1325 Define the below if you wish to use the USB console. 1325 Define the below if you wish to use the USB console.
1326 Once firmware is rebuilt from a serial console issue the 1326 Once firmware is rebuilt from a serial console issue the
1327 command "setenv stdin usbtty; setenv stdout usbtty" and 1327 command "setenv stdin usbtty; setenv stdout usbtty" and
1328 attach your USB cable. The Unix command "dmesg" should print 1328 attach your USB cable. The Unix command "dmesg" should print
1329 it has found a new device. The environment variable usbtty 1329 it has found a new device. The environment variable usbtty
1330 can be set to gserial or cdc_acm to enable your device to 1330 can be set to gserial or cdc_acm to enable your device to
1331 appear to a USB host as a Linux gserial device or a 1331 appear to a USB host as a Linux gserial device or a
1332 Common Device Class Abstract Control Model serial device. 1332 Common Device Class Abstract Control Model serial device.
1333 If you select usbtty = gserial you should be able to enumerate 1333 If you select usbtty = gserial you should be able to enumerate
1334 a Linux host by 1334 a Linux host by
1335 # modprobe usbserial vendor=0xVendorID product=0xProductID 1335 # modprobe usbserial vendor=0xVendorID product=0xProductID
1336 else if using cdc_acm, simply setting the environment 1336 else if using cdc_acm, simply setting the environment
1337 variable usbtty to be cdc_acm should suffice. The following 1337 variable usbtty to be cdc_acm should suffice. The following
1338 might be defined in YourBoardName.h 1338 might be defined in YourBoardName.h
1339 1339
1340 CONFIG_USB_DEVICE 1340 CONFIG_USB_DEVICE
1341 Define this to build a UDC device 1341 Define this to build a UDC device
1342 1342
1343 CONFIG_USB_TTY 1343 CONFIG_USB_TTY
1344 Define this to have a tty type of device available to 1344 Define this to have a tty type of device available to
1345 talk to the UDC device 1345 talk to the UDC device
1346 1346
1347 CONFIG_USBD_HS 1347 CONFIG_USBD_HS
1348 Define this to enable the high speed support for usb 1348 Define this to enable the high speed support for usb
1349 device and usbtty. If this feature is enabled, a routine 1349 device and usbtty. If this feature is enabled, a routine
1350 int is_usbd_high_speed(void) 1350 int is_usbd_high_speed(void)
1351 also needs to be defined by the driver to dynamically poll 1351 also needs to be defined by the driver to dynamically poll
1352 whether the enumeration has succeded at high speed or full 1352 whether the enumeration has succeded at high speed or full
1353 speed. 1353 speed.
1354 1354
1355 CONFIG_SYS_CONSOLE_IS_IN_ENV 1355 CONFIG_SYS_CONSOLE_IS_IN_ENV
1356 Define this if you want stdin, stdout &/or stderr to 1356 Define this if you want stdin, stdout &/or stderr to
1357 be set to usbtty. 1357 be set to usbtty.
1358 1358
1359 mpc8xx: 1359 mpc8xx:
1360 CONFIG_SYS_USB_EXTC_CLK 0xBLAH 1360 CONFIG_SYS_USB_EXTC_CLK 0xBLAH
1361 Derive USB clock from external clock "blah" 1361 Derive USB clock from external clock "blah"
1362 - CONFIG_SYS_USB_EXTC_CLK 0x02 1362 - CONFIG_SYS_USB_EXTC_CLK 0x02
1363 1363
1364 If you have a USB-IF assigned VendorID then you may wish to 1364 If you have a USB-IF assigned VendorID then you may wish to
1365 define your own vendor specific values either in BoardName.h 1365 define your own vendor specific values either in BoardName.h
1366 or directly in usbd_vendor_info.h. If you don't define 1366 or directly in usbd_vendor_info.h. If you don't define
1367 CONFIG_USBD_MANUFACTURER, CONFIG_USBD_PRODUCT_NAME, 1367 CONFIG_USBD_MANUFACTURER, CONFIG_USBD_PRODUCT_NAME,
1368 CONFIG_USBD_VENDORID and CONFIG_USBD_PRODUCTID, then U-Boot 1368 CONFIG_USBD_VENDORID and CONFIG_USBD_PRODUCTID, then U-Boot
1369 should pretend to be a Linux device to it's target host. 1369 should pretend to be a Linux device to it's target host.
1370 1370
1371 CONFIG_USBD_MANUFACTURER 1371 CONFIG_USBD_MANUFACTURER
1372 Define this string as the name of your company for 1372 Define this string as the name of your company for
1373 - CONFIG_USBD_MANUFACTURER "my company" 1373 - CONFIG_USBD_MANUFACTURER "my company"
1374 1374
1375 CONFIG_USBD_PRODUCT_NAME 1375 CONFIG_USBD_PRODUCT_NAME
1376 Define this string as the name of your product 1376 Define this string as the name of your product
1377 - CONFIG_USBD_PRODUCT_NAME "acme usb device" 1377 - CONFIG_USBD_PRODUCT_NAME "acme usb device"
1378 1378
1379 CONFIG_USBD_VENDORID 1379 CONFIG_USBD_VENDORID
1380 Define this as your assigned Vendor ID from the USB 1380 Define this as your assigned Vendor ID from the USB
1381 Implementors Forum. This *must* be a genuine Vendor ID 1381 Implementors Forum. This *must* be a genuine Vendor ID
1382 to avoid polluting the USB namespace. 1382 to avoid polluting the USB namespace.
1383 - CONFIG_USBD_VENDORID 0xFFFF 1383 - CONFIG_USBD_VENDORID 0xFFFF
1384 1384
1385 CONFIG_USBD_PRODUCTID 1385 CONFIG_USBD_PRODUCTID
1386 Define this as the unique Product ID 1386 Define this as the unique Product ID
1387 for your device 1387 for your device
1388 - CONFIG_USBD_PRODUCTID 0xFFFF 1388 - CONFIG_USBD_PRODUCTID 0xFFFF
1389 1389
1390 - ULPI Layer Support: 1390 - ULPI Layer Support:
1391 The ULPI (UTMI Low Pin (count) Interface) PHYs are supported via 1391 The ULPI (UTMI Low Pin (count) Interface) PHYs are supported via
1392 the generic ULPI layer. The generic layer accesses the ULPI PHY 1392 the generic ULPI layer. The generic layer accesses the ULPI PHY
1393 via the platform viewport, so you need both the genric layer and 1393 via the platform viewport, so you need both the genric layer and
1394 the viewport enabled. Currently only Chipidea/ARC based 1394 the viewport enabled. Currently only Chipidea/ARC based
1395 viewport is supported. 1395 viewport is supported.
1396 To enable the ULPI layer support, define CONFIG_USB_ULPI and 1396 To enable the ULPI layer support, define CONFIG_USB_ULPI and
1397 CONFIG_USB_ULPI_VIEWPORT in your board configuration file. 1397 CONFIG_USB_ULPI_VIEWPORT in your board configuration file.
1398 If your ULPI phy needs a different reference clock than the 1398 If your ULPI phy needs a different reference clock than the
1399 standard 24 MHz then you have to define CONFIG_ULPI_REF_CLK to 1399 standard 24 MHz then you have to define CONFIG_ULPI_REF_CLK to
1400 the appropriate value in Hz. 1400 the appropriate value in Hz.
1401 1401
1402 - MMC Support: 1402 - MMC Support:
1403 The MMC controller on the Intel PXA is supported. To 1403 The MMC controller on the Intel PXA is supported. To
1404 enable this define CONFIG_MMC. The MMC can be 1404 enable this define CONFIG_MMC. The MMC can be
1405 accessed from the boot prompt by mapping the device 1405 accessed from the boot prompt by mapping the device
1406 to physical memory similar to flash. Command line is 1406 to physical memory similar to flash. Command line is
1407 enabled with CONFIG_CMD_MMC. The MMC driver also works with 1407 enabled with CONFIG_CMD_MMC. The MMC driver also works with
1408 the FAT fs. This is enabled with CONFIG_CMD_FAT. 1408 the FAT fs. This is enabled with CONFIG_CMD_FAT.
1409 1409
1410 CONFIG_SH_MMCIF 1410 CONFIG_SH_MMCIF
1411 Support for Renesas on-chip MMCIF controller 1411 Support for Renesas on-chip MMCIF controller
1412 1412
1413 CONFIG_SH_MMCIF_ADDR 1413 CONFIG_SH_MMCIF_ADDR
1414 Define the base address of MMCIF registers 1414 Define the base address of MMCIF registers
1415 1415
1416 CONFIG_SH_MMCIF_CLK 1416 CONFIG_SH_MMCIF_CLK
1417 Define the clock frequency for MMCIF 1417 Define the clock frequency for MMCIF
1418 1418
1419 CONFIG_SUPPORT_EMMC_BOOT 1419 CONFIG_SUPPORT_EMMC_BOOT
1420 Enable some additional features of the eMMC boot partitions. 1420 Enable some additional features of the eMMC boot partitions.
1421 1421
1422 CONFIG_SUPPORT_EMMC_RPMB 1422 CONFIG_SUPPORT_EMMC_RPMB
1423 Enable the commands for reading, writing and programming the 1423 Enable the commands for reading, writing and programming the
1424 key for the Replay Protection Memory Block partition in eMMC. 1424 key for the Replay Protection Memory Block partition in eMMC.
1425 1425
1426 - USB Device Firmware Update (DFU) class support: 1426 - USB Device Firmware Update (DFU) class support:
1427 CONFIG_USB_FUNCTION_DFU 1427 CONFIG_USB_FUNCTION_DFU
1428 This enables the USB portion of the DFU USB class 1428 This enables the USB portion of the DFU USB class
1429 1429
1430 CONFIG_CMD_DFU 1430 CONFIG_CMD_DFU
1431 This enables the command "dfu" which is used to have 1431 This enables the command "dfu" which is used to have
1432 U-Boot create a DFU class device via USB. This command 1432 U-Boot create a DFU class device via USB. This command
1433 requires that the "dfu_alt_info" environment variable be 1433 requires that the "dfu_alt_info" environment variable be
1434 set and define the alt settings to expose to the host. 1434 set and define the alt settings to expose to the host.
1435 1435
1436 CONFIG_DFU_MMC 1436 CONFIG_DFU_MMC
1437 This enables support for exposing (e)MMC devices via DFU. 1437 This enables support for exposing (e)MMC devices via DFU.
1438 1438
1439 CONFIG_DFU_NAND 1439 CONFIG_DFU_NAND
1440 This enables support for exposing NAND devices via DFU. 1440 This enables support for exposing NAND devices via DFU.
1441 1441
1442 CONFIG_DFU_RAM 1442 CONFIG_DFU_RAM
1443 This enables support for exposing RAM via DFU. 1443 This enables support for exposing RAM via DFU.
1444 Note: DFU spec refer to non-volatile memory usage, but 1444 Note: DFU spec refer to non-volatile memory usage, but
1445 allow usages beyond the scope of spec - here RAM usage, 1445 allow usages beyond the scope of spec - here RAM usage,
1446 one that would help mostly the developer. 1446 one that would help mostly the developer.
1447 1447
1448 CONFIG_SYS_DFU_DATA_BUF_SIZE 1448 CONFIG_SYS_DFU_DATA_BUF_SIZE
1449 Dfu transfer uses a buffer before writing data to the 1449 Dfu transfer uses a buffer before writing data to the
1450 raw storage device. Make the size (in bytes) of this buffer 1450 raw storage device. Make the size (in bytes) of this buffer
1451 configurable. The size of this buffer is also configurable 1451 configurable. The size of this buffer is also configurable
1452 through the "dfu_bufsiz" environment variable. 1452 through the "dfu_bufsiz" environment variable.
1453 1453
1454 CONFIG_SYS_DFU_MAX_FILE_SIZE 1454 CONFIG_SYS_DFU_MAX_FILE_SIZE
1455 When updating files rather than the raw storage device, 1455 When updating files rather than the raw storage device,
1456 we use a static buffer to copy the file into and then write 1456 we use a static buffer to copy the file into and then write
1457 the buffer once we've been given the whole file. Define 1457 the buffer once we've been given the whole file. Define
1458 this to the maximum filesize (in bytes) for the buffer. 1458 this to the maximum filesize (in bytes) for the buffer.
1459 Default is 4 MiB if undefined. 1459 Default is 4 MiB if undefined.
1460 1460
1461 DFU_DEFAULT_POLL_TIMEOUT 1461 DFU_DEFAULT_POLL_TIMEOUT
1462 Poll timeout [ms], is the timeout a device can send to the 1462 Poll timeout [ms], is the timeout a device can send to the
1463 host. The host must wait for this timeout before sending 1463 host. The host must wait for this timeout before sending
1464 a subsequent DFU_GET_STATUS request to the device. 1464 a subsequent DFU_GET_STATUS request to the device.
1465 1465
1466 DFU_MANIFEST_POLL_TIMEOUT 1466 DFU_MANIFEST_POLL_TIMEOUT
1467 Poll timeout [ms], which the device sends to the host when 1467 Poll timeout [ms], which the device sends to the host when
1468 entering dfuMANIFEST state. Host waits this timeout, before 1468 entering dfuMANIFEST state. Host waits this timeout, before
1469 sending again an USB request to the device. 1469 sending again an USB request to the device.
1470 1470
1471 - USB Device Android Fastboot support: 1471 - USB Device Android Fastboot support:
1472 CONFIG_USB_FUNCTION_FASTBOOT 1472 CONFIG_USB_FUNCTION_FASTBOOT
1473 This enables the USB part of the fastboot gadget 1473 This enables the USB part of the fastboot gadget
1474 1474
1475 CONFIG_CMD_FASTBOOT 1475 CONFIG_CMD_FASTBOOT
1476 This enables the command "fastboot" which enables the Android 1476 This enables the command "fastboot" which enables the Android
1477 fastboot mode for the platform's USB device. Fastboot is a USB 1477 fastboot mode for the platform's USB device. Fastboot is a USB
1478 protocol for downloading images, flashing and device control 1478 protocol for downloading images, flashing and device control
1479 used on Android devices. 1479 used on Android devices.
1480 See doc/README.android-fastboot for more information. 1480 See doc/README.android-fastboot for more information.
1481 1481
1482 CONFIG_ANDROID_BOOT_IMAGE 1482 CONFIG_ANDROID_BOOT_IMAGE
1483 This enables support for booting images which use the Android 1483 This enables support for booting images which use the Android
1484 image format header. 1484 image format header.
1485 1485
1486 CONFIG_FASTBOOT_BUF_ADDR 1486 CONFIG_FASTBOOT_BUF_ADDR
1487 The fastboot protocol requires a large memory buffer for 1487 The fastboot protocol requires a large memory buffer for
1488 downloads. Define this to the starting RAM address to use for 1488 downloads. Define this to the starting RAM address to use for
1489 downloaded images. 1489 downloaded images.
1490 1490
1491 CONFIG_FASTBOOT_BUF_SIZE 1491 CONFIG_FASTBOOT_BUF_SIZE
1492 The fastboot protocol requires a large memory buffer for 1492 The fastboot protocol requires a large memory buffer for
1493 downloads. This buffer should be as large as possible for a 1493 downloads. This buffer should be as large as possible for a
1494 platform. Define this to the size available RAM for fastboot. 1494 platform. Define this to the size available RAM for fastboot.
1495 1495
1496 CONFIG_FASTBOOT_FLASH 1496 CONFIG_FASTBOOT_FLASH
1497 The fastboot protocol includes a "flash" command for writing 1497 The fastboot protocol includes a "flash" command for writing
1498 the downloaded image to a non-volatile storage device. Define 1498 the downloaded image to a non-volatile storage device. Define
1499 this to enable the "fastboot flash" command. 1499 this to enable the "fastboot flash" command.
1500 1500
1501 CONFIG_FASTBOOT_FLASH_MMC_DEV 1501 CONFIG_FASTBOOT_FLASH_MMC_DEV
1502 The fastboot "flash" command requires additional information 1502 The fastboot "flash" command requires additional information
1503 regarding the non-volatile storage device. Define this to 1503 regarding the non-volatile storage device. Define this to
1504 the eMMC device that fastboot should use to store the image. 1504 the eMMC device that fastboot should use to store the image.
1505 1505
1506 CONFIG_FASTBOOT_GPT_NAME 1506 CONFIG_FASTBOOT_GPT_NAME
1507 The fastboot "flash" command supports writing the downloaded 1507 The fastboot "flash" command supports writing the downloaded
1508 image to the Protective MBR and the Primary GUID Partition 1508 image to the Protective MBR and the Primary GUID Partition
1509 Table. (Additionally, this downloaded image is post-processed 1509 Table. (Additionally, this downloaded image is post-processed
1510 to generate and write the Backup GUID Partition Table.) 1510 to generate and write the Backup GUID Partition Table.)
1511 This occurs when the specified "partition name" on the 1511 This occurs when the specified "partition name" on the
1512 "fastboot flash" command line matches this value. 1512 "fastboot flash" command line matches this value.
1513 The default is "gpt" if undefined. 1513 The default is "gpt" if undefined.
1514 1514
1515 CONFIG_FASTBOOT_MBR_NAME 1515 CONFIG_FASTBOOT_MBR_NAME
1516 The fastboot "flash" command supports writing the downloaded 1516 The fastboot "flash" command supports writing the downloaded
1517 image to DOS MBR. 1517 image to DOS MBR.
1518 This occurs when the "partition name" specified on the 1518 This occurs when the "partition name" specified on the
1519 "fastboot flash" command line matches this value. 1519 "fastboot flash" command line matches this value.
1520 If not defined the default value "mbr" is used. 1520 If not defined the default value "mbr" is used.
1521 1521
1522 - Journaling Flash filesystem support: 1522 - Journaling Flash filesystem support:
1523 CONFIG_JFFS2_NAND 1523 CONFIG_JFFS2_NAND
1524 Define these for a default partition on a NAND device 1524 Define these for a default partition on a NAND device
1525 1525
1526 CONFIG_SYS_JFFS2_FIRST_SECTOR, 1526 CONFIG_SYS_JFFS2_FIRST_SECTOR,
1527 CONFIG_SYS_JFFS2_FIRST_BANK, CONFIG_SYS_JFFS2_NUM_BANKS 1527 CONFIG_SYS_JFFS2_FIRST_BANK, CONFIG_SYS_JFFS2_NUM_BANKS
1528 Define these for a default partition on a NOR device 1528 Define these for a default partition on a NOR device
1529 1529
1530 - FAT(File Allocation Table) filesystem write function support: 1530 - FAT(File Allocation Table) filesystem write function support:
1531 CONFIG_FAT_WRITE 1531 CONFIG_FAT_WRITE
1532 1532
1533 Define this to enable support for saving memory data as a 1533 Define this to enable support for saving memory data as a
1534 file in FAT formatted partition. 1534 file in FAT formatted partition.
1535 1535
1536 This will also enable the command "fatwrite" enabling the 1536 This will also enable the command "fatwrite" enabling the
1537 user to write files to FAT. 1537 user to write files to FAT.
1538 1538
1539 - FAT(File Allocation Table) filesystem cluster size: 1539 - FAT(File Allocation Table) filesystem cluster size:
1540 CONFIG_FS_FAT_MAX_CLUSTSIZE 1540 CONFIG_FS_FAT_MAX_CLUSTSIZE
1541 1541
1542 Define the max cluster size for fat operations else 1542 Define the max cluster size for fat operations else
1543 a default value of 65536 will be defined. 1543 a default value of 65536 will be defined.
1544 1544
1545 - Keyboard Support: 1545 - Keyboard Support:
1546 See Kconfig help for available keyboard drivers. 1546 See Kconfig help for available keyboard drivers.
1547 1547
1548 CONFIG_KEYBOARD 1548 CONFIG_KEYBOARD
1549 1549
1550 Define this to enable a custom keyboard support. 1550 Define this to enable a custom keyboard support.
1551 This simply calls drv_keyboard_init() which must be 1551 This simply calls drv_keyboard_init() which must be
1552 defined in your board-specific files. This option is deprecated 1552 defined in your board-specific files. This option is deprecated
1553 and is only used by novena. For new boards, use driver model 1553 and is only used by novena. For new boards, use driver model
1554 instead. 1554 instead.
1555 1555
1556 - Video support: 1556 - Video support:
1557 CONFIG_FSL_DIU_FB 1557 CONFIG_FSL_DIU_FB
1558 Enable the Freescale DIU video driver. Reference boards for 1558 Enable the Freescale DIU video driver. Reference boards for
1559 SOCs that have a DIU should define this macro to enable DIU 1559 SOCs that have a DIU should define this macro to enable DIU
1560 support, and should also define these other macros: 1560 support, and should also define these other macros:
1561 1561
1562 CONFIG_SYS_DIU_ADDR 1562 CONFIG_SYS_DIU_ADDR
1563 CONFIG_VIDEO 1563 CONFIG_VIDEO
1564 CONFIG_CFB_CONSOLE 1564 CONFIG_CFB_CONSOLE
1565 CONFIG_VIDEO_SW_CURSOR 1565 CONFIG_VIDEO_SW_CURSOR
1566 CONFIG_VGA_AS_SINGLE_DEVICE 1566 CONFIG_VGA_AS_SINGLE_DEVICE
1567 CONFIG_VIDEO_LOGO 1567 CONFIG_VIDEO_LOGO
1568 CONFIG_VIDEO_BMP_LOGO 1568 CONFIG_VIDEO_BMP_LOGO
1569 1569
1570 The DIU driver will look for the 'video-mode' environment 1570 The DIU driver will look for the 'video-mode' environment
1571 variable, and if defined, enable the DIU as a console during 1571 variable, and if defined, enable the DIU as a console during
1572 boot. See the documentation file doc/README.video for a 1572 boot. See the documentation file doc/README.video for a
1573 description of this variable. 1573 description of this variable.
1574 1574
1575 - LCD Support: CONFIG_LCD 1575 - LCD Support: CONFIG_LCD
1576 1576
1577 Define this to enable LCD support (for output to LCD 1577 Define this to enable LCD support (for output to LCD
1578 display); also select one of the supported displays 1578 display); also select one of the supported displays
1579 by defining one of these: 1579 by defining one of these:
1580 1580
1581 CONFIG_ATMEL_LCD: 1581 CONFIG_ATMEL_LCD:
1582 1582
1583 HITACHI TX09D70VM1CCA, 3.5", 240x320. 1583 HITACHI TX09D70VM1CCA, 3.5", 240x320.
1584 1584
1585 CONFIG_NEC_NL6448AC33: 1585 CONFIG_NEC_NL6448AC33:
1586 1586
1587 NEC NL6448AC33-18. Active, color, single scan. 1587 NEC NL6448AC33-18. Active, color, single scan.
1588 1588
1589 CONFIG_NEC_NL6448BC20 1589 CONFIG_NEC_NL6448BC20
1590 1590
1591 NEC NL6448BC20-08. 6.5", 640x480. 1591 NEC NL6448BC20-08. 6.5", 640x480.
1592 Active, color, single scan. 1592 Active, color, single scan.
1593 1593
1594 CONFIG_NEC_NL6448BC33_54 1594 CONFIG_NEC_NL6448BC33_54
1595 1595
1596 NEC NL6448BC33-54. 10.4", 640x480. 1596 NEC NL6448BC33-54. 10.4", 640x480.
1597 Active, color, single scan. 1597 Active, color, single scan.
1598 1598
1599 CONFIG_SHARP_16x9 1599 CONFIG_SHARP_16x9
1600 1600
1601 Sharp 320x240. Active, color, single scan. 1601 Sharp 320x240. Active, color, single scan.
1602 It isn't 16x9, and I am not sure what it is. 1602 It isn't 16x9, and I am not sure what it is.
1603 1603
1604 CONFIG_SHARP_LQ64D341 1604 CONFIG_SHARP_LQ64D341
1605 1605
1606 Sharp LQ64D341 display, 640x480. 1606 Sharp LQ64D341 display, 640x480.
1607 Active, color, single scan. 1607 Active, color, single scan.
1608 1608
1609 CONFIG_HLD1045 1609 CONFIG_HLD1045
1610 1610
1611 HLD1045 display, 640x480. 1611 HLD1045 display, 640x480.
1612 Active, color, single scan. 1612 Active, color, single scan.
1613 1613
1614 CONFIG_OPTREX_BW 1614 CONFIG_OPTREX_BW
1615 1615
1616 Optrex CBL50840-2 NF-FW 99 22 M5 1616 Optrex CBL50840-2 NF-FW 99 22 M5
1617 or 1617 or
1618 Hitachi LMG6912RPFC-00T 1618 Hitachi LMG6912RPFC-00T
1619 or 1619 or
1620 Hitachi SP14Q002 1620 Hitachi SP14Q002
1621 1621
1622 320x240. Black & white. 1622 320x240. Black & white.
1623 1623
1624 CONFIG_LCD_ALIGNMENT 1624 CONFIG_LCD_ALIGNMENT
1625 1625
1626 Normally the LCD is page-aligned (typically 4KB). If this is 1626 Normally the LCD is page-aligned (typically 4KB). If this is
1627 defined then the LCD will be aligned to this value instead. 1627 defined then the LCD will be aligned to this value instead.
1628 For ARM it is sometimes useful to use MMU_SECTION_SIZE 1628 For ARM it is sometimes useful to use MMU_SECTION_SIZE
1629 here, since it is cheaper to change data cache settings on 1629 here, since it is cheaper to change data cache settings on
1630 a per-section basis. 1630 a per-section basis.
1631 1631
1632 1632
1633 CONFIG_LCD_ROTATION 1633 CONFIG_LCD_ROTATION
1634 1634
1635 Sometimes, for example if the display is mounted in portrait 1635 Sometimes, for example if the display is mounted in portrait
1636 mode or even if it's mounted landscape but rotated by 180degree, 1636 mode or even if it's mounted landscape but rotated by 180degree,
1637 we need to rotate our content of the display relative to the 1637 we need to rotate our content of the display relative to the
1638 framebuffer, so that user can read the messages which are 1638 framebuffer, so that user can read the messages which are
1639 printed out. 1639 printed out.
1640 Once CONFIG_LCD_ROTATION is defined, the lcd_console will be 1640 Once CONFIG_LCD_ROTATION is defined, the lcd_console will be
1641 initialized with a given rotation from "vl_rot" out of 1641 initialized with a given rotation from "vl_rot" out of
1642 "vidinfo_t" which is provided by the board specific code. 1642 "vidinfo_t" which is provided by the board specific code.
1643 The value for vl_rot is coded as following (matching to 1643 The value for vl_rot is coded as following (matching to
1644 fbcon=rotate:<n> linux-kernel commandline): 1644 fbcon=rotate:<n> linux-kernel commandline):
1645 0 = no rotation respectively 0 degree 1645 0 = no rotation respectively 0 degree
1646 1 = 90 degree rotation 1646 1 = 90 degree rotation
1647 2 = 180 degree rotation 1647 2 = 180 degree rotation
1648 3 = 270 degree rotation 1648 3 = 270 degree rotation
1649 1649
1650 If CONFIG_LCD_ROTATION is not defined, the console will be 1650 If CONFIG_LCD_ROTATION is not defined, the console will be
1651 initialized with 0degree rotation. 1651 initialized with 0degree rotation.
1652 1652
1653 CONFIG_LCD_BMP_RLE8 1653 CONFIG_LCD_BMP_RLE8
1654 1654
1655 Support drawing of RLE8-compressed bitmaps on the LCD. 1655 Support drawing of RLE8-compressed bitmaps on the LCD.
1656 1656
1657 CONFIG_I2C_EDID 1657 CONFIG_I2C_EDID
1658 1658
1659 Enables an 'i2c edid' command which can read EDID 1659 Enables an 'i2c edid' command which can read EDID
1660 information over I2C from an attached LCD display. 1660 information over I2C from an attached LCD display.
1661 1661
1662 - Splash Screen Support: CONFIG_SPLASH_SCREEN 1662 - Splash Screen Support: CONFIG_SPLASH_SCREEN
1663 1663
1664 If this option is set, the environment is checked for 1664 If this option is set, the environment is checked for
1665 a variable "splashimage". If found, the usual display 1665 a variable "splashimage". If found, the usual display
1666 of logo, copyright and system information on the LCD 1666 of logo, copyright and system information on the LCD
1667 is suppressed and the BMP image at the address 1667 is suppressed and the BMP image at the address
1668 specified in "splashimage" is loaded instead. The 1668 specified in "splashimage" is loaded instead. The
1669 console is redirected to the "nulldev", too. This 1669 console is redirected to the "nulldev", too. This
1670 allows for a "silent" boot where a splash screen is 1670 allows for a "silent" boot where a splash screen is
1671 loaded very quickly after power-on. 1671 loaded very quickly after power-on.
1672 1672
1673 CONFIG_SPLASHIMAGE_GUARD 1673 CONFIG_SPLASHIMAGE_GUARD
1674 1674
1675 If this option is set, then U-Boot will prevent the environment 1675 If this option is set, then U-Boot will prevent the environment
1676 variable "splashimage" from being set to a problematic address 1676 variable "splashimage" from being set to a problematic address
1677 (see doc/README.displaying-bmps). 1677 (see doc/README.displaying-bmps).
1678 This option is useful for targets where, due to alignment 1678 This option is useful for targets where, due to alignment
1679 restrictions, an improperly aligned BMP image will cause a data 1679 restrictions, an improperly aligned BMP image will cause a data
1680 abort. If you think you will not have problems with unaligned 1680 abort. If you think you will not have problems with unaligned
1681 accesses (for example because your toolchain prevents them) 1681 accesses (for example because your toolchain prevents them)
1682 there is no need to set this option. 1682 there is no need to set this option.
1683 1683
1684 CONFIG_SPLASH_SCREEN_ALIGN 1684 CONFIG_SPLASH_SCREEN_ALIGN
1685 1685
1686 If this option is set the splash image can be freely positioned 1686 If this option is set the splash image can be freely positioned
1687 on the screen. Environment variable "splashpos" specifies the 1687 on the screen. Environment variable "splashpos" specifies the
1688 position as "x,y". If a positive number is given it is used as 1688 position as "x,y". If a positive number is given it is used as
1689 number of pixel from left/top. If a negative number is given it 1689 number of pixel from left/top. If a negative number is given it
1690 is used as number of pixel from right/bottom. You can also 1690 is used as number of pixel from right/bottom. You can also
1691 specify 'm' for centering the image. 1691 specify 'm' for centering the image.
1692 1692
1693 Example: 1693 Example:
1694 setenv splashpos m,m 1694 setenv splashpos m,m
1695 => image at center of screen 1695 => image at center of screen
1696 1696
1697 setenv splashpos 30,20 1697 setenv splashpos 30,20
1698 => image at x = 30 and y = 20 1698 => image at x = 30 and y = 20
1699 1699
1700 setenv splashpos -10,m 1700 setenv splashpos -10,m
1701 => vertically centered image 1701 => vertically centered image
1702 at x = dspWidth - bmpWidth - 9 1702 at x = dspWidth - bmpWidth - 9
1703 1703
1704 - Gzip compressed BMP image support: CONFIG_VIDEO_BMP_GZIP 1704 - Gzip compressed BMP image support: CONFIG_VIDEO_BMP_GZIP
1705 1705
1706 If this option is set, additionally to standard BMP 1706 If this option is set, additionally to standard BMP
1707 images, gzipped BMP images can be displayed via the 1707 images, gzipped BMP images can be displayed via the
1708 splashscreen support or the bmp command. 1708 splashscreen support or the bmp command.
1709 1709
1710 - Run length encoded BMP image (RLE8) support: CONFIG_VIDEO_BMP_RLE8 1710 - Run length encoded BMP image (RLE8) support: CONFIG_VIDEO_BMP_RLE8
1711 1711
1712 If this option is set, 8-bit RLE compressed BMP images 1712 If this option is set, 8-bit RLE compressed BMP images
1713 can be displayed via the splashscreen support or the 1713 can be displayed via the splashscreen support or the
1714 bmp command. 1714 bmp command.
1715 1715
1716 - Compression support: 1716 - Compression support:
1717 CONFIG_GZIP 1717 CONFIG_GZIP
1718 1718
1719 Enabled by default to support gzip compressed images. 1719 Enabled by default to support gzip compressed images.
1720 1720
1721 CONFIG_BZIP2 1721 CONFIG_BZIP2
1722 1722
1723 If this option is set, support for bzip2 compressed 1723 If this option is set, support for bzip2 compressed
1724 images is included. If not, only uncompressed and gzip 1724 images is included. If not, only uncompressed and gzip
1725 compressed images are supported. 1725 compressed images are supported.
1726 1726
1727 NOTE: the bzip2 algorithm requires a lot of RAM, so 1727 NOTE: the bzip2 algorithm requires a lot of RAM, so
1728 the malloc area (as defined by CONFIG_SYS_MALLOC_LEN) should 1728 the malloc area (as defined by CONFIG_SYS_MALLOC_LEN) should
1729 be at least 4MB. 1729 be at least 4MB.
1730 1730
1731 CONFIG_LZMA 1731 CONFIG_LZMA
1732 1732
1733 If this option is set, support for lzma compressed 1733 If this option is set, support for lzma compressed
1734 images is included. 1734 images is included.
1735 1735
1736 Note: The LZMA algorithm adds between 2 and 4KB of code and it 1736 Note: The LZMA algorithm adds between 2 and 4KB of code and it
1737 requires an amount of dynamic memory that is given by the 1737 requires an amount of dynamic memory that is given by the
1738 formula: 1738 formula:
1739 1739
1740 (1846 + 768 << (lc + lp)) * sizeof(uint16) 1740 (1846 + 768 << (lc + lp)) * sizeof(uint16)
1741 1741
1742 Where lc and lp stand for, respectively, Literal context bits 1742 Where lc and lp stand for, respectively, Literal context bits
1743 and Literal pos bits. 1743 and Literal pos bits.
1744 1744
1745 This value is upper-bounded by 14MB in the worst case. Anyway, 1745 This value is upper-bounded by 14MB in the worst case. Anyway,
1746 for a ~4MB large kernel image, we have lc=3 and lp=0 for a 1746 for a ~4MB large kernel image, we have lc=3 and lp=0 for a
1747 total amount of (1846 + 768 << (3 + 0)) * 2 = ~41KB... that is 1747 total amount of (1846 + 768 << (3 + 0)) * 2 = ~41KB... that is
1748 a very small buffer. 1748 a very small buffer.
1749 1749
1750 Use the lzmainfo tool to determinate the lc and lp values and 1750 Use the lzmainfo tool to determinate the lc and lp values and
1751 then calculate the amount of needed dynamic memory (ensuring 1751 then calculate the amount of needed dynamic memory (ensuring
1752 the appropriate CONFIG_SYS_MALLOC_LEN value). 1752 the appropriate CONFIG_SYS_MALLOC_LEN value).
1753 1753
1754 CONFIG_LZO 1754 CONFIG_LZO
1755 1755
1756 If this option is set, support for LZO compressed images 1756 If this option is set, support for LZO compressed images
1757 is included. 1757 is included.
1758 1758
1759 - MII/PHY support: 1759 - MII/PHY support:
1760 CONFIG_PHY_ADDR 1760 CONFIG_PHY_ADDR
1761 1761
1762 The address of PHY on MII bus. 1762 The address of PHY on MII bus.
1763 1763
1764 CONFIG_PHY_CLOCK_FREQ (ppc4xx) 1764 CONFIG_PHY_CLOCK_FREQ (ppc4xx)
1765 1765
1766 The clock frequency of the MII bus 1766 The clock frequency of the MII bus
1767 1767
1768 CONFIG_PHY_GIGE 1768 CONFIG_PHY_GIGE
1769 1769
1770 If this option is set, support for speed/duplex 1770 If this option is set, support for speed/duplex
1771 detection of gigabit PHY is included. 1771 detection of gigabit PHY is included.
1772 1772
1773 CONFIG_PHY_RESET_DELAY 1773 CONFIG_PHY_RESET_DELAY
1774 1774
1775 Some PHY like Intel LXT971A need extra delay after 1775 Some PHY like Intel LXT971A need extra delay after
1776 reset before any MII register access is possible. 1776 reset before any MII register access is possible.
1777 For such PHY, set this option to the usec delay 1777 For such PHY, set this option to the usec delay
1778 required. (minimum 300usec for LXT971A) 1778 required. (minimum 300usec for LXT971A)
1779 1779
1780 CONFIG_PHY_CMD_DELAY (ppc4xx) 1780 CONFIG_PHY_CMD_DELAY (ppc4xx)
1781 1781
1782 Some PHY like Intel LXT971A need extra delay after 1782 Some PHY like Intel LXT971A need extra delay after
1783 command issued before MII status register can be read 1783 command issued before MII status register can be read
1784 1784
1785 - IP address: 1785 - IP address:
1786 CONFIG_IPADDR 1786 CONFIG_IPADDR
1787 1787
1788 Define a default value for the IP address to use for 1788 Define a default value for the IP address to use for
1789 the default Ethernet interface, in case this is not 1789 the default Ethernet interface, in case this is not
1790 determined through e.g. bootp. 1790 determined through e.g. bootp.
1791 (Environment variable "ipaddr") 1791 (Environment variable "ipaddr")
1792 1792
1793 - Server IP address: 1793 - Server IP address:
1794 CONFIG_SERVERIP 1794 CONFIG_SERVERIP
1795 1795
1796 Defines a default value for the IP address of a TFTP 1796 Defines a default value for the IP address of a TFTP
1797 server to contact when using the "tftboot" command. 1797 server to contact when using the "tftboot" command.
1798 (Environment variable "serverip") 1798 (Environment variable "serverip")
1799 1799
1800 CONFIG_KEEP_SERVERADDR 1800 CONFIG_KEEP_SERVERADDR
1801 1801
1802 Keeps the server's MAC address, in the env 'serveraddr' 1802 Keeps the server's MAC address, in the env 'serveraddr'
1803 for passing to bootargs (like Linux's netconsole option) 1803 for passing to bootargs (like Linux's netconsole option)
1804 1804
1805 - Gateway IP address: 1805 - Gateway IP address:
1806 CONFIG_GATEWAYIP 1806 CONFIG_GATEWAYIP
1807 1807
1808 Defines a default value for the IP address of the 1808 Defines a default value for the IP address of the
1809 default router where packets to other networks are 1809 default router where packets to other networks are
1810 sent to. 1810 sent to.
1811 (Environment variable "gatewayip") 1811 (Environment variable "gatewayip")
1812 1812
1813 - Subnet mask: 1813 - Subnet mask:
1814 CONFIG_NETMASK 1814 CONFIG_NETMASK
1815 1815
1816 Defines a default value for the subnet mask (or 1816 Defines a default value for the subnet mask (or
1817 routing prefix) which is used to determine if an IP 1817 routing prefix) which is used to determine if an IP
1818 address belongs to the local subnet or needs to be 1818 address belongs to the local subnet or needs to be
1819 forwarded through a router. 1819 forwarded through a router.
1820 (Environment variable "netmask") 1820 (Environment variable "netmask")
1821 1821
1822 - Multicast TFTP Mode: 1822 - Multicast TFTP Mode:
1823 CONFIG_MCAST_TFTP 1823 CONFIG_MCAST_TFTP
1824 1824
1825 Defines whether you want to support multicast TFTP as per 1825 Defines whether you want to support multicast TFTP as per
1826 rfc-2090; for example to work with atftp. Lets lots of targets 1826 rfc-2090; for example to work with atftp. Lets lots of targets
1827 tftp down the same boot image concurrently. Note: the Ethernet 1827 tftp down the same boot image concurrently. Note: the Ethernet
1828 driver in use must provide a function: mcast() to join/leave a 1828 driver in use must provide a function: mcast() to join/leave a
1829 multicast group. 1829 multicast group.
1830 1830
1831 - BOOTP Recovery Mode: 1831 - BOOTP Recovery Mode:
1832 CONFIG_BOOTP_RANDOM_DELAY 1832 CONFIG_BOOTP_RANDOM_DELAY
1833 1833
1834 If you have many targets in a network that try to 1834 If you have many targets in a network that try to
1835 boot using BOOTP, you may want to avoid that all 1835 boot using BOOTP, you may want to avoid that all
1836 systems send out BOOTP requests at precisely the same 1836 systems send out BOOTP requests at precisely the same
1837 moment (which would happen for instance at recovery 1837 moment (which would happen for instance at recovery
1838 from a power failure, when all systems will try to 1838 from a power failure, when all systems will try to
1839 boot, thus flooding the BOOTP server. Defining 1839 boot, thus flooding the BOOTP server. Defining
1840 CONFIG_BOOTP_RANDOM_DELAY causes a random delay to be 1840 CONFIG_BOOTP_RANDOM_DELAY causes a random delay to be
1841 inserted before sending out BOOTP requests. The 1841 inserted before sending out BOOTP requests. The
1842 following delays are inserted then: 1842 following delays are inserted then:
1843 1843
1844 1st BOOTP request: delay 0 ... 1 sec 1844 1st BOOTP request: delay 0 ... 1 sec
1845 2nd BOOTP request: delay 0 ... 2 sec 1845 2nd BOOTP request: delay 0 ... 2 sec
1846 3rd BOOTP request: delay 0 ... 4 sec 1846 3rd BOOTP request: delay 0 ... 4 sec
1847 4th and following 1847 4th and following
1848 BOOTP requests: delay 0 ... 8 sec 1848 BOOTP requests: delay 0 ... 8 sec
1849 1849
1850 CONFIG_BOOTP_ID_CACHE_SIZE 1850 CONFIG_BOOTP_ID_CACHE_SIZE
1851 1851
1852 BOOTP packets are uniquely identified using a 32-bit ID. The 1852 BOOTP packets are uniquely identified using a 32-bit ID. The
1853 server will copy the ID from client requests to responses and 1853 server will copy the ID from client requests to responses and
1854 U-Boot will use this to determine if it is the destination of 1854 U-Boot will use this to determine if it is the destination of
1855 an incoming response. Some servers will check that addresses 1855 an incoming response. Some servers will check that addresses
1856 aren't in use before handing them out (usually using an ARP 1856 aren't in use before handing them out (usually using an ARP
1857 ping) and therefore take up to a few hundred milliseconds to 1857 ping) and therefore take up to a few hundred milliseconds to
1858 respond. Network congestion may also influence the time it 1858 respond. Network congestion may also influence the time it
1859 takes for a response to make it back to the client. If that 1859 takes for a response to make it back to the client. If that
1860 time is too long, U-Boot will retransmit requests. In order 1860 time is too long, U-Boot will retransmit requests. In order
1861 to allow earlier responses to still be accepted after these 1861 to allow earlier responses to still be accepted after these
1862 retransmissions, U-Boot's BOOTP client keeps a small cache of 1862 retransmissions, U-Boot's BOOTP client keeps a small cache of
1863 IDs. The CONFIG_BOOTP_ID_CACHE_SIZE controls the size of this 1863 IDs. The CONFIG_BOOTP_ID_CACHE_SIZE controls the size of this
1864 cache. The default is to keep IDs for up to four outstanding 1864 cache. The default is to keep IDs for up to four outstanding
1865 requests. Increasing this will allow U-Boot to accept offers 1865 requests. Increasing this will allow U-Boot to accept offers
1866 from a BOOTP client in networks with unusually high latency. 1866 from a BOOTP client in networks with unusually high latency.
1867 1867
1868 - DHCP Advanced Options: 1868 - DHCP Advanced Options:
1869 You can fine tune the DHCP functionality by defining 1869 You can fine tune the DHCP functionality by defining
1870 CONFIG_BOOTP_* symbols: 1870 CONFIG_BOOTP_* symbols:
1871 1871
1872 CONFIG_BOOTP_SUBNETMASK 1872 CONFIG_BOOTP_SUBNETMASK
1873 CONFIG_BOOTP_GATEWAY 1873 CONFIG_BOOTP_GATEWAY
1874 CONFIG_BOOTP_HOSTNAME 1874 CONFIG_BOOTP_HOSTNAME
1875 CONFIG_BOOTP_NISDOMAIN 1875 CONFIG_BOOTP_NISDOMAIN
1876 CONFIG_BOOTP_BOOTPATH 1876 CONFIG_BOOTP_BOOTPATH
1877 CONFIG_BOOTP_BOOTFILESIZE 1877 CONFIG_BOOTP_BOOTFILESIZE
1878 CONFIG_BOOTP_DNS 1878 CONFIG_BOOTP_DNS
1879 CONFIG_BOOTP_DNS2 1879 CONFIG_BOOTP_DNS2
1880 CONFIG_BOOTP_SEND_HOSTNAME 1880 CONFIG_BOOTP_SEND_HOSTNAME
1881 CONFIG_BOOTP_NTPSERVER 1881 CONFIG_BOOTP_NTPSERVER
1882 CONFIG_BOOTP_TIMEOFFSET 1882 CONFIG_BOOTP_TIMEOFFSET
1883 CONFIG_BOOTP_VENDOREX 1883 CONFIG_BOOTP_VENDOREX
1884 CONFIG_BOOTP_MAY_FAIL 1884 CONFIG_BOOTP_MAY_FAIL
1885 1885
1886 CONFIG_BOOTP_SERVERIP - TFTP server will be the serverip 1886 CONFIG_BOOTP_SERVERIP - TFTP server will be the serverip
1887 environment variable, not the BOOTP server. 1887 environment variable, not the BOOTP server.
1888 1888
1889 CONFIG_BOOTP_MAY_FAIL - If the DHCP server is not found 1889 CONFIG_BOOTP_MAY_FAIL - If the DHCP server is not found
1890 after the configured retry count, the call will fail 1890 after the configured retry count, the call will fail
1891 instead of starting over. This can be used to fail over 1891 instead of starting over. This can be used to fail over
1892 to Link-local IP address configuration if the DHCP server 1892 to Link-local IP address configuration if the DHCP server
1893 is not available. 1893 is not available.
1894 1894
1895 CONFIG_BOOTP_DNS2 - If a DHCP client requests the DNS 1895 CONFIG_BOOTP_DNS2 - If a DHCP client requests the DNS
1896 serverip from a DHCP server, it is possible that more 1896 serverip from a DHCP server, it is possible that more
1897 than one DNS serverip is offered to the client. 1897 than one DNS serverip is offered to the client.
1898 If CONFIG_BOOTP_DNS2 is enabled, the secondary DNS 1898 If CONFIG_BOOTP_DNS2 is enabled, the secondary DNS
1899 serverip will be stored in the additional environment 1899 serverip will be stored in the additional environment
1900 variable "dnsip2". The first DNS serverip is always 1900 variable "dnsip2". The first DNS serverip is always
1901 stored in the variable "dnsip", when CONFIG_BOOTP_DNS 1901 stored in the variable "dnsip", when CONFIG_BOOTP_DNS
1902 is defined. 1902 is defined.
1903 1903
1904 CONFIG_BOOTP_SEND_HOSTNAME - Some DHCP servers are capable 1904 CONFIG_BOOTP_SEND_HOSTNAME - Some DHCP servers are capable
1905 to do a dynamic update of a DNS server. To do this, they 1905 to do a dynamic update of a DNS server. To do this, they
1906 need the hostname of the DHCP requester. 1906 need the hostname of the DHCP requester.
1907 If CONFIG_BOOTP_SEND_HOSTNAME is defined, the content 1907 If CONFIG_BOOTP_SEND_HOSTNAME is defined, the content
1908 of the "hostname" environment variable is passed as 1908 of the "hostname" environment variable is passed as
1909 option 12 to the DHCP server. 1909 option 12 to the DHCP server.
1910 1910
1911 CONFIG_BOOTP_DHCP_REQUEST_DELAY 1911 CONFIG_BOOTP_DHCP_REQUEST_DELAY
1912 1912
1913 A 32bit value in microseconds for a delay between 1913 A 32bit value in microseconds for a delay between
1914 receiving a "DHCP Offer" and sending the "DHCP Request". 1914 receiving a "DHCP Offer" and sending the "DHCP Request".
1915 This fixes a problem with certain DHCP servers that don't 1915 This fixes a problem with certain DHCP servers that don't
1916 respond 100% of the time to a "DHCP request". E.g. On an 1916 respond 100% of the time to a "DHCP request". E.g. On an
1917 AT91RM9200 processor running at 180MHz, this delay needed 1917 AT91RM9200 processor running at 180MHz, this delay needed
1918 to be *at least* 15,000 usec before a Windows Server 2003 1918 to be *at least* 15,000 usec before a Windows Server 2003
1919 DHCP server would reply 100% of the time. I recommend at 1919 DHCP server would reply 100% of the time. I recommend at
1920 least 50,000 usec to be safe. The alternative is to hope 1920 least 50,000 usec to be safe. The alternative is to hope
1921 that one of the retries will be successful but note that 1921 that one of the retries will be successful but note that
1922 the DHCP timeout and retry process takes a longer than 1922 the DHCP timeout and retry process takes a longer than
1923 this delay. 1923 this delay.
1924 1924
1925 - Link-local IP address negotiation: 1925 - Link-local IP address negotiation:
1926 Negotiate with other link-local clients on the local network 1926 Negotiate with other link-local clients on the local network
1927 for an address that doesn't require explicit configuration. 1927 for an address that doesn't require explicit configuration.
1928 This is especially useful if a DHCP server cannot be guaranteed 1928 This is especially useful if a DHCP server cannot be guaranteed
1929 to exist in all environments that the device must operate. 1929 to exist in all environments that the device must operate.
1930 1930
1931 See doc/README.link-local for more information. 1931 See doc/README.link-local for more information.
1932 1932
1933 - CDP Options: 1933 - CDP Options:
1934 CONFIG_CDP_DEVICE_ID 1934 CONFIG_CDP_DEVICE_ID
1935 1935
1936 The device id used in CDP trigger frames. 1936 The device id used in CDP trigger frames.
1937 1937
1938 CONFIG_CDP_DEVICE_ID_PREFIX 1938 CONFIG_CDP_DEVICE_ID_PREFIX
1939 1939
1940 A two character string which is prefixed to the MAC address 1940 A two character string which is prefixed to the MAC address
1941 of the device. 1941 of the device.
1942 1942
1943 CONFIG_CDP_PORT_ID 1943 CONFIG_CDP_PORT_ID
1944 1944
1945 A printf format string which contains the ascii name of 1945 A printf format string which contains the ascii name of
1946 the port. Normally is set to "eth%d" which sets 1946 the port. Normally is set to "eth%d" which sets
1947 eth0 for the first Ethernet, eth1 for the second etc. 1947 eth0 for the first Ethernet, eth1 for the second etc.
1948 1948
1949 CONFIG_CDP_CAPABILITIES 1949 CONFIG_CDP_CAPABILITIES
1950 1950
1951 A 32bit integer which indicates the device capabilities; 1951 A 32bit integer which indicates the device capabilities;
1952 0x00000010 for a normal host which does not forwards. 1952 0x00000010 for a normal host which does not forwards.
1953 1953
1954 CONFIG_CDP_VERSION 1954 CONFIG_CDP_VERSION
1955 1955
1956 An ascii string containing the version of the software. 1956 An ascii string containing the version of the software.
1957 1957
1958 CONFIG_CDP_PLATFORM 1958 CONFIG_CDP_PLATFORM
1959 1959
1960 An ascii string containing the name of the platform. 1960 An ascii string containing the name of the platform.
1961 1961
1962 CONFIG_CDP_TRIGGER 1962 CONFIG_CDP_TRIGGER
1963 1963
1964 A 32bit integer sent on the trigger. 1964 A 32bit integer sent on the trigger.
1965 1965
1966 CONFIG_CDP_POWER_CONSUMPTION 1966 CONFIG_CDP_POWER_CONSUMPTION
1967 1967
1968 A 16bit integer containing the power consumption of the 1968 A 16bit integer containing the power consumption of the
1969 device in .1 of milliwatts. 1969 device in .1 of milliwatts.
1970 1970
1971 CONFIG_CDP_APPLIANCE_VLAN_TYPE 1971 CONFIG_CDP_APPLIANCE_VLAN_TYPE
1972 1972
1973 A byte containing the id of the VLAN. 1973 A byte containing the id of the VLAN.
1974 1974
1975 - Status LED: CONFIG_LED_STATUS 1975 - Status LED: CONFIG_LED_STATUS
1976 1976
1977 Several configurations allow to display the current 1977 Several configurations allow to display the current
1978 status using a LED. For instance, the LED will blink 1978 status using a LED. For instance, the LED will blink
1979 fast while running U-Boot code, stop blinking as 1979 fast while running U-Boot code, stop blinking as
1980 soon as a reply to a BOOTP request was received, and 1980 soon as a reply to a BOOTP request was received, and
1981 start blinking slow once the Linux kernel is running 1981 start blinking slow once the Linux kernel is running
1982 (supported by a status LED driver in the Linux 1982 (supported by a status LED driver in the Linux
1983 kernel). Defining CONFIG_LED_STATUS enables this 1983 kernel). Defining CONFIG_LED_STATUS enables this
1984 feature in U-Boot. 1984 feature in U-Boot.
1985 1985
1986 Additional options: 1986 Additional options:
1987 1987
1988 CONFIG_LED_STATUS_GPIO 1988 CONFIG_LED_STATUS_GPIO
1989 The status LED can be connected to a GPIO pin. 1989 The status LED can be connected to a GPIO pin.
1990 In such cases, the gpio_led driver can be used as a 1990 In such cases, the gpio_led driver can be used as a
1991 status LED backend implementation. Define CONFIG_LED_STATUS_GPIO 1991 status LED backend implementation. Define CONFIG_LED_STATUS_GPIO
1992 to include the gpio_led driver in the U-Boot binary. 1992 to include the gpio_led driver in the U-Boot binary.
1993 1993
1994 CONFIG_GPIO_LED_INVERTED_TABLE 1994 CONFIG_GPIO_LED_INVERTED_TABLE
1995 Some GPIO connected LEDs may have inverted polarity in which 1995 Some GPIO connected LEDs may have inverted polarity in which
1996 case the GPIO high value corresponds to LED off state and 1996 case the GPIO high value corresponds to LED off state and
1997 GPIO low value corresponds to LED on state. 1997 GPIO low value corresponds to LED on state.
1998 In such cases CONFIG_GPIO_LED_INVERTED_TABLE may be defined 1998 In such cases CONFIG_GPIO_LED_INVERTED_TABLE may be defined
1999 with a list of GPIO LEDs that have inverted polarity. 1999 with a list of GPIO LEDs that have inverted polarity.
2000 2000
2001 - CAN Support: CONFIG_CAN_DRIVER 2001 - CAN Support: CONFIG_CAN_DRIVER
2002 2002
2003 Defining CONFIG_CAN_DRIVER enables CAN driver support 2003 Defining CONFIG_CAN_DRIVER enables CAN driver support
2004 on those systems that support this (optional) 2004 on those systems that support this (optional)
2005 feature, like the TQM8xxL modules. 2005 feature, like the TQM8xxL modules.
2006 2006
2007 - I2C Support: CONFIG_SYS_I2C 2007 - I2C Support: CONFIG_SYS_I2C
2008 2008
2009 This enable the NEW i2c subsystem, and will allow you to use 2009 This enable the NEW i2c subsystem, and will allow you to use
2010 i2c commands at the u-boot command line (as long as you set 2010 i2c commands at the u-boot command line (as long as you set
2011 CONFIG_CMD_I2C in CONFIG_COMMANDS) and communicate with i2c 2011 CONFIG_CMD_I2C in CONFIG_COMMANDS) and communicate with i2c
2012 based realtime clock chips or other i2c devices. See 2012 based realtime clock chips or other i2c devices. See
2013 common/cmd_i2c.c for a description of the command line 2013 common/cmd_i2c.c for a description of the command line
2014 interface. 2014 interface.
2015 2015
2016 ported i2c driver to the new framework: 2016 ported i2c driver to the new framework:
2017 - drivers/i2c/soft_i2c.c: 2017 - drivers/i2c/soft_i2c.c:
2018 - activate first bus with CONFIG_SYS_I2C_SOFT define 2018 - activate first bus with CONFIG_SYS_I2C_SOFT define
2019 CONFIG_SYS_I2C_SOFT_SPEED and CONFIG_SYS_I2C_SOFT_SLAVE 2019 CONFIG_SYS_I2C_SOFT_SPEED and CONFIG_SYS_I2C_SOFT_SLAVE
2020 for defining speed and slave address 2020 for defining speed and slave address
2021 - activate second bus with I2C_SOFT_DECLARATIONS2 define 2021 - activate second bus with I2C_SOFT_DECLARATIONS2 define
2022 CONFIG_SYS_I2C_SOFT_SPEED_2 and CONFIG_SYS_I2C_SOFT_SLAVE_2 2022 CONFIG_SYS_I2C_SOFT_SPEED_2 and CONFIG_SYS_I2C_SOFT_SLAVE_2
2023 for defining speed and slave address 2023 for defining speed and slave address
2024 - activate third bus with I2C_SOFT_DECLARATIONS3 define 2024 - activate third bus with I2C_SOFT_DECLARATIONS3 define
2025 CONFIG_SYS_I2C_SOFT_SPEED_3 and CONFIG_SYS_I2C_SOFT_SLAVE_3 2025 CONFIG_SYS_I2C_SOFT_SPEED_3 and CONFIG_SYS_I2C_SOFT_SLAVE_3
2026 for defining speed and slave address 2026 for defining speed and slave address
2027 - activate fourth bus with I2C_SOFT_DECLARATIONS4 define 2027 - activate fourth bus with I2C_SOFT_DECLARATIONS4 define
2028 CONFIG_SYS_I2C_SOFT_SPEED_4 and CONFIG_SYS_I2C_SOFT_SLAVE_4 2028 CONFIG_SYS_I2C_SOFT_SPEED_4 and CONFIG_SYS_I2C_SOFT_SLAVE_4
2029 for defining speed and slave address 2029 for defining speed and slave address
2030 2030
2031 - drivers/i2c/fsl_i2c.c: 2031 - drivers/i2c/fsl_i2c.c:
2032 - activate i2c driver with CONFIG_SYS_I2C_FSL 2032 - activate i2c driver with CONFIG_SYS_I2C_FSL
2033 define CONFIG_SYS_FSL_I2C_OFFSET for setting the register 2033 define CONFIG_SYS_FSL_I2C_OFFSET for setting the register
2034 offset CONFIG_SYS_FSL_I2C_SPEED for the i2c speed and 2034 offset CONFIG_SYS_FSL_I2C_SPEED for the i2c speed and
2035 CONFIG_SYS_FSL_I2C_SLAVE for the slave addr of the first 2035 CONFIG_SYS_FSL_I2C_SLAVE for the slave addr of the first
2036 bus. 2036 bus.
2037 - If your board supports a second fsl i2c bus, define 2037 - If your board supports a second fsl i2c bus, define
2038 CONFIG_SYS_FSL_I2C2_OFFSET for the register offset 2038 CONFIG_SYS_FSL_I2C2_OFFSET for the register offset
2039 CONFIG_SYS_FSL_I2C2_SPEED for the speed and 2039 CONFIG_SYS_FSL_I2C2_SPEED for the speed and
2040 CONFIG_SYS_FSL_I2C2_SLAVE for the slave address of the 2040 CONFIG_SYS_FSL_I2C2_SLAVE for the slave address of the
2041 second bus. 2041 second bus.
2042 2042
2043 - drivers/i2c/tegra_i2c.c: 2043 - drivers/i2c/tegra_i2c.c:
2044 - activate this driver with CONFIG_SYS_I2C_TEGRA 2044 - activate this driver with CONFIG_SYS_I2C_TEGRA
2045 - This driver adds 4 i2c buses with a fix speed from 2045 - This driver adds 4 i2c buses with a fix speed from
2046 100000 and the slave addr 0! 2046 100000 and the slave addr 0!
2047 2047
2048 - drivers/i2c/ppc4xx_i2c.c 2048 - drivers/i2c/ppc4xx_i2c.c
2049 - activate this driver with CONFIG_SYS_I2C_PPC4XX 2049 - activate this driver with CONFIG_SYS_I2C_PPC4XX
2050 - CONFIG_SYS_I2C_PPC4XX_CH0 activate hardware channel 0 2050 - CONFIG_SYS_I2C_PPC4XX_CH0 activate hardware channel 0
2051 - CONFIG_SYS_I2C_PPC4XX_CH1 activate hardware channel 1 2051 - CONFIG_SYS_I2C_PPC4XX_CH1 activate hardware channel 1
2052 2052
2053 - drivers/i2c/i2c_mxc.c 2053 - drivers/i2c/i2c_mxc.c
2054 - activate this driver with CONFIG_SYS_I2C_MXC 2054 - activate this driver with CONFIG_SYS_I2C_MXC
2055 - enable bus 1 with CONFIG_SYS_I2C_MXC_I2C1 2055 - enable bus 1 with CONFIG_SYS_I2C_MXC_I2C1
2056 - enable bus 2 with CONFIG_SYS_I2C_MXC_I2C2 2056 - enable bus 2 with CONFIG_SYS_I2C_MXC_I2C2
2057 - enable bus 3 with CONFIG_SYS_I2C_MXC_I2C3 2057 - enable bus 3 with CONFIG_SYS_I2C_MXC_I2C3
2058 - enable bus 4 with CONFIG_SYS_I2C_MXC_I2C4 2058 - enable bus 4 with CONFIG_SYS_I2C_MXC_I2C4
2059 - define speed for bus 1 with CONFIG_SYS_MXC_I2C1_SPEED 2059 - define speed for bus 1 with CONFIG_SYS_MXC_I2C1_SPEED
2060 - define slave for bus 1 with CONFIG_SYS_MXC_I2C1_SLAVE 2060 - define slave for bus 1 with CONFIG_SYS_MXC_I2C1_SLAVE
2061 - define speed for bus 2 with CONFIG_SYS_MXC_I2C2_SPEED 2061 - define speed for bus 2 with CONFIG_SYS_MXC_I2C2_SPEED
2062 - define slave for bus 2 with CONFIG_SYS_MXC_I2C2_SLAVE 2062 - define slave for bus 2 with CONFIG_SYS_MXC_I2C2_SLAVE
2063 - define speed for bus 3 with CONFIG_SYS_MXC_I2C3_SPEED 2063 - define speed for bus 3 with CONFIG_SYS_MXC_I2C3_SPEED
2064 - define slave for bus 3 with CONFIG_SYS_MXC_I2C3_SLAVE 2064 - define slave for bus 3 with CONFIG_SYS_MXC_I2C3_SLAVE
2065 - define speed for bus 4 with CONFIG_SYS_MXC_I2C4_SPEED 2065 - define speed for bus 4 with CONFIG_SYS_MXC_I2C4_SPEED
2066 - define slave for bus 4 with CONFIG_SYS_MXC_I2C4_SLAVE 2066 - define slave for bus 4 with CONFIG_SYS_MXC_I2C4_SLAVE
2067 If those defines are not set, default value is 100000 2067 If those defines are not set, default value is 100000
2068 for speed, and 0 for slave. 2068 for speed, and 0 for slave.
2069 2069
2070 - drivers/i2c/rcar_i2c.c: 2070 - drivers/i2c/rcar_i2c.c:
2071 - activate this driver with CONFIG_SYS_I2C_RCAR 2071 - activate this driver with CONFIG_SYS_I2C_RCAR
2072 - This driver adds 4 i2c buses 2072 - This driver adds 4 i2c buses
2073 2073
2074 - CONFIG_SYS_RCAR_I2C0_BASE for setting the register channel 0 2074 - CONFIG_SYS_RCAR_I2C0_BASE for setting the register channel 0
2075 - CONFIG_SYS_RCAR_I2C0_SPEED for for the speed channel 0 2075 - CONFIG_SYS_RCAR_I2C0_SPEED for for the speed channel 0
2076 - CONFIG_SYS_RCAR_I2C1_BASE for setting the register channel 1 2076 - CONFIG_SYS_RCAR_I2C1_BASE for setting the register channel 1
2077 - CONFIG_SYS_RCAR_I2C1_SPEED for for the speed channel 1 2077 - CONFIG_SYS_RCAR_I2C1_SPEED for for the speed channel 1
2078 - CONFIG_SYS_RCAR_I2C2_BASE for setting the register channel 2 2078 - CONFIG_SYS_RCAR_I2C2_BASE for setting the register channel 2
2079 - CONFIG_SYS_RCAR_I2C2_SPEED for for the speed channel 2 2079 - CONFIG_SYS_RCAR_I2C2_SPEED for for the speed channel 2
2080 - CONFIG_SYS_RCAR_I2C3_BASE for setting the register channel 3 2080 - CONFIG_SYS_RCAR_I2C3_BASE for setting the register channel 3
2081 - CONFIG_SYS_RCAR_I2C3_SPEED for for the speed channel 3 2081 - CONFIG_SYS_RCAR_I2C3_SPEED for for the speed channel 3
2082 - CONFIF_SYS_RCAR_I2C_NUM_CONTROLLERS for number of i2c buses 2082 - CONFIF_SYS_RCAR_I2C_NUM_CONTROLLERS for number of i2c buses
2083 2083
2084 - drivers/i2c/sh_i2c.c: 2084 - drivers/i2c/sh_i2c.c:
2085 - activate this driver with CONFIG_SYS_I2C_SH 2085 - activate this driver with CONFIG_SYS_I2C_SH
2086 - This driver adds from 2 to 5 i2c buses 2086 - This driver adds from 2 to 5 i2c buses
2087 2087
2088 - CONFIG_SYS_I2C_SH_BASE0 for setting the register channel 0 2088 - CONFIG_SYS_I2C_SH_BASE0 for setting the register channel 0
2089 - CONFIG_SYS_I2C_SH_SPEED0 for for the speed channel 0 2089 - CONFIG_SYS_I2C_SH_SPEED0 for for the speed channel 0
2090 - CONFIG_SYS_I2C_SH_BASE1 for setting the register channel 1 2090 - CONFIG_SYS_I2C_SH_BASE1 for setting the register channel 1
2091 - CONFIG_SYS_I2C_SH_SPEED1 for for the speed channel 1 2091 - CONFIG_SYS_I2C_SH_SPEED1 for for the speed channel 1
2092 - CONFIG_SYS_I2C_SH_BASE2 for setting the register channel 2 2092 - CONFIG_SYS_I2C_SH_BASE2 for setting the register channel 2
2093 - CONFIG_SYS_I2C_SH_SPEED2 for for the speed channel 2 2093 - CONFIG_SYS_I2C_SH_SPEED2 for for the speed channel 2
2094 - CONFIG_SYS_I2C_SH_BASE3 for setting the register channel 3 2094 - CONFIG_SYS_I2C_SH_BASE3 for setting the register channel 3
2095 - CONFIG_SYS_I2C_SH_SPEED3 for for the speed channel 3 2095 - CONFIG_SYS_I2C_SH_SPEED3 for for the speed channel 3
2096 - CONFIG_SYS_I2C_SH_BASE4 for setting the register channel 4 2096 - CONFIG_SYS_I2C_SH_BASE4 for setting the register channel 4
2097 - CONFIG_SYS_I2C_SH_SPEED4 for for the speed channel 4 2097 - CONFIG_SYS_I2C_SH_SPEED4 for for the speed channel 4
2098 - CONFIG_SYS_I2C_SH_NUM_CONTROLLERS for number of i2c buses 2098 - CONFIG_SYS_I2C_SH_NUM_CONTROLLERS for number of i2c buses
2099 2099
2100 - drivers/i2c/omap24xx_i2c.c 2100 - drivers/i2c/omap24xx_i2c.c
2101 - activate this driver with CONFIG_SYS_I2C_OMAP24XX 2101 - activate this driver with CONFIG_SYS_I2C_OMAP24XX
2102 - CONFIG_SYS_OMAP24_I2C_SPEED speed channel 0 2102 - CONFIG_SYS_OMAP24_I2C_SPEED speed channel 0
2103 - CONFIG_SYS_OMAP24_I2C_SLAVE slave addr channel 0 2103 - CONFIG_SYS_OMAP24_I2C_SLAVE slave addr channel 0
2104 - CONFIG_SYS_OMAP24_I2C_SPEED1 speed channel 1 2104 - CONFIG_SYS_OMAP24_I2C_SPEED1 speed channel 1
2105 - CONFIG_SYS_OMAP24_I2C_SLAVE1 slave addr channel 1 2105 - CONFIG_SYS_OMAP24_I2C_SLAVE1 slave addr channel 1
2106 - CONFIG_SYS_OMAP24_I2C_SPEED2 speed channel 2 2106 - CONFIG_SYS_OMAP24_I2C_SPEED2 speed channel 2
2107 - CONFIG_SYS_OMAP24_I2C_SLAVE2 slave addr channel 2 2107 - CONFIG_SYS_OMAP24_I2C_SLAVE2 slave addr channel 2
2108 - CONFIG_SYS_OMAP24_I2C_SPEED3 speed channel 3 2108 - CONFIG_SYS_OMAP24_I2C_SPEED3 speed channel 3
2109 - CONFIG_SYS_OMAP24_I2C_SLAVE3 slave addr channel 3 2109 - CONFIG_SYS_OMAP24_I2C_SLAVE3 slave addr channel 3
2110 - CONFIG_SYS_OMAP24_I2C_SPEED4 speed channel 4 2110 - CONFIG_SYS_OMAP24_I2C_SPEED4 speed channel 4
2111 - CONFIG_SYS_OMAP24_I2C_SLAVE4 slave addr channel 4 2111 - CONFIG_SYS_OMAP24_I2C_SLAVE4 slave addr channel 4
2112 2112
2113 - drivers/i2c/zynq_i2c.c 2113 - drivers/i2c/zynq_i2c.c
2114 - activate this driver with CONFIG_SYS_I2C_ZYNQ 2114 - activate this driver with CONFIG_SYS_I2C_ZYNQ
2115 - set CONFIG_SYS_I2C_ZYNQ_SPEED for speed setting 2115 - set CONFIG_SYS_I2C_ZYNQ_SPEED for speed setting
2116 - set CONFIG_SYS_I2C_ZYNQ_SLAVE for slave addr 2116 - set CONFIG_SYS_I2C_ZYNQ_SLAVE for slave addr
2117 2117
2118 - drivers/i2c/s3c24x0_i2c.c: 2118 - drivers/i2c/s3c24x0_i2c.c:
2119 - activate this driver with CONFIG_SYS_I2C_S3C24X0 2119 - activate this driver with CONFIG_SYS_I2C_S3C24X0
2120 - This driver adds i2c buses (11 for Exynos5250, Exynos5420 2120 - This driver adds i2c buses (11 for Exynos5250, Exynos5420
2121 9 i2c buses for Exynos4 and 1 for S3C24X0 SoCs from Samsung) 2121 9 i2c buses for Exynos4 and 1 for S3C24X0 SoCs from Samsung)
2122 with a fix speed from 100000 and the slave addr 0! 2122 with a fix speed from 100000 and the slave addr 0!
2123 2123
2124 - drivers/i2c/ihs_i2c.c 2124 - drivers/i2c/ihs_i2c.c
2125 - activate this driver with CONFIG_SYS_I2C_IHS 2125 - activate this driver with CONFIG_SYS_I2C_IHS
2126 - CONFIG_SYS_I2C_IHS_CH0 activate hardware channel 0 2126 - CONFIG_SYS_I2C_IHS_CH0 activate hardware channel 0
2127 - CONFIG_SYS_I2C_IHS_SPEED_0 speed channel 0 2127 - CONFIG_SYS_I2C_IHS_SPEED_0 speed channel 0
2128 - CONFIG_SYS_I2C_IHS_SLAVE_0 slave addr channel 0 2128 - CONFIG_SYS_I2C_IHS_SLAVE_0 slave addr channel 0
2129 - CONFIG_SYS_I2C_IHS_CH1 activate hardware channel 1 2129 - CONFIG_SYS_I2C_IHS_CH1 activate hardware channel 1
2130 - CONFIG_SYS_I2C_IHS_SPEED_1 speed channel 1 2130 - CONFIG_SYS_I2C_IHS_SPEED_1 speed channel 1
2131 - CONFIG_SYS_I2C_IHS_SLAVE_1 slave addr channel 1 2131 - CONFIG_SYS_I2C_IHS_SLAVE_1 slave addr channel 1
2132 - CONFIG_SYS_I2C_IHS_CH2 activate hardware channel 2 2132 - CONFIG_SYS_I2C_IHS_CH2 activate hardware channel 2
2133 - CONFIG_SYS_I2C_IHS_SPEED_2 speed channel 2 2133 - CONFIG_SYS_I2C_IHS_SPEED_2 speed channel 2
2134 - CONFIG_SYS_I2C_IHS_SLAVE_2 slave addr channel 2 2134 - CONFIG_SYS_I2C_IHS_SLAVE_2 slave addr channel 2
2135 - CONFIG_SYS_I2C_IHS_CH3 activate hardware channel 3 2135 - CONFIG_SYS_I2C_IHS_CH3 activate hardware channel 3
2136 - CONFIG_SYS_I2C_IHS_SPEED_3 speed channel 3 2136 - CONFIG_SYS_I2C_IHS_SPEED_3 speed channel 3
2137 - CONFIG_SYS_I2C_IHS_SLAVE_3 slave addr channel 3 2137 - CONFIG_SYS_I2C_IHS_SLAVE_3 slave addr channel 3
2138 - activate dual channel with CONFIG_SYS_I2C_IHS_DUAL 2138 - activate dual channel with CONFIG_SYS_I2C_IHS_DUAL
2139 - CONFIG_SYS_I2C_IHS_SPEED_0_1 speed channel 0_1 2139 - CONFIG_SYS_I2C_IHS_SPEED_0_1 speed channel 0_1
2140 - CONFIG_SYS_I2C_IHS_SLAVE_0_1 slave addr channel 0_1 2140 - CONFIG_SYS_I2C_IHS_SLAVE_0_1 slave addr channel 0_1
2141 - CONFIG_SYS_I2C_IHS_SPEED_1_1 speed channel 1_1 2141 - CONFIG_SYS_I2C_IHS_SPEED_1_1 speed channel 1_1
2142 - CONFIG_SYS_I2C_IHS_SLAVE_1_1 slave addr channel 1_1 2142 - CONFIG_SYS_I2C_IHS_SLAVE_1_1 slave addr channel 1_1
2143 - CONFIG_SYS_I2C_IHS_SPEED_2_1 speed channel 2_1 2143 - CONFIG_SYS_I2C_IHS_SPEED_2_1 speed channel 2_1
2144 - CONFIG_SYS_I2C_IHS_SLAVE_2_1 slave addr channel 2_1 2144 - CONFIG_SYS_I2C_IHS_SLAVE_2_1 slave addr channel 2_1
2145 - CONFIG_SYS_I2C_IHS_SPEED_3_1 speed channel 3_1 2145 - CONFIG_SYS_I2C_IHS_SPEED_3_1 speed channel 3_1
2146 - CONFIG_SYS_I2C_IHS_SLAVE_3_1 slave addr channel 3_1 2146 - CONFIG_SYS_I2C_IHS_SLAVE_3_1 slave addr channel 3_1
2147 2147
2148 additional defines: 2148 additional defines:
2149 2149
2150 CONFIG_SYS_NUM_I2C_BUSES 2150 CONFIG_SYS_NUM_I2C_BUSES
2151 Hold the number of i2c buses you want to use. 2151 Hold the number of i2c buses you want to use.
2152 2152
2153 CONFIG_SYS_I2C_DIRECT_BUS 2153 CONFIG_SYS_I2C_DIRECT_BUS
2154 define this, if you don't use i2c muxes on your hardware. 2154 define this, if you don't use i2c muxes on your hardware.
2155 if CONFIG_SYS_I2C_MAX_HOPS is not defined or == 0 you can 2155 if CONFIG_SYS_I2C_MAX_HOPS is not defined or == 0 you can
2156 omit this define. 2156 omit this define.
2157 2157
2158 CONFIG_SYS_I2C_MAX_HOPS 2158 CONFIG_SYS_I2C_MAX_HOPS
2159 define how many muxes are maximal consecutively connected 2159 define how many muxes are maximal consecutively connected
2160 on one i2c bus. If you not use i2c muxes, omit this 2160 on one i2c bus. If you not use i2c muxes, omit this
2161 define. 2161 define.
2162 2162
2163 CONFIG_SYS_I2C_BUSES 2163 CONFIG_SYS_I2C_BUSES
2164 hold a list of buses you want to use, only used if 2164 hold a list of buses you want to use, only used if
2165 CONFIG_SYS_I2C_DIRECT_BUS is not defined, for example 2165 CONFIG_SYS_I2C_DIRECT_BUS is not defined, for example
2166 a board with CONFIG_SYS_I2C_MAX_HOPS = 1 and 2166 a board with CONFIG_SYS_I2C_MAX_HOPS = 1 and
2167 CONFIG_SYS_NUM_I2C_BUSES = 9: 2167 CONFIG_SYS_NUM_I2C_BUSES = 9:
2168 2168
2169 CONFIG_SYS_I2C_BUSES {{0, {I2C_NULL_HOP}}, \ 2169 CONFIG_SYS_I2C_BUSES {{0, {I2C_NULL_HOP}}, \
2170 {0, {{I2C_MUX_PCA9547, 0x70, 1}}}, \ 2170 {0, {{I2C_MUX_PCA9547, 0x70, 1}}}, \
2171 {0, {{I2C_MUX_PCA9547, 0x70, 2}}}, \ 2171 {0, {{I2C_MUX_PCA9547, 0x70, 2}}}, \
2172 {0, {{I2C_MUX_PCA9547, 0x70, 3}}}, \ 2172 {0, {{I2C_MUX_PCA9547, 0x70, 3}}}, \
2173 {0, {{I2C_MUX_PCA9547, 0x70, 4}}}, \ 2173 {0, {{I2C_MUX_PCA9547, 0x70, 4}}}, \
2174 {0, {{I2C_MUX_PCA9547, 0x70, 5}}}, \ 2174 {0, {{I2C_MUX_PCA9547, 0x70, 5}}}, \
2175 {1, {I2C_NULL_HOP}}, \ 2175 {1, {I2C_NULL_HOP}}, \
2176 {1, {{I2C_MUX_PCA9544, 0x72, 1}}}, \ 2176 {1, {{I2C_MUX_PCA9544, 0x72, 1}}}, \
2177 {1, {{I2C_MUX_PCA9544, 0x72, 2}}}, \ 2177 {1, {{I2C_MUX_PCA9544, 0x72, 2}}}, \
2178 } 2178 }
2179 2179
2180 which defines 2180 which defines
2181 bus 0 on adapter 0 without a mux 2181 bus 0 on adapter 0 without a mux
2182 bus 1 on adapter 0 with a PCA9547 on address 0x70 port 1 2182 bus 1 on adapter 0 with a PCA9547 on address 0x70 port 1
2183 bus 2 on adapter 0 with a PCA9547 on address 0x70 port 2 2183 bus 2 on adapter 0 with a PCA9547 on address 0x70 port 2
2184 bus 3 on adapter 0 with a PCA9547 on address 0x70 port 3 2184 bus 3 on adapter 0 with a PCA9547 on address 0x70 port 3
2185 bus 4 on adapter 0 with a PCA9547 on address 0x70 port 4 2185 bus 4 on adapter 0 with a PCA9547 on address 0x70 port 4
2186 bus 5 on adapter 0 with a PCA9547 on address 0x70 port 5 2186 bus 5 on adapter 0 with a PCA9547 on address 0x70 port 5
2187 bus 6 on adapter 1 without a mux 2187 bus 6 on adapter 1 without a mux
2188 bus 7 on adapter 1 with a PCA9544 on address 0x72 port 1 2188 bus 7 on adapter 1 with a PCA9544 on address 0x72 port 1
2189 bus 8 on adapter 1 with a PCA9544 on address 0x72 port 2 2189 bus 8 on adapter 1 with a PCA9544 on address 0x72 port 2
2190 2190
2191 If you do not have i2c muxes on your board, omit this define. 2191 If you do not have i2c muxes on your board, omit this define.
2192 2192
2193 - Legacy I2C Support: 2193 - Legacy I2C Support:
2194 If you use the software i2c interface (CONFIG_SYS_I2C_SOFT) 2194 If you use the software i2c interface (CONFIG_SYS_I2C_SOFT)
2195 then the following macros need to be defined (examples are 2195 then the following macros need to be defined (examples are
2196 from include/configs/lwmon.h): 2196 from include/configs/lwmon.h):
2197 2197
2198 I2C_INIT 2198 I2C_INIT
2199 2199
2200 (Optional). Any commands necessary to enable the I2C 2200 (Optional). Any commands necessary to enable the I2C
2201 controller or configure ports. 2201 controller or configure ports.
2202 2202
2203 eg: #define I2C_INIT (immr->im_cpm.cp_pbdir |= PB_SCL) 2203 eg: #define I2C_INIT (immr->im_cpm.cp_pbdir |= PB_SCL)
2204 2204
2205 I2C_PORT 2205 I2C_PORT
2206 2206
2207 (Only for MPC8260 CPU). The I/O port to use (the code 2207 (Only for MPC8260 CPU). The I/O port to use (the code
2208 assumes both bits are on the same port). Valid values 2208 assumes both bits are on the same port). Valid values
2209 are 0..3 for ports A..D. 2209 are 0..3 for ports A..D.
2210 2210
2211 I2C_ACTIVE 2211 I2C_ACTIVE
2212 2212
2213 The code necessary to make the I2C data line active 2213 The code necessary to make the I2C data line active
2214 (driven). If the data line is open collector, this 2214 (driven). If the data line is open collector, this
2215 define can be null. 2215 define can be null.
2216 2216
2217 eg: #define I2C_ACTIVE (immr->im_cpm.cp_pbdir |= PB_SDA) 2217 eg: #define I2C_ACTIVE (immr->im_cpm.cp_pbdir |= PB_SDA)
2218 2218
2219 I2C_TRISTATE 2219 I2C_TRISTATE
2220 2220
2221 The code necessary to make the I2C data line tri-stated 2221 The code necessary to make the I2C data line tri-stated
2222 (inactive). If the data line is open collector, this 2222 (inactive). If the data line is open collector, this
2223 define can be null. 2223 define can be null.
2224 2224
2225 eg: #define I2C_TRISTATE (immr->im_cpm.cp_pbdir &= ~PB_SDA) 2225 eg: #define I2C_TRISTATE (immr->im_cpm.cp_pbdir &= ~PB_SDA)
2226 2226
2227 I2C_READ 2227 I2C_READ
2228 2228
2229 Code that returns true if the I2C data line is high, 2229 Code that returns true if the I2C data line is high,
2230 false if it is low. 2230 false if it is low.
2231 2231
2232 eg: #define I2C_READ ((immr->im_cpm.cp_pbdat & PB_SDA) != 0) 2232 eg: #define I2C_READ ((immr->im_cpm.cp_pbdat & PB_SDA) != 0)
2233 2233
2234 I2C_SDA(bit) 2234 I2C_SDA(bit)
2235 2235
2236 If <bit> is true, sets the I2C data line high. If it 2236 If <bit> is true, sets the I2C data line high. If it
2237 is false, it clears it (low). 2237 is false, it clears it (low).
2238 2238
2239 eg: #define I2C_SDA(bit) \ 2239 eg: #define I2C_SDA(bit) \
2240 if(bit) immr->im_cpm.cp_pbdat |= PB_SDA; \ 2240 if(bit) immr->im_cpm.cp_pbdat |= PB_SDA; \
2241 else immr->im_cpm.cp_pbdat &= ~PB_SDA 2241 else immr->im_cpm.cp_pbdat &= ~PB_SDA
2242 2242
2243 I2C_SCL(bit) 2243 I2C_SCL(bit)
2244 2244
2245 If <bit> is true, sets the I2C clock line high. If it 2245 If <bit> is true, sets the I2C clock line high. If it
2246 is false, it clears it (low). 2246 is false, it clears it (low).
2247 2247
2248 eg: #define I2C_SCL(bit) \ 2248 eg: #define I2C_SCL(bit) \
2249 if(bit) immr->im_cpm.cp_pbdat |= PB_SCL; \ 2249 if(bit) immr->im_cpm.cp_pbdat |= PB_SCL; \
2250 else immr->im_cpm.cp_pbdat &= ~PB_SCL 2250 else immr->im_cpm.cp_pbdat &= ~PB_SCL
2251 2251
2252 I2C_DELAY 2252 I2C_DELAY
2253 2253
2254 This delay is invoked four times per clock cycle so this 2254 This delay is invoked four times per clock cycle so this
2255 controls the rate of data transfer. The data rate thus 2255 controls the rate of data transfer. The data rate thus
2256 is 1 / (I2C_DELAY * 4). Often defined to be something 2256 is 1 / (I2C_DELAY * 4). Often defined to be something
2257 like: 2257 like:
2258 2258
2259 #define I2C_DELAY udelay(2) 2259 #define I2C_DELAY udelay(2)
2260 2260
2261 CONFIG_SOFT_I2C_GPIO_SCL / CONFIG_SOFT_I2C_GPIO_SDA 2261 CONFIG_SOFT_I2C_GPIO_SCL / CONFIG_SOFT_I2C_GPIO_SDA
2262 2262
2263 If your arch supports the generic GPIO framework (asm/gpio.h), 2263 If your arch supports the generic GPIO framework (asm/gpio.h),
2264 then you may alternatively define the two GPIOs that are to be 2264 then you may alternatively define the two GPIOs that are to be
2265 used as SCL / SDA. Any of the previous I2C_xxx macros will 2265 used as SCL / SDA. Any of the previous I2C_xxx macros will
2266 have GPIO-based defaults assigned to them as appropriate. 2266 have GPIO-based defaults assigned to them as appropriate.
2267 2267
2268 You should define these to the GPIO value as given directly to 2268 You should define these to the GPIO value as given directly to
2269 the generic GPIO functions. 2269 the generic GPIO functions.
2270 2270
2271 CONFIG_SYS_I2C_INIT_BOARD 2271 CONFIG_SYS_I2C_INIT_BOARD
2272 2272
2273 When a board is reset during an i2c bus transfer 2273 When a board is reset during an i2c bus transfer
2274 chips might think that the current transfer is still 2274 chips might think that the current transfer is still
2275 in progress. On some boards it is possible to access 2275 in progress. On some boards it is possible to access
2276 the i2c SCLK line directly, either by using the 2276 the i2c SCLK line directly, either by using the
2277 processor pin as a GPIO or by having a second pin 2277 processor pin as a GPIO or by having a second pin
2278 connected to the bus. If this option is defined a 2278 connected to the bus. If this option is defined a
2279 custom i2c_init_board() routine in boards/xxx/board.c 2279 custom i2c_init_board() routine in boards/xxx/board.c
2280 is run early in the boot sequence. 2280 is run early in the boot sequence.
2281 2281
2282 CONFIG_I2C_MULTI_BUS 2282 CONFIG_I2C_MULTI_BUS
2283 2283
2284 This option allows the use of multiple I2C buses, each of which 2284 This option allows the use of multiple I2C buses, each of which
2285 must have a controller. At any point in time, only one bus is 2285 must have a controller. At any point in time, only one bus is
2286 active. To switch to a different bus, use the 'i2c dev' command. 2286 active. To switch to a different bus, use the 'i2c dev' command.
2287 Note that bus numbering is zero-based. 2287 Note that bus numbering is zero-based.
2288 2288
2289 CONFIG_SYS_I2C_NOPROBES 2289 CONFIG_SYS_I2C_NOPROBES
2290 2290
2291 This option specifies a list of I2C devices that will be skipped 2291 This option specifies a list of I2C devices that will be skipped
2292 when the 'i2c probe' command is issued. If CONFIG_I2C_MULTI_BUS 2292 when the 'i2c probe' command is issued. If CONFIG_I2C_MULTI_BUS
2293 is set, specify a list of bus-device pairs. Otherwise, specify 2293 is set, specify a list of bus-device pairs. Otherwise, specify
2294 a 1D array of device addresses 2294 a 1D array of device addresses
2295 2295
2296 e.g. 2296 e.g.
2297 #undef CONFIG_I2C_MULTI_BUS 2297 #undef CONFIG_I2C_MULTI_BUS
2298 #define CONFIG_SYS_I2C_NOPROBES {0x50,0x68} 2298 #define CONFIG_SYS_I2C_NOPROBES {0x50,0x68}
2299 2299
2300 will skip addresses 0x50 and 0x68 on a board with one I2C bus 2300 will skip addresses 0x50 and 0x68 on a board with one I2C bus
2301 2301
2302 #define CONFIG_I2C_MULTI_BUS 2302 #define CONFIG_I2C_MULTI_BUS
2303 #define CONFIG_SYS_I2C_NOPROBES {{0,0x50},{0,0x68},{1,0x54}} 2303 #define CONFIG_SYS_I2C_NOPROBES {{0,0x50},{0,0x68},{1,0x54}}
2304 2304
2305 will skip addresses 0x50 and 0x68 on bus 0 and address 0x54 on bus 1 2305 will skip addresses 0x50 and 0x68 on bus 0 and address 0x54 on bus 1
2306 2306
2307 CONFIG_SYS_SPD_BUS_NUM 2307 CONFIG_SYS_SPD_BUS_NUM
2308 2308
2309 If defined, then this indicates the I2C bus number for DDR SPD. 2309 If defined, then this indicates the I2C bus number for DDR SPD.
2310 If not defined, then U-Boot assumes that SPD is on I2C bus 0. 2310 If not defined, then U-Boot assumes that SPD is on I2C bus 0.
2311 2311
2312 CONFIG_SYS_RTC_BUS_NUM 2312 CONFIG_SYS_RTC_BUS_NUM
2313 2313
2314 If defined, then this indicates the I2C bus number for the RTC. 2314 If defined, then this indicates the I2C bus number for the RTC.
2315 If not defined, then U-Boot assumes that RTC is on I2C bus 0. 2315 If not defined, then U-Boot assumes that RTC is on I2C bus 0.
2316 2316
2317 CONFIG_SOFT_I2C_READ_REPEATED_START 2317 CONFIG_SOFT_I2C_READ_REPEATED_START
2318 2318
2319 defining this will force the i2c_read() function in 2319 defining this will force the i2c_read() function in
2320 the soft_i2c driver to perform an I2C repeated start 2320 the soft_i2c driver to perform an I2C repeated start
2321 between writing the address pointer and reading the 2321 between writing the address pointer and reading the
2322 data. If this define is omitted the default behaviour 2322 data. If this define is omitted the default behaviour
2323 of doing a stop-start sequence will be used. Most I2C 2323 of doing a stop-start sequence will be used. Most I2C
2324 devices can use either method, but some require one or 2324 devices can use either method, but some require one or
2325 the other. 2325 the other.
2326 2326
2327 - SPI Support: CONFIG_SPI 2327 - SPI Support: CONFIG_SPI
2328 2328
2329 Enables SPI driver (so far only tested with 2329 Enables SPI driver (so far only tested with
2330 SPI EEPROM, also an instance works with Crystal A/D and 2330 SPI EEPROM, also an instance works with Crystal A/D and
2331 D/As on the SACSng board) 2331 D/As on the SACSng board)
2332 2332
2333 CONFIG_SH_SPI 2333 CONFIG_SH_SPI
2334 2334
2335 Enables the driver for SPI controller on SuperH. Currently 2335 Enables the driver for SPI controller on SuperH. Currently
2336 only SH7757 is supported. 2336 only SH7757 is supported.
2337 2337
2338 CONFIG_SOFT_SPI 2338 CONFIG_SOFT_SPI
2339 2339
2340 Enables a software (bit-bang) SPI driver rather than 2340 Enables a software (bit-bang) SPI driver rather than
2341 using hardware support. This is a general purpose 2341 using hardware support. This is a general purpose
2342 driver that only requires three general I/O port pins 2342 driver that only requires three general I/O port pins
2343 (two outputs, one input) to function. If this is 2343 (two outputs, one input) to function. If this is
2344 defined, the board configuration must define several 2344 defined, the board configuration must define several
2345 SPI configuration items (port pins to use, etc). For 2345 SPI configuration items (port pins to use, etc). For
2346 an example, see include/configs/sacsng.h. 2346 an example, see include/configs/sacsng.h.
2347 2347
2348 CONFIG_HARD_SPI 2348 CONFIG_HARD_SPI
2349 2349
2350 Enables a hardware SPI driver for general-purpose reads 2350 Enables a hardware SPI driver for general-purpose reads
2351 and writes. As with CONFIG_SOFT_SPI, the board configuration 2351 and writes. As with CONFIG_SOFT_SPI, the board configuration
2352 must define a list of chip-select function pointers. 2352 must define a list of chip-select function pointers.
2353 Currently supported on some MPC8xxx processors. For an 2353 Currently supported on some MPC8xxx processors. For an
2354 example, see include/configs/mpc8349emds.h. 2354 example, see include/configs/mpc8349emds.h.
2355 2355
2356 CONFIG_MXC_SPI 2356 CONFIG_MXC_SPI
2357 2357
2358 Enables the driver for the SPI controllers on i.MX and MXC 2358 Enables the driver for the SPI controllers on i.MX and MXC
2359 SoCs. Currently i.MX31/35/51 are supported. 2359 SoCs. Currently i.MX31/35/51 are supported.
2360 2360
2361 CONFIG_SYS_SPI_MXC_WAIT 2361 CONFIG_SYS_SPI_MXC_WAIT
2362 Timeout for waiting until spi transfer completed. 2362 Timeout for waiting until spi transfer completed.
2363 default: (CONFIG_SYS_HZ/100) /* 10 ms */ 2363 default: (CONFIG_SYS_HZ/100) /* 10 ms */
2364 2364
2365 - FPGA Support: CONFIG_FPGA 2365 - FPGA Support: CONFIG_FPGA
2366 2366
2367 Enables FPGA subsystem. 2367 Enables FPGA subsystem.
2368 2368
2369 CONFIG_FPGA_<vendor> 2369 CONFIG_FPGA_<vendor>
2370 2370
2371 Enables support for specific chip vendors. 2371 Enables support for specific chip vendors.
2372 (ALTERA, XILINX) 2372 (ALTERA, XILINX)
2373 2373
2374 CONFIG_FPGA_<family> 2374 CONFIG_FPGA_<family>
2375 2375
2376 Enables support for FPGA family. 2376 Enables support for FPGA family.
2377 (SPARTAN2, SPARTAN3, VIRTEX2, CYCLONE2, ACEX1K, ACEX) 2377 (SPARTAN2, SPARTAN3, VIRTEX2, CYCLONE2, ACEX1K, ACEX)
2378 2378
2379 CONFIG_FPGA_COUNT 2379 CONFIG_FPGA_COUNT
2380 2380
2381 Specify the number of FPGA devices to support. 2381 Specify the number of FPGA devices to support.
2382 2382
2383 CONFIG_SYS_FPGA_PROG_FEEDBACK 2383 CONFIG_SYS_FPGA_PROG_FEEDBACK
2384 2384
2385 Enable printing of hash marks during FPGA configuration. 2385 Enable printing of hash marks during FPGA configuration.
2386 2386
2387 CONFIG_SYS_FPGA_CHECK_BUSY 2387 CONFIG_SYS_FPGA_CHECK_BUSY
2388 2388
2389 Enable checks on FPGA configuration interface busy 2389 Enable checks on FPGA configuration interface busy
2390 status by the configuration function. This option 2390 status by the configuration function. This option
2391 will require a board or device specific function to 2391 will require a board or device specific function to
2392 be written. 2392 be written.
2393 2393
2394 CONFIG_FPGA_DELAY 2394 CONFIG_FPGA_DELAY
2395 2395
2396 If defined, a function that provides delays in the FPGA 2396 If defined, a function that provides delays in the FPGA
2397 configuration driver. 2397 configuration driver.
2398 2398
2399 CONFIG_SYS_FPGA_CHECK_CTRLC 2399 CONFIG_SYS_FPGA_CHECK_CTRLC
2400 Allow Control-C to interrupt FPGA configuration 2400 Allow Control-C to interrupt FPGA configuration
2401 2401
2402 CONFIG_SYS_FPGA_CHECK_ERROR 2402 CONFIG_SYS_FPGA_CHECK_ERROR
2403 2403
2404 Check for configuration errors during FPGA bitfile 2404 Check for configuration errors during FPGA bitfile
2405 loading. For example, abort during Virtex II 2405 loading. For example, abort during Virtex II
2406 configuration if the INIT_B line goes low (which 2406 configuration if the INIT_B line goes low (which
2407 indicated a CRC error). 2407 indicated a CRC error).
2408 2408
2409 CONFIG_SYS_FPGA_WAIT_INIT 2409 CONFIG_SYS_FPGA_WAIT_INIT
2410 2410
2411 Maximum time to wait for the INIT_B line to de-assert 2411 Maximum time to wait for the INIT_B line to de-assert
2412 after PROB_B has been de-asserted during a Virtex II 2412 after PROB_B has been de-asserted during a Virtex II
2413 FPGA configuration sequence. The default time is 500 2413 FPGA configuration sequence. The default time is 500
2414 ms. 2414 ms.
2415 2415
2416 CONFIG_SYS_FPGA_WAIT_BUSY 2416 CONFIG_SYS_FPGA_WAIT_BUSY
2417 2417
2418 Maximum time to wait for BUSY to de-assert during 2418 Maximum time to wait for BUSY to de-assert during
2419 Virtex II FPGA configuration. The default is 5 ms. 2419 Virtex II FPGA configuration. The default is 5 ms.
2420 2420
2421 CONFIG_SYS_FPGA_WAIT_CONFIG 2421 CONFIG_SYS_FPGA_WAIT_CONFIG
2422 2422
2423 Time to wait after FPGA configuration. The default is 2423 Time to wait after FPGA configuration. The default is
2424 200 ms. 2424 200 ms.
2425 2425
2426 - Configuration Management: 2426 - Configuration Management:
2427 CONFIG_BUILD_TARGET 2427 CONFIG_BUILD_TARGET
2428 2428
2429 Some SoCs need special image types (e.g. U-Boot binary 2429 Some SoCs need special image types (e.g. U-Boot binary
2430 with a special header) as build targets. By defining 2430 with a special header) as build targets. By defining
2431 CONFIG_BUILD_TARGET in the SoC / board header, this 2431 CONFIG_BUILD_TARGET in the SoC / board header, this
2432 special image will be automatically built upon calling 2432 special image will be automatically built upon calling
2433 make / buildman. 2433 make / buildman.
2434 2434
2435 CONFIG_IDENT_STRING 2435 CONFIG_IDENT_STRING
2436 2436
2437 If defined, this string will be added to the U-Boot 2437 If defined, this string will be added to the U-Boot
2438 version information (U_BOOT_VERSION) 2438 version information (U_BOOT_VERSION)
2439 2439
2440 - Vendor Parameter Protection: 2440 - Vendor Parameter Protection:
2441 2441
2442 U-Boot considers the values of the environment 2442 U-Boot considers the values of the environment
2443 variables "serial#" (Board Serial Number) and 2443 variables "serial#" (Board Serial Number) and
2444 "ethaddr" (Ethernet Address) to be parameters that 2444 "ethaddr" (Ethernet Address) to be parameters that
2445 are set once by the board vendor / manufacturer, and 2445 are set once by the board vendor / manufacturer, and
2446 protects these variables from casual modification by 2446 protects these variables from casual modification by
2447 the user. Once set, these variables are read-only, 2447 the user. Once set, these variables are read-only,
2448 and write or delete attempts are rejected. You can 2448 and write or delete attempts are rejected. You can
2449 change this behaviour: 2449 change this behaviour:
2450 2450
2451 If CONFIG_ENV_OVERWRITE is #defined in your config 2451 If CONFIG_ENV_OVERWRITE is #defined in your config
2452 file, the write protection for vendor parameters is 2452 file, the write protection for vendor parameters is
2453 completely disabled. Anybody can change or delete 2453 completely disabled. Anybody can change or delete
2454 these parameters. 2454 these parameters.
2455 2455
2456 Alternatively, if you define _both_ an ethaddr in the 2456 Alternatively, if you define _both_ an ethaddr in the
2457 default env _and_ CONFIG_OVERWRITE_ETHADDR_ONCE, a default 2457 default env _and_ CONFIG_OVERWRITE_ETHADDR_ONCE, a default
2458 Ethernet address is installed in the environment, 2458 Ethernet address is installed in the environment,
2459 which can be changed exactly ONCE by the user. [The 2459 which can be changed exactly ONCE by the user. [The
2460 serial# is unaffected by this, i. e. it remains 2460 serial# is unaffected by this, i. e. it remains
2461 read-only.] 2461 read-only.]
2462 2462
2463 The same can be accomplished in a more flexible way 2463 The same can be accomplished in a more flexible way
2464 for any variable by configuring the type of access 2464 for any variable by configuring the type of access
2465 to allow for those variables in the ".flags" variable 2465 to allow for those variables in the ".flags" variable
2466 or define CONFIG_ENV_FLAGS_LIST_STATIC. 2466 or define CONFIG_ENV_FLAGS_LIST_STATIC.
2467 2467
2468 - Protected RAM: 2468 - Protected RAM:
2469 CONFIG_PRAM 2469 CONFIG_PRAM
2470 2470
2471 Define this variable to enable the reservation of 2471 Define this variable to enable the reservation of
2472 "protected RAM", i. e. RAM which is not overwritten 2472 "protected RAM", i. e. RAM which is not overwritten
2473 by U-Boot. Define CONFIG_PRAM to hold the number of 2473 by U-Boot. Define CONFIG_PRAM to hold the number of
2474 kB you want to reserve for pRAM. You can overwrite 2474 kB you want to reserve for pRAM. You can overwrite
2475 this default value by defining an environment 2475 this default value by defining an environment
2476 variable "pram" to the number of kB you want to 2476 variable "pram" to the number of kB you want to
2477 reserve. Note that the board info structure will 2477 reserve. Note that the board info structure will
2478 still show the full amount of RAM. If pRAM is 2478 still show the full amount of RAM. If pRAM is
2479 reserved, a new environment variable "mem" will 2479 reserved, a new environment variable "mem" will
2480 automatically be defined to hold the amount of 2480 automatically be defined to hold the amount of
2481 remaining RAM in a form that can be passed as boot 2481 remaining RAM in a form that can be passed as boot
2482 argument to Linux, for instance like that: 2482 argument to Linux, for instance like that:
2483 2483
2484 setenv bootargs ... mem=\${mem} 2484 setenv bootargs ... mem=\${mem}
2485 saveenv 2485 saveenv
2486 2486
2487 This way you can tell Linux not to use this memory, 2487 This way you can tell Linux not to use this memory,
2488 either, which results in a memory region that will 2488 either, which results in a memory region that will
2489 not be affected by reboots. 2489 not be affected by reboots.
2490 2490
2491 *WARNING* If your board configuration uses automatic 2491 *WARNING* If your board configuration uses automatic
2492 detection of the RAM size, you must make sure that 2492 detection of the RAM size, you must make sure that
2493 this memory test is non-destructive. So far, the 2493 this memory test is non-destructive. So far, the
2494 following board configurations are known to be 2494 following board configurations are known to be
2495 "pRAM-clean": 2495 "pRAM-clean":
2496 2496
2497 IVMS8, IVML24, SPD8xx, TQM8xxL, 2497 IVMS8, IVML24, SPD8xx, TQM8xxL,
2498 HERMES, IP860, RPXlite, LWMON, 2498 HERMES, IP860, RPXlite, LWMON,
2499 FLAGADM, TQM8260 2499 FLAGADM, TQM8260
2500 2500
2501 - Access to physical memory region (> 4GB) 2501 - Access to physical memory region (> 4GB)
2502 Some basic support is provided for operations on memory not 2502 Some basic support is provided for operations on memory not
2503 normally accessible to U-Boot - e.g. some architectures 2503 normally accessible to U-Boot - e.g. some architectures
2504 support access to more than 4GB of memory on 32-bit 2504 support access to more than 4GB of memory on 32-bit
2505 machines using physical address extension or similar. 2505 machines using physical address extension or similar.
2506 Define CONFIG_PHYSMEM to access this basic support, which 2506 Define CONFIG_PHYSMEM to access this basic support, which
2507 currently only supports clearing the memory. 2507 currently only supports clearing the memory.
2508 2508
2509 - Error Recovery: 2509 - Error Recovery:
2510 CONFIG_PANIC_HANG 2510 CONFIG_PANIC_HANG
2511 2511
2512 Define this variable to stop the system in case of a 2512 Define this variable to stop the system in case of a
2513 fatal error, so that you have to reset it manually. 2513 fatal error, so that you have to reset it manually.
2514 This is probably NOT a good idea for an embedded 2514 This is probably NOT a good idea for an embedded
2515 system where you want the system to reboot 2515 system where you want the system to reboot
2516 automatically as fast as possible, but it may be 2516 automatically as fast as possible, but it may be
2517 useful during development since you can try to debug 2517 useful during development since you can try to debug
2518 the conditions that lead to the situation. 2518 the conditions that lead to the situation.
2519 2519
2520 CONFIG_NET_RETRY_COUNT 2520 CONFIG_NET_RETRY_COUNT
2521 2521
2522 This variable defines the number of retries for 2522 This variable defines the number of retries for
2523 network operations like ARP, RARP, TFTP, or BOOTP 2523 network operations like ARP, RARP, TFTP, or BOOTP
2524 before giving up the operation. If not defined, a 2524 before giving up the operation. If not defined, a
2525 default value of 5 is used. 2525 default value of 5 is used.
2526 2526
2527 CONFIG_ARP_TIMEOUT 2527 CONFIG_ARP_TIMEOUT
2528 2528
2529 Timeout waiting for an ARP reply in milliseconds. 2529 Timeout waiting for an ARP reply in milliseconds.
2530 2530
2531 CONFIG_NFS_TIMEOUT 2531 CONFIG_NFS_TIMEOUT
2532 2532
2533 Timeout in milliseconds used in NFS protocol. 2533 Timeout in milliseconds used in NFS protocol.
2534 If you encounter "ERROR: Cannot umount" in nfs command, 2534 If you encounter "ERROR: Cannot umount" in nfs command,
2535 try longer timeout such as 2535 try longer timeout such as
2536 #define CONFIG_NFS_TIMEOUT 10000UL 2536 #define CONFIG_NFS_TIMEOUT 10000UL
2537 2537
2538 - Command Interpreter: 2538 - Command Interpreter:
2539 CONFIG_AUTO_COMPLETE 2539 CONFIG_AUTO_COMPLETE
2540 2540
2541 Enable auto completion of commands using TAB. 2541 Enable auto completion of commands using TAB.
2542 2542
2543 CONFIG_SYS_PROMPT_HUSH_PS2 2543 CONFIG_SYS_PROMPT_HUSH_PS2
2544 2544
2545 This defines the secondary prompt string, which is 2545 This defines the secondary prompt string, which is
2546 printed when the command interpreter needs more input 2546 printed when the command interpreter needs more input
2547 to complete a command. Usually "> ". 2547 to complete a command. Usually "> ".
2548 2548
2549 Note: 2549 Note:
2550 2550
2551 In the current implementation, the local variables 2551 In the current implementation, the local variables
2552 space and global environment variables space are 2552 space and global environment variables space are
2553 separated. Local variables are those you define by 2553 separated. Local variables are those you define by
2554 simply typing `name=value'. To access a local 2554 simply typing `name=value'. To access a local
2555 variable later on, you have write `$name' or 2555 variable later on, you have write `$name' or
2556 `${name}'; to execute the contents of a variable 2556 `${name}'; to execute the contents of a variable
2557 directly type `$name' at the command prompt. 2557 directly type `$name' at the command prompt.
2558 2558
2559 Global environment variables are those you use 2559 Global environment variables are those you use
2560 setenv/printenv to work with. To run a command stored 2560 setenv/printenv to work with. To run a command stored
2561 in such a variable, you need to use the run command, 2561 in such a variable, you need to use the run command,
2562 and you must not use the '$' sign to access them. 2562 and you must not use the '$' sign to access them.
2563 2563
2564 To store commands and special characters in a 2564 To store commands and special characters in a
2565 variable, please use double quotation marks 2565 variable, please use double quotation marks
2566 surrounding the whole text of the variable, instead 2566 surrounding the whole text of the variable, instead
2567 of the backslashes before semicolons and special 2567 of the backslashes before semicolons and special
2568 symbols. 2568 symbols.
2569 2569
2570 - Command Line Editing and History: 2570 - Command Line Editing and History:
2571 CONFIG_CMDLINE_EDITING 2571 CONFIG_CMDLINE_EDITING
2572 2572
2573 Enable editing and History functions for interactive 2573 Enable editing and History functions for interactive
2574 command line input operations 2574 command line input operations
2575 2575
2576 - Command Line PS1/PS2 support: 2576 - Command Line PS1/PS2 support:
2577 CONFIG_CMDLINE_PS_SUPPORT 2577 CONFIG_CMDLINE_PS_SUPPORT
2578 2578
2579 Enable support for changing the command prompt string 2579 Enable support for changing the command prompt string
2580 at run-time. Only static string is supported so far. 2580 at run-time. Only static string is supported so far.
2581 The string is obtained from environment variables PS1 2581 The string is obtained from environment variables PS1
2582 and PS2. 2582 and PS2.
2583 2583
2584 - Default Environment: 2584 - Default Environment:
2585 CONFIG_EXTRA_ENV_SETTINGS 2585 CONFIG_EXTRA_ENV_SETTINGS
2586 2586
2587 Define this to contain any number of null terminated 2587 Define this to contain any number of null terminated
2588 strings (variable = value pairs) that will be part of 2588 strings (variable = value pairs) that will be part of
2589 the default environment compiled into the boot image. 2589 the default environment compiled into the boot image.
2590 2590
2591 For example, place something like this in your 2591 For example, place something like this in your
2592 board's config file: 2592 board's config file:
2593 2593
2594 #define CONFIG_EXTRA_ENV_SETTINGS \ 2594 #define CONFIG_EXTRA_ENV_SETTINGS \
2595 "myvar1=value1\0" \ 2595 "myvar1=value1\0" \
2596 "myvar2=value2\0" 2596 "myvar2=value2\0"
2597 2597
2598 Warning: This method is based on knowledge about the 2598 Warning: This method is based on knowledge about the
2599 internal format how the environment is stored by the 2599 internal format how the environment is stored by the
2600 U-Boot code. This is NOT an official, exported 2600 U-Boot code. This is NOT an official, exported
2601 interface! Although it is unlikely that this format 2601 interface! Although it is unlikely that this format
2602 will change soon, there is no guarantee either. 2602 will change soon, there is no guarantee either.
2603 You better know what you are doing here. 2603 You better know what you are doing here.
2604 2604
2605 Note: overly (ab)use of the default environment is 2605 Note: overly (ab)use of the default environment is
2606 discouraged. Make sure to check other ways to preset 2606 discouraged. Make sure to check other ways to preset
2607 the environment like the "source" command or the 2607 the environment like the "source" command or the
2608 boot command first. 2608 boot command first.
2609 2609
2610 CONFIG_ENV_VARS_UBOOT_CONFIG 2610 CONFIG_ENV_VARS_UBOOT_CONFIG
2611 2611
2612 Define this in order to add variables describing the 2612 Define this in order to add variables describing the
2613 U-Boot build configuration to the default environment. 2613 U-Boot build configuration to the default environment.
2614 These will be named arch, cpu, board, vendor, and soc. 2614 These will be named arch, cpu, board, vendor, and soc.
2615 2615
2616 Enabling this option will cause the following to be defined: 2616 Enabling this option will cause the following to be defined:
2617 2617
2618 - CONFIG_SYS_ARCH 2618 - CONFIG_SYS_ARCH
2619 - CONFIG_SYS_CPU 2619 - CONFIG_SYS_CPU
2620 - CONFIG_SYS_BOARD 2620 - CONFIG_SYS_BOARD
2621 - CONFIG_SYS_VENDOR 2621 - CONFIG_SYS_VENDOR
2622 - CONFIG_SYS_SOC 2622 - CONFIG_SYS_SOC
2623 2623
2624 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG 2624 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
2625 2625
2626 Define this in order to add variables describing certain 2626 Define this in order to add variables describing certain
2627 run-time determined information about the hardware to the 2627 run-time determined information about the hardware to the
2628 environment. These will be named board_name, board_rev. 2628 environment. These will be named board_name, board_rev.
2629 2629
2630 CONFIG_DELAY_ENVIRONMENT 2630 CONFIG_DELAY_ENVIRONMENT
2631 2631
2632 Normally the environment is loaded when the board is 2632 Normally the environment is loaded when the board is
2633 initialised so that it is available to U-Boot. This inhibits 2633 initialised so that it is available to U-Boot. This inhibits
2634 that so that the environment is not available until 2634 that so that the environment is not available until
2635 explicitly loaded later by U-Boot code. With CONFIG_OF_CONTROL 2635 explicitly loaded later by U-Boot code. With CONFIG_OF_CONTROL
2636 this is instead controlled by the value of 2636 this is instead controlled by the value of
2637 /config/load-environment. 2637 /config/load-environment.
2638 2638
2639 - DataFlash Support: 2639 - DataFlash Support:
2640 CONFIG_HAS_DATAFLASH 2640 CONFIG_HAS_DATAFLASH
2641 2641
2642 Defining this option enables DataFlash features and 2642 Defining this option enables DataFlash features and
2643 allows to read/write in Dataflash via the standard 2643 allows to read/write in Dataflash via the standard
2644 commands cp, md... 2644 commands cp, md...
2645 2645
2646 - Serial Flash support 2646 - Serial Flash support
2647 CONFIG_CMD_SF 2647 CONFIG_CMD_SF
2648 2648
2649 Defining this option enables SPI flash commands 2649 Defining this option enables SPI flash commands
2650 'sf probe/read/write/erase/update'. 2650 'sf probe/read/write/erase/update'.
2651 2651
2652 Usage requires an initial 'probe' to define the serial 2652 Usage requires an initial 'probe' to define the serial
2653 flash parameters, followed by read/write/erase/update 2653 flash parameters, followed by read/write/erase/update
2654 commands. 2654 commands.
2655 2655
2656 The following defaults may be provided by the platform 2656 The following defaults may be provided by the platform
2657 to handle the common case when only a single serial 2657 to handle the common case when only a single serial
2658 flash is present on the system. 2658 flash is present on the system.
2659 2659
2660 CONFIG_SF_DEFAULT_BUS Bus identifier 2660 CONFIG_SF_DEFAULT_BUS Bus identifier
2661 CONFIG_SF_DEFAULT_CS Chip-select 2661 CONFIG_SF_DEFAULT_CS Chip-select
2662 CONFIG_SF_DEFAULT_MODE (see include/spi.h) 2662 CONFIG_SF_DEFAULT_MODE (see include/spi.h)
2663 CONFIG_SF_DEFAULT_SPEED in Hz 2663 CONFIG_SF_DEFAULT_SPEED in Hz
2664 2664
2665 CONFIG_CMD_SF_TEST 2665 CONFIG_CMD_SF_TEST
2666 2666
2667 Define this option to include a destructive SPI flash 2667 Define this option to include a destructive SPI flash
2668 test ('sf test'). 2668 test ('sf test').
2669 2669
2670 CONFIG_SF_DUAL_FLASH Dual flash memories 2670 CONFIG_SF_DUAL_FLASH Dual flash memories
2671 2671
2672 Define this option to use dual flash support where two flash 2672 Define this option to use dual flash support where two flash
2673 memories can be connected with a given cs line. 2673 memories can be connected with a given cs line.
2674 Currently Xilinx Zynq qspi supports these type of connections. 2674 Currently Xilinx Zynq qspi supports these type of connections.
2675 2675
2676 - SystemACE Support: 2676 - SystemACE Support:
2677 CONFIG_SYSTEMACE 2677 CONFIG_SYSTEMACE
2678 2678
2679 Adding this option adds support for Xilinx SystemACE 2679 Adding this option adds support for Xilinx SystemACE
2680 chips attached via some sort of local bus. The address 2680 chips attached via some sort of local bus. The address
2681 of the chip must also be defined in the 2681 of the chip must also be defined in the
2682 CONFIG_SYS_SYSTEMACE_BASE macro. For example: 2682 CONFIG_SYS_SYSTEMACE_BASE macro. For example:
2683 2683
2684 #define CONFIG_SYSTEMACE 2684 #define CONFIG_SYSTEMACE
2685 #define CONFIG_SYS_SYSTEMACE_BASE 0xf0000000 2685 #define CONFIG_SYS_SYSTEMACE_BASE 0xf0000000
2686 2686
2687 When SystemACE support is added, the "ace" device type 2687 When SystemACE support is added, the "ace" device type
2688 becomes available to the fat commands, i.e. fatls. 2688 becomes available to the fat commands, i.e. fatls.
2689 2689
2690 - TFTP Fixed UDP Port: 2690 - TFTP Fixed UDP Port:
2691 CONFIG_TFTP_PORT 2691 CONFIG_TFTP_PORT
2692 2692
2693 If this is defined, the environment variable tftpsrcp 2693 If this is defined, the environment variable tftpsrcp
2694 is used to supply the TFTP UDP source port value. 2694 is used to supply the TFTP UDP source port value.
2695 If tftpsrcp isn't defined, the normal pseudo-random port 2695 If tftpsrcp isn't defined, the normal pseudo-random port
2696 number generator is used. 2696 number generator is used.
2697 2697
2698 Also, the environment variable tftpdstp is used to supply 2698 Also, the environment variable tftpdstp is used to supply
2699 the TFTP UDP destination port value. If tftpdstp isn't 2699 the TFTP UDP destination port value. If tftpdstp isn't
2700 defined, the normal port 69 is used. 2700 defined, the normal port 69 is used.
2701 2701
2702 The purpose for tftpsrcp is to allow a TFTP server to 2702 The purpose for tftpsrcp is to allow a TFTP server to
2703 blindly start the TFTP transfer using the pre-configured 2703 blindly start the TFTP transfer using the pre-configured
2704 target IP address and UDP port. This has the effect of 2704 target IP address and UDP port. This has the effect of
2705 "punching through" the (Windows XP) firewall, allowing 2705 "punching through" the (Windows XP) firewall, allowing
2706 the remainder of the TFTP transfer to proceed normally. 2706 the remainder of the TFTP transfer to proceed normally.
2707 A better solution is to properly configure the firewall, 2707 A better solution is to properly configure the firewall,
2708 but sometimes that is not allowed. 2708 but sometimes that is not allowed.
2709 2709
2710 - Hashing support: 2710 - Hashing support:
2711 CONFIG_HASH_VERIFY 2711 CONFIG_HASH_VERIFY
2712 2712
2713 Enable the hash verify command (hash -v). This adds to code 2713 Enable the hash verify command (hash -v). This adds to code
2714 size a little. 2714 size a little.
2715 2715
2716 Note: There is also a sha1sum command, which should perhaps 2716 Note: There is also a sha1sum command, which should perhaps
2717 be deprecated in favour of 'hash sha1'. 2717 be deprecated in favour of 'hash sha1'.
2718 2718
2719 - bootcount support: 2719 - bootcount support:
2720 CONFIG_BOOTCOUNT_LIMIT 2720 CONFIG_BOOTCOUNT_LIMIT
2721 2721
2722 This enables the bootcounter support, see: 2722 This enables the bootcounter support, see:
2723 http://www.denx.de/wiki/DULG/UBootBootCountLimit 2723 http://www.denx.de/wiki/DULG/UBootBootCountLimit
2724 2724
2725 CONFIG_AT91SAM9XE 2725 CONFIG_AT91SAM9XE
2726 enable special bootcounter support on at91sam9xe based boards. 2726 enable special bootcounter support on at91sam9xe based boards.
2727 CONFIG_SOC_DA8XX 2727 CONFIG_SOC_DA8XX
2728 enable special bootcounter support on da850 based boards. 2728 enable special bootcounter support on da850 based boards.
2729 CONFIG_BOOTCOUNT_RAM 2729 CONFIG_BOOTCOUNT_RAM
2730 enable support for the bootcounter in RAM 2730 enable support for the bootcounter in RAM
2731 CONFIG_BOOTCOUNT_I2C 2731 CONFIG_BOOTCOUNT_I2C
2732 enable support for the bootcounter on an i2c (like RTC) device. 2732 enable support for the bootcounter on an i2c (like RTC) device.
2733 CONFIG_SYS_I2C_RTC_ADDR = i2c chip address 2733 CONFIG_SYS_I2C_RTC_ADDR = i2c chip address
2734 CONFIG_SYS_BOOTCOUNT_ADDR = i2c addr which is used for 2734 CONFIG_SYS_BOOTCOUNT_ADDR = i2c addr which is used for
2735 the bootcounter. 2735 the bootcounter.
2736 CONFIG_BOOTCOUNT_ALEN = address len 2736 CONFIG_BOOTCOUNT_ALEN = address len
2737 2737
2738 - Show boot progress: 2738 - Show boot progress:
2739 CONFIG_SHOW_BOOT_PROGRESS 2739 CONFIG_SHOW_BOOT_PROGRESS
2740 2740
2741 Defining this option allows to add some board- 2741 Defining this option allows to add some board-
2742 specific code (calling a user-provided function 2742 specific code (calling a user-provided function
2743 "show_boot_progress(int)") that enables you to show 2743 "show_boot_progress(int)") that enables you to show
2744 the system's boot progress on some display (for 2744 the system's boot progress on some display (for
2745 example, some LED's) on your board. At the moment, 2745 example, some LED's) on your board. At the moment,
2746 the following checkpoints are implemented: 2746 the following checkpoints are implemented:
2747 2747
2748 2748
2749 Legacy uImage format: 2749 Legacy uImage format:
2750 2750
2751 Arg Where When 2751 Arg Where When
2752 1 common/cmd_bootm.c before attempting to boot an image 2752 1 common/cmd_bootm.c before attempting to boot an image
2753 -1 common/cmd_bootm.c Image header has bad magic number 2753 -1 common/cmd_bootm.c Image header has bad magic number
2754 2 common/cmd_bootm.c Image header has correct magic number 2754 2 common/cmd_bootm.c Image header has correct magic number
2755 -2 common/cmd_bootm.c Image header has bad checksum 2755 -2 common/cmd_bootm.c Image header has bad checksum
2756 3 common/cmd_bootm.c Image header has correct checksum 2756 3 common/cmd_bootm.c Image header has correct checksum
2757 -3 common/cmd_bootm.c Image data has bad checksum 2757 -3 common/cmd_bootm.c Image data has bad checksum
2758 4 common/cmd_bootm.c Image data has correct checksum 2758 4 common/cmd_bootm.c Image data has correct checksum
2759 -4 common/cmd_bootm.c Image is for unsupported architecture 2759 -4 common/cmd_bootm.c Image is for unsupported architecture
2760 5 common/cmd_bootm.c Architecture check OK 2760 5 common/cmd_bootm.c Architecture check OK
2761 -5 common/cmd_bootm.c Wrong Image Type (not kernel, multi) 2761 -5 common/cmd_bootm.c Wrong Image Type (not kernel, multi)
2762 6 common/cmd_bootm.c Image Type check OK 2762 6 common/cmd_bootm.c Image Type check OK
2763 -6 common/cmd_bootm.c gunzip uncompression error 2763 -6 common/cmd_bootm.c gunzip uncompression error
2764 -7 common/cmd_bootm.c Unimplemented compression type 2764 -7 common/cmd_bootm.c Unimplemented compression type
2765 7 common/cmd_bootm.c Uncompression OK 2765 7 common/cmd_bootm.c Uncompression OK
2766 8 common/cmd_bootm.c No uncompress/copy overwrite error 2766 8 common/cmd_bootm.c No uncompress/copy overwrite error
2767 -9 common/cmd_bootm.c Unsupported OS (not Linux, BSD, VxWorks, QNX) 2767 -9 common/cmd_bootm.c Unsupported OS (not Linux, BSD, VxWorks, QNX)
2768 2768
2769 9 common/image.c Start initial ramdisk verification 2769 9 common/image.c Start initial ramdisk verification
2770 -10 common/image.c Ramdisk header has bad magic number 2770 -10 common/image.c Ramdisk header has bad magic number
2771 -11 common/image.c Ramdisk header has bad checksum 2771 -11 common/image.c Ramdisk header has bad checksum
2772 10 common/image.c Ramdisk header is OK 2772 10 common/image.c Ramdisk header is OK
2773 -12 common/image.c Ramdisk data has bad checksum 2773 -12 common/image.c Ramdisk data has bad checksum
2774 11 common/image.c Ramdisk data has correct checksum 2774 11 common/image.c Ramdisk data has correct checksum
2775 12 common/image.c Ramdisk verification complete, start loading 2775 12 common/image.c Ramdisk verification complete, start loading
2776 -13 common/image.c Wrong Image Type (not PPC Linux ramdisk) 2776 -13 common/image.c Wrong Image Type (not PPC Linux ramdisk)
2777 13 common/image.c Start multifile image verification 2777 13 common/image.c Start multifile image verification
2778 14 common/image.c No initial ramdisk, no multifile, continue. 2778 14 common/image.c No initial ramdisk, no multifile, continue.
2779 2779
2780 15 arch/<arch>/lib/bootm.c All preparation done, transferring control to OS 2780 15 arch/<arch>/lib/bootm.c All preparation done, transferring control to OS
2781 2781
2782 -30 arch/powerpc/lib/board.c Fatal error, hang the system 2782 -30 arch/powerpc/lib/board.c Fatal error, hang the system
2783 -31 post/post.c POST test failed, detected by post_output_backlog() 2783 -31 post/post.c POST test failed, detected by post_output_backlog()
2784 -32 post/post.c POST test failed, detected by post_run_single() 2784 -32 post/post.c POST test failed, detected by post_run_single()
2785 2785
2786 34 common/cmd_doc.c before loading a Image from a DOC device 2786 34 common/cmd_doc.c before loading a Image from a DOC device
2787 -35 common/cmd_doc.c Bad usage of "doc" command 2787 -35 common/cmd_doc.c Bad usage of "doc" command
2788 35 common/cmd_doc.c correct usage of "doc" command 2788 35 common/cmd_doc.c correct usage of "doc" command
2789 -36 common/cmd_doc.c No boot device 2789 -36 common/cmd_doc.c No boot device
2790 36 common/cmd_doc.c correct boot device 2790 36 common/cmd_doc.c correct boot device
2791 -37 common/cmd_doc.c Unknown Chip ID on boot device 2791 -37 common/cmd_doc.c Unknown Chip ID on boot device
2792 37 common/cmd_doc.c correct chip ID found, device available 2792 37 common/cmd_doc.c correct chip ID found, device available
2793 -38 common/cmd_doc.c Read Error on boot device 2793 -38 common/cmd_doc.c Read Error on boot device
2794 38 common/cmd_doc.c reading Image header from DOC device OK 2794 38 common/cmd_doc.c reading Image header from DOC device OK
2795 -39 common/cmd_doc.c Image header has bad magic number 2795 -39 common/cmd_doc.c Image header has bad magic number
2796 39 common/cmd_doc.c Image header has correct magic number 2796 39 common/cmd_doc.c Image header has correct magic number
2797 -40 common/cmd_doc.c Error reading Image from DOC device 2797 -40 common/cmd_doc.c Error reading Image from DOC device
2798 40 common/cmd_doc.c Image header has correct magic number 2798 40 common/cmd_doc.c Image header has correct magic number
2799 41 common/cmd_ide.c before loading a Image from a IDE device 2799 41 common/cmd_ide.c before loading a Image from a IDE device
2800 -42 common/cmd_ide.c Bad usage of "ide" command 2800 -42 common/cmd_ide.c Bad usage of "ide" command
2801 42 common/cmd_ide.c correct usage of "ide" command 2801 42 common/cmd_ide.c correct usage of "ide" command
2802 -43 common/cmd_ide.c No boot device 2802 -43 common/cmd_ide.c No boot device
2803 43 common/cmd_ide.c boot device found 2803 43 common/cmd_ide.c boot device found
2804 -44 common/cmd_ide.c Device not available 2804 -44 common/cmd_ide.c Device not available
2805 44 common/cmd_ide.c Device available 2805 44 common/cmd_ide.c Device available
2806 -45 common/cmd_ide.c wrong partition selected 2806 -45 common/cmd_ide.c wrong partition selected
2807 45 common/cmd_ide.c partition selected 2807 45 common/cmd_ide.c partition selected
2808 -46 common/cmd_ide.c Unknown partition table 2808 -46 common/cmd_ide.c Unknown partition table
2809 46 common/cmd_ide.c valid partition table found 2809 46 common/cmd_ide.c valid partition table found
2810 -47 common/cmd_ide.c Invalid partition type 2810 -47 common/cmd_ide.c Invalid partition type
2811 47 common/cmd_ide.c correct partition type 2811 47 common/cmd_ide.c correct partition type
2812 -48 common/cmd_ide.c Error reading Image Header on boot device 2812 -48 common/cmd_ide.c Error reading Image Header on boot device
2813 48 common/cmd_ide.c reading Image Header from IDE device OK 2813 48 common/cmd_ide.c reading Image Header from IDE device OK
2814 -49 common/cmd_ide.c Image header has bad magic number 2814 -49 common/cmd_ide.c Image header has bad magic number
2815 49 common/cmd_ide.c Image header has correct magic number 2815 49 common/cmd_ide.c Image header has correct magic number
2816 -50 common/cmd_ide.c Image header has bad checksum 2816 -50 common/cmd_ide.c Image header has bad checksum
2817 50 common/cmd_ide.c Image header has correct checksum 2817 50 common/cmd_ide.c Image header has correct checksum
2818 -51 common/cmd_ide.c Error reading Image from IDE device 2818 -51 common/cmd_ide.c Error reading Image from IDE device
2819 51 common/cmd_ide.c reading Image from IDE device OK 2819 51 common/cmd_ide.c reading Image from IDE device OK
2820 52 common/cmd_nand.c before loading a Image from a NAND device 2820 52 common/cmd_nand.c before loading a Image from a NAND device
2821 -53 common/cmd_nand.c Bad usage of "nand" command 2821 -53 common/cmd_nand.c Bad usage of "nand" command
2822 53 common/cmd_nand.c correct usage of "nand" command 2822 53 common/cmd_nand.c correct usage of "nand" command
2823 -54 common/cmd_nand.c No boot device 2823 -54 common/cmd_nand.c No boot device
2824 54 common/cmd_nand.c boot device found 2824 54 common/cmd_nand.c boot device found
2825 -55 common/cmd_nand.c Unknown Chip ID on boot device 2825 -55 common/cmd_nand.c Unknown Chip ID on boot device
2826 55 common/cmd_nand.c correct chip ID found, device available 2826 55 common/cmd_nand.c correct chip ID found, device available
2827 -56 common/cmd_nand.c Error reading Image Header on boot device 2827 -56 common/cmd_nand.c Error reading Image Header on boot device
2828 56 common/cmd_nand.c reading Image Header from NAND device OK 2828 56 common/cmd_nand.c reading Image Header from NAND device OK
2829 -57 common/cmd_nand.c Image header has bad magic number 2829 -57 common/cmd_nand.c Image header has bad magic number
2830 57 common/cmd_nand.c Image header has correct magic number 2830 57 common/cmd_nand.c Image header has correct magic number
2831 -58 common/cmd_nand.c Error reading Image from NAND device 2831 -58 common/cmd_nand.c Error reading Image from NAND device
2832 58 common/cmd_nand.c reading Image from NAND device OK 2832 58 common/cmd_nand.c reading Image from NAND device OK
2833 2833
2834 -60 common/env_common.c Environment has a bad CRC, using default 2834 -60 common/env_common.c Environment has a bad CRC, using default
2835 2835
2836 64 net/eth.c starting with Ethernet configuration. 2836 64 net/eth.c starting with Ethernet configuration.
2837 -64 net/eth.c no Ethernet found. 2837 -64 net/eth.c no Ethernet found.
2838 65 net/eth.c Ethernet found. 2838 65 net/eth.c Ethernet found.
2839 2839
2840 -80 common/cmd_net.c usage wrong 2840 -80 common/cmd_net.c usage wrong
2841 80 common/cmd_net.c before calling net_loop() 2841 80 common/cmd_net.c before calling net_loop()
2842 -81 common/cmd_net.c some error in net_loop() occurred 2842 -81 common/cmd_net.c some error in net_loop() occurred
2843 81 common/cmd_net.c net_loop() back without error 2843 81 common/cmd_net.c net_loop() back without error
2844 -82 common/cmd_net.c size == 0 (File with size 0 loaded) 2844 -82 common/cmd_net.c size == 0 (File with size 0 loaded)
2845 82 common/cmd_net.c trying automatic boot 2845 82 common/cmd_net.c trying automatic boot
2846 83 common/cmd_net.c running "source" command 2846 83 common/cmd_net.c running "source" command
2847 -83 common/cmd_net.c some error in automatic boot or "source" command 2847 -83 common/cmd_net.c some error in automatic boot or "source" command
2848 84 common/cmd_net.c end without errors 2848 84 common/cmd_net.c end without errors
2849 2849
2850 FIT uImage format: 2850 FIT uImage format:
2851 2851
2852 Arg Where When 2852 Arg Where When
2853 100 common/cmd_bootm.c Kernel FIT Image has correct format 2853 100 common/cmd_bootm.c Kernel FIT Image has correct format
2854 -100 common/cmd_bootm.c Kernel FIT Image has incorrect format 2854 -100 common/cmd_bootm.c Kernel FIT Image has incorrect format
2855 101 common/cmd_bootm.c No Kernel subimage unit name, using configuration 2855 101 common/cmd_bootm.c No Kernel subimage unit name, using configuration
2856 -101 common/cmd_bootm.c Can't get configuration for kernel subimage 2856 -101 common/cmd_bootm.c Can't get configuration for kernel subimage
2857 102 common/cmd_bootm.c Kernel unit name specified 2857 102 common/cmd_bootm.c Kernel unit name specified
2858 -103 common/cmd_bootm.c Can't get kernel subimage node offset 2858 -103 common/cmd_bootm.c Can't get kernel subimage node offset
2859 103 common/cmd_bootm.c Found configuration node 2859 103 common/cmd_bootm.c Found configuration node
2860 104 common/cmd_bootm.c Got kernel subimage node offset 2860 104 common/cmd_bootm.c Got kernel subimage node offset
2861 -104 common/cmd_bootm.c Kernel subimage hash verification failed 2861 -104 common/cmd_bootm.c Kernel subimage hash verification failed
2862 105 common/cmd_bootm.c Kernel subimage hash verification OK 2862 105 common/cmd_bootm.c Kernel subimage hash verification OK
2863 -105 common/cmd_bootm.c Kernel subimage is for unsupported architecture 2863 -105 common/cmd_bootm.c Kernel subimage is for unsupported architecture
2864 106 common/cmd_bootm.c Architecture check OK 2864 106 common/cmd_bootm.c Architecture check OK
2865 -106 common/cmd_bootm.c Kernel subimage has wrong type 2865 -106 common/cmd_bootm.c Kernel subimage has wrong type
2866 107 common/cmd_bootm.c Kernel subimage type OK 2866 107 common/cmd_bootm.c Kernel subimage type OK
2867 -107 common/cmd_bootm.c Can't get kernel subimage data/size 2867 -107 common/cmd_bootm.c Can't get kernel subimage data/size
2868 108 common/cmd_bootm.c Got kernel subimage data/size 2868 108 common/cmd_bootm.c Got kernel subimage data/size
2869 -108 common/cmd_bootm.c Wrong image type (not legacy, FIT) 2869 -108 common/cmd_bootm.c Wrong image type (not legacy, FIT)
2870 -109 common/cmd_bootm.c Can't get kernel subimage type 2870 -109 common/cmd_bootm.c Can't get kernel subimage type
2871 -110 common/cmd_bootm.c Can't get kernel subimage comp 2871 -110 common/cmd_bootm.c Can't get kernel subimage comp
2872 -111 common/cmd_bootm.c Can't get kernel subimage os 2872 -111 common/cmd_bootm.c Can't get kernel subimage os
2873 -112 common/cmd_bootm.c Can't get kernel subimage load address 2873 -112 common/cmd_bootm.c Can't get kernel subimage load address
2874 -113 common/cmd_bootm.c Image uncompress/copy overwrite error 2874 -113 common/cmd_bootm.c Image uncompress/copy overwrite error
2875 2875
2876 120 common/image.c Start initial ramdisk verification 2876 120 common/image.c Start initial ramdisk verification
2877 -120 common/image.c Ramdisk FIT image has incorrect format 2877 -120 common/image.c Ramdisk FIT image has incorrect format
2878 121 common/image.c Ramdisk FIT image has correct format 2878 121 common/image.c Ramdisk FIT image has correct format
2879 122 common/image.c No ramdisk subimage unit name, using configuration 2879 122 common/image.c No ramdisk subimage unit name, using configuration
2880 -122 common/image.c Can't get configuration for ramdisk subimage 2880 -122 common/image.c Can't get configuration for ramdisk subimage
2881 123 common/image.c Ramdisk unit name specified 2881 123 common/image.c Ramdisk unit name specified
2882 -124 common/image.c Can't get ramdisk subimage node offset 2882 -124 common/image.c Can't get ramdisk subimage node offset
2883 125 common/image.c Got ramdisk subimage node offset 2883 125 common/image.c Got ramdisk subimage node offset
2884 -125 common/image.c Ramdisk subimage hash verification failed 2884 -125 common/image.c Ramdisk subimage hash verification failed
2885 126 common/image.c Ramdisk subimage hash verification OK 2885 126 common/image.c Ramdisk subimage hash verification OK
2886 -126 common/image.c Ramdisk subimage for unsupported architecture 2886 -126 common/image.c Ramdisk subimage for unsupported architecture
2887 127 common/image.c Architecture check OK 2887 127 common/image.c Architecture check OK
2888 -127 common/image.c Can't get ramdisk subimage data/size 2888 -127 common/image.c Can't get ramdisk subimage data/size
2889 128 common/image.c Got ramdisk subimage data/size 2889 128 common/image.c Got ramdisk subimage data/size
2890 129 common/image.c Can't get ramdisk load address 2890 129 common/image.c Can't get ramdisk load address
2891 -129 common/image.c Got ramdisk load address 2891 -129 common/image.c Got ramdisk load address
2892 2892
2893 -130 common/cmd_doc.c Incorrect FIT image format 2893 -130 common/cmd_doc.c Incorrect FIT image format
2894 131 common/cmd_doc.c FIT image format OK 2894 131 common/cmd_doc.c FIT image format OK
2895 2895
2896 -140 common/cmd_ide.c Incorrect FIT image format 2896 -140 common/cmd_ide.c Incorrect FIT image format
2897 141 common/cmd_ide.c FIT image format OK 2897 141 common/cmd_ide.c FIT image format OK
2898 2898
2899 -150 common/cmd_nand.c Incorrect FIT image format 2899 -150 common/cmd_nand.c Incorrect FIT image format
2900 151 common/cmd_nand.c FIT image format OK 2900 151 common/cmd_nand.c FIT image format OK
2901 2901
2902 - legacy image format: 2902 - legacy image format:
2903 CONFIG_IMAGE_FORMAT_LEGACY 2903 CONFIG_IMAGE_FORMAT_LEGACY
2904 enables the legacy image format support in U-Boot. 2904 enables the legacy image format support in U-Boot.
2905 2905
2906 Default: 2906 Default:
2907 enabled if CONFIG_FIT_SIGNATURE is not defined. 2907 enabled if CONFIG_FIT_SIGNATURE is not defined.
2908 2908
2909 CONFIG_DISABLE_IMAGE_LEGACY 2909 CONFIG_DISABLE_IMAGE_LEGACY
2910 disable the legacy image format 2910 disable the legacy image format
2911 2911
2912 This define is introduced, as the legacy image format is 2912 This define is introduced, as the legacy image format is
2913 enabled per default for backward compatibility. 2913 enabled per default for backward compatibility.
2914 2914
2915 - Standalone program support: 2915 - Standalone program support:
2916 CONFIG_STANDALONE_LOAD_ADDR 2916 CONFIG_STANDALONE_LOAD_ADDR
2917 2917
2918 This option defines a board specific value for the 2918 This option defines a board specific value for the
2919 address where standalone program gets loaded, thus 2919 address where standalone program gets loaded, thus
2920 overwriting the architecture dependent default 2920 overwriting the architecture dependent default
2921 settings. 2921 settings.
2922 2922
2923 - Frame Buffer Address: 2923 - Frame Buffer Address:
2924 CONFIG_FB_ADDR 2924 CONFIG_FB_ADDR
2925 2925
2926 Define CONFIG_FB_ADDR if you want to use specific 2926 Define CONFIG_FB_ADDR if you want to use specific
2927 address for frame buffer. This is typically the case 2927 address for frame buffer. This is typically the case
2928 when using a graphics controller has separate video 2928 when using a graphics controller has separate video
2929 memory. U-Boot will then place the frame buffer at 2929 memory. U-Boot will then place the frame buffer at
2930 the given address instead of dynamically reserving it 2930 the given address instead of dynamically reserving it
2931 in system RAM by calling lcd_setmem(), which grabs 2931 in system RAM by calling lcd_setmem(), which grabs
2932 the memory for the frame buffer depending on the 2932 the memory for the frame buffer depending on the
2933 configured panel size. 2933 configured panel size.
2934 2934
2935 Please see board_init_f function. 2935 Please see board_init_f function.
2936 2936
2937 - Automatic software updates via TFTP server 2937 - Automatic software updates via TFTP server
2938 CONFIG_UPDATE_TFTP 2938 CONFIG_UPDATE_TFTP
2939 CONFIG_UPDATE_TFTP_CNT_MAX 2939 CONFIG_UPDATE_TFTP_CNT_MAX
2940 CONFIG_UPDATE_TFTP_MSEC_MAX 2940 CONFIG_UPDATE_TFTP_MSEC_MAX
2941 2941
2942 These options enable and control the auto-update feature; 2942 These options enable and control the auto-update feature;
2943 for a more detailed description refer to doc/README.update. 2943 for a more detailed description refer to doc/README.update.
2944 2944
2945 - MTD Support (mtdparts command, UBI support) 2945 - MTD Support (mtdparts command, UBI support)
2946 CONFIG_MTD_DEVICE 2946 CONFIG_MTD_DEVICE
2947 2947
2948 Adds the MTD device infrastructure from the Linux kernel. 2948 Adds the MTD device infrastructure from the Linux kernel.
2949 Needed for mtdparts command support. 2949 Needed for mtdparts command support.
2950 2950
2951 CONFIG_MTD_PARTITIONS 2951 CONFIG_MTD_PARTITIONS
2952 2952
2953 Adds the MTD partitioning infrastructure from the Linux 2953 Adds the MTD partitioning infrastructure from the Linux
2954 kernel. Needed for UBI support. 2954 kernel. Needed for UBI support.
2955 2955
2956 - UBI support 2956 - UBI support
2957 CONFIG_CMD_UBI 2957 CONFIG_CMD_UBI
2958 2958
2959 Adds commands for interacting with MTD partitions formatted 2959 Adds commands for interacting with MTD partitions formatted
2960 with the UBI flash translation layer 2960 with the UBI flash translation layer
2961 2961
2962 Requires also defining CONFIG_RBTREE 2962 Requires also defining CONFIG_RBTREE
2963 2963
2964 CONFIG_UBI_SILENCE_MSG 2964 CONFIG_UBI_SILENCE_MSG
2965 2965
2966 Make the verbose messages from UBI stop printing. This leaves 2966 Make the verbose messages from UBI stop printing. This leaves
2967 warnings and errors enabled. 2967 warnings and errors enabled.
2968 2968
2969 2969
2970 CONFIG_MTD_UBI_WL_THRESHOLD 2970 CONFIG_MTD_UBI_WL_THRESHOLD
2971 This parameter defines the maximum difference between the highest 2971 This parameter defines the maximum difference between the highest
2972 erase counter value and the lowest erase counter value of eraseblocks 2972 erase counter value and the lowest erase counter value of eraseblocks
2973 of UBI devices. When this threshold is exceeded, UBI starts performing 2973 of UBI devices. When this threshold is exceeded, UBI starts performing
2974 wear leveling by means of moving data from eraseblock with low erase 2974 wear leveling by means of moving data from eraseblock with low erase
2975 counter to eraseblocks with high erase counter. 2975 counter to eraseblocks with high erase counter.
2976 2976
2977 The default value should be OK for SLC NAND flashes, NOR flashes and 2977 The default value should be OK for SLC NAND flashes, NOR flashes and
2978 other flashes which have eraseblock life-cycle 100000 or more. 2978 other flashes which have eraseblock life-cycle 100000 or more.
2979 However, in case of MLC NAND flashes which typically have eraseblock 2979 However, in case of MLC NAND flashes which typically have eraseblock
2980 life-cycle less than 10000, the threshold should be lessened (e.g., 2980 life-cycle less than 10000, the threshold should be lessened (e.g.,
2981 to 128 or 256, although it does not have to be power of 2). 2981 to 128 or 256, although it does not have to be power of 2).
2982 2982
2983 default: 4096 2983 default: 4096
2984 2984
2985 CONFIG_MTD_UBI_BEB_LIMIT 2985 CONFIG_MTD_UBI_BEB_LIMIT
2986 This option specifies the maximum bad physical eraseblocks UBI 2986 This option specifies the maximum bad physical eraseblocks UBI
2987 expects on the MTD device (per 1024 eraseblocks). If the 2987 expects on the MTD device (per 1024 eraseblocks). If the
2988 underlying flash does not admit of bad eraseblocks (e.g. NOR 2988 underlying flash does not admit of bad eraseblocks (e.g. NOR
2989 flash), this value is ignored. 2989 flash), this value is ignored.
2990 2990
2991 NAND datasheets often specify the minimum and maximum NVM 2991 NAND datasheets often specify the minimum and maximum NVM
2992 (Number of Valid Blocks) for the flashes' endurance lifetime. 2992 (Number of Valid Blocks) for the flashes' endurance lifetime.
2993 The maximum expected bad eraseblocks per 1024 eraseblocks 2993 The maximum expected bad eraseblocks per 1024 eraseblocks
2994 then can be calculated as "1024 * (1 - MinNVB / MaxNVB)", 2994 then can be calculated as "1024 * (1 - MinNVB / MaxNVB)",
2995 which gives 20 for most NANDs (MaxNVB is basically the total 2995 which gives 20 for most NANDs (MaxNVB is basically the total
2996 count of eraseblocks on the chip). 2996 count of eraseblocks on the chip).
2997 2997
2998 To put it differently, if this value is 20, UBI will try to 2998 To put it differently, if this value is 20, UBI will try to
2999 reserve about 1.9% of physical eraseblocks for bad blocks 2999 reserve about 1.9% of physical eraseblocks for bad blocks
3000 handling. And that will be 1.9% of eraseblocks on the entire 3000 handling. And that will be 1.9% of eraseblocks on the entire
3001 NAND chip, not just the MTD partition UBI attaches. This means 3001 NAND chip, not just the MTD partition UBI attaches. This means
3002 that if you have, say, a NAND flash chip admits maximum 40 bad 3002 that if you have, say, a NAND flash chip admits maximum 40 bad
3003 eraseblocks, and it is split on two MTD partitions of the same 3003 eraseblocks, and it is split on two MTD partitions of the same
3004 size, UBI will reserve 40 eraseblocks when attaching a 3004 size, UBI will reserve 40 eraseblocks when attaching a
3005 partition. 3005 partition.
3006 3006
3007 default: 20 3007 default: 20
3008 3008
3009 CONFIG_MTD_UBI_FASTMAP 3009 CONFIG_MTD_UBI_FASTMAP
3010 Fastmap is a mechanism which allows attaching an UBI device 3010 Fastmap is a mechanism which allows attaching an UBI device
3011 in nearly constant time. Instead of scanning the whole MTD device it 3011 in nearly constant time. Instead of scanning the whole MTD device it
3012 only has to locate a checkpoint (called fastmap) on the device. 3012 only has to locate a checkpoint (called fastmap) on the device.
3013 The on-flash fastmap contains all information needed to attach 3013 The on-flash fastmap contains all information needed to attach
3014 the device. Using fastmap makes only sense on large devices where 3014 the device. Using fastmap makes only sense on large devices where
3015 attaching by scanning takes long. UBI will not automatically install 3015 attaching by scanning takes long. UBI will not automatically install
3016 a fastmap on old images, but you can set the UBI parameter 3016 a fastmap on old images, but you can set the UBI parameter
3017 CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT to 1 if you want so. Please note 3017 CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT to 1 if you want so. Please note
3018 that fastmap-enabled images are still usable with UBI implementations 3018 that fastmap-enabled images are still usable with UBI implementations
3019 without fastmap support. On typical flash devices the whole fastmap 3019 without fastmap support. On typical flash devices the whole fastmap
3020 fits into one PEB. UBI will reserve PEBs to hold two fastmaps. 3020 fits into one PEB. UBI will reserve PEBs to hold two fastmaps.
3021 3021
3022 CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT 3022 CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT
3023 Set this parameter to enable fastmap automatically on images 3023 Set this parameter to enable fastmap automatically on images
3024 without a fastmap. 3024 without a fastmap.
3025 default: 0 3025 default: 0
3026 3026
3027 CONFIG_MTD_UBI_FM_DEBUG 3027 CONFIG_MTD_UBI_FM_DEBUG
3028 Enable UBI fastmap debug 3028 Enable UBI fastmap debug
3029 default: 0 3029 default: 0
3030 3030
3031 - UBIFS support 3031 - UBIFS support
3032 CONFIG_CMD_UBIFS 3032 CONFIG_CMD_UBIFS
3033 3033
3034 Adds commands for interacting with UBI volumes formatted as 3034 Adds commands for interacting with UBI volumes formatted as
3035 UBIFS. UBIFS is read-only in u-boot. 3035 UBIFS. UBIFS is read-only in u-boot.
3036 3036
3037 Requires UBI support as well as CONFIG_LZO 3037 Requires UBI support as well as CONFIG_LZO
3038 3038
3039 CONFIG_UBIFS_SILENCE_MSG 3039 CONFIG_UBIFS_SILENCE_MSG
3040 3040
3041 Make the verbose messages from UBIFS stop printing. This leaves 3041 Make the verbose messages from UBIFS stop printing. This leaves
3042 warnings and errors enabled. 3042 warnings and errors enabled.
3043 3043
3044 - SPL framework 3044 - SPL framework
3045 CONFIG_SPL 3045 CONFIG_SPL
3046 Enable building of SPL globally. 3046 Enable building of SPL globally.
3047 3047
3048 CONFIG_SPL_LDSCRIPT 3048 CONFIG_SPL_LDSCRIPT
3049 LDSCRIPT for linking the SPL binary. 3049 LDSCRIPT for linking the SPL binary.
3050 3050
3051 CONFIG_SPL_MAX_FOOTPRINT 3051 CONFIG_SPL_MAX_FOOTPRINT
3052 Maximum size in memory allocated to the SPL, BSS included. 3052 Maximum size in memory allocated to the SPL, BSS included.
3053 When defined, the linker checks that the actual memory 3053 When defined, the linker checks that the actual memory
3054 used by SPL from _start to __bss_end does not exceed it. 3054 used by SPL from _start to __bss_end does not exceed it.
3055 CONFIG_SPL_MAX_FOOTPRINT and CONFIG_SPL_BSS_MAX_SIZE 3055 CONFIG_SPL_MAX_FOOTPRINT and CONFIG_SPL_BSS_MAX_SIZE
3056 must not be both defined at the same time. 3056 must not be both defined at the same time.
3057 3057
3058 CONFIG_SPL_MAX_SIZE 3058 CONFIG_SPL_MAX_SIZE
3059 Maximum size of the SPL image (text, data, rodata, and 3059 Maximum size of the SPL image (text, data, rodata, and
3060 linker lists sections), BSS excluded. 3060 linker lists sections), BSS excluded.
3061 When defined, the linker checks that the actual size does 3061 When defined, the linker checks that the actual size does
3062 not exceed it. 3062 not exceed it.
3063 3063
3064 CONFIG_SPL_TEXT_BASE 3064 CONFIG_SPL_TEXT_BASE
3065 TEXT_BASE for linking the SPL binary. 3065 TEXT_BASE for linking the SPL binary.
3066 3066
3067 CONFIG_SPL_RELOC_TEXT_BASE 3067 CONFIG_SPL_RELOC_TEXT_BASE
3068 Address to relocate to. If unspecified, this is equal to 3068 Address to relocate to. If unspecified, this is equal to
3069 CONFIG_SPL_TEXT_BASE (i.e. no relocation is done). 3069 CONFIG_SPL_TEXT_BASE (i.e. no relocation is done).
3070 3070
3071 CONFIG_SPL_BSS_START_ADDR 3071 CONFIG_SPL_BSS_START_ADDR
3072 Link address for the BSS within the SPL binary. 3072 Link address for the BSS within the SPL binary.
3073 3073
3074 CONFIG_SPL_BSS_MAX_SIZE 3074 CONFIG_SPL_BSS_MAX_SIZE
3075 Maximum size in memory allocated to the SPL BSS. 3075 Maximum size in memory allocated to the SPL BSS.
3076 When defined, the linker checks that the actual memory used 3076 When defined, the linker checks that the actual memory used
3077 by SPL from __bss_start to __bss_end does not exceed it. 3077 by SPL from __bss_start to __bss_end does not exceed it.
3078 CONFIG_SPL_MAX_FOOTPRINT and CONFIG_SPL_BSS_MAX_SIZE 3078 CONFIG_SPL_MAX_FOOTPRINT and CONFIG_SPL_BSS_MAX_SIZE
3079 must not be both defined at the same time. 3079 must not be both defined at the same time.
3080 3080
3081 CONFIG_SPL_STACK 3081 CONFIG_SPL_STACK
3082 Adress of the start of the stack SPL will use 3082 Adress of the start of the stack SPL will use
3083 3083
3084 CONFIG_SPL_PANIC_ON_RAW_IMAGE 3084 CONFIG_SPL_PANIC_ON_RAW_IMAGE
3085 When defined, SPL will panic() if the image it has 3085 When defined, SPL will panic() if the image it has
3086 loaded does not have a signature. 3086 loaded does not have a signature.
3087 Defining this is useful when code which loads images 3087 Defining this is useful when code which loads images
3088 in SPL cannot guarantee that absolutely all read errors 3088 in SPL cannot guarantee that absolutely all read errors
3089 will be caught. 3089 will be caught.
3090 An example is the LPC32XX MLC NAND driver, which will 3090 An example is the LPC32XX MLC NAND driver, which will
3091 consider that a completely unreadable NAND block is bad, 3091 consider that a completely unreadable NAND block is bad,
3092 and thus should be skipped silently. 3092 and thus should be skipped silently.
3093 3093
3094 CONFIG_SPL_RELOC_STACK 3094 CONFIG_SPL_RELOC_STACK
3095 Adress of the start of the stack SPL will use after 3095 Adress of the start of the stack SPL will use after
3096 relocation. If unspecified, this is equal to 3096 relocation. If unspecified, this is equal to
3097 CONFIG_SPL_STACK. 3097 CONFIG_SPL_STACK.
3098 3098
3099 CONFIG_SYS_SPL_MALLOC_START 3099 CONFIG_SYS_SPL_MALLOC_START
3100 Starting address of the malloc pool used in SPL. 3100 Starting address of the malloc pool used in SPL.
3101 When this option is set the full malloc is used in SPL and 3101 When this option is set the full malloc is used in SPL and
3102 it is set up by spl_init() and before that, the simple malloc() 3102 it is set up by spl_init() and before that, the simple malloc()
3103 can be used if CONFIG_SYS_MALLOC_F is defined. 3103 can be used if CONFIG_SYS_MALLOC_F is defined.
3104 3104
3105 CONFIG_SYS_SPL_MALLOC_SIZE 3105 CONFIG_SYS_SPL_MALLOC_SIZE
3106 The size of the malloc pool used in SPL. 3106 The size of the malloc pool used in SPL.
3107 3107
3108 CONFIG_SPL_FRAMEWORK 3108 CONFIG_SPL_FRAMEWORK
3109 Enable the SPL framework under common/. This framework 3109 Enable the SPL framework under common/. This framework
3110 supports MMC, NAND and YMODEM loading of U-Boot and NAND 3110 supports MMC, NAND and YMODEM loading of U-Boot and NAND
3111 NAND loading of the Linux Kernel. 3111 NAND loading of the Linux Kernel.
3112 3112
3113 CONFIG_SPL_OS_BOOT 3113 CONFIG_SPL_OS_BOOT
3114 Enable booting directly to an OS from SPL. 3114 Enable booting directly to an OS from SPL.
3115 See also: doc/README.falcon 3115 See also: doc/README.falcon
3116 3116
3117 CONFIG_SPL_DISPLAY_PRINT 3117 CONFIG_SPL_DISPLAY_PRINT
3118 For ARM, enable an optional function to print more information 3118 For ARM, enable an optional function to print more information
3119 about the running system. 3119 about the running system.
3120 3120
3121 CONFIG_SPL_INIT_MINIMAL 3121 CONFIG_SPL_INIT_MINIMAL
3122 Arch init code should be built for a very small image 3122 Arch init code should be built for a very small image
3123 3123
3124 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION 3124 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
3125 Partition on the MMC to load U-Boot from when the MMC is being 3125 Partition on the MMC to load U-Boot from when the MMC is being
3126 used in raw mode 3126 used in raw mode
3127 3127
3128 CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 3128 CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR
3129 Sector to load kernel uImage from when MMC is being 3129 Sector to load kernel uImage from when MMC is being
3130 used in raw mode (for Falcon mode) 3130 used in raw mode (for Falcon mode)
3131 3131
3132 CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR, 3132 CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR,
3133 CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS 3133 CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS
3134 Sector and number of sectors to load kernel argument 3134 Sector and number of sectors to load kernel argument
3135 parameters from when MMC is being used in raw mode 3135 parameters from when MMC is being used in raw mode
3136 (for falcon mode) 3136 (for falcon mode)
3137 3137
3138 CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 3138 CONFIG_SYS_MMCSD_FS_BOOT_PARTITION
3139 Partition on the MMC to load U-Boot from when the MMC is being 3139 Partition on the MMC to load U-Boot from when the MMC is being
3140 used in fs mode 3140 used in fs mode
3141 3141
3142 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME 3142 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME
3143 Filename to read to load U-Boot when reading from filesystem 3143 Filename to read to load U-Boot when reading from filesystem
3144 3144
3145 CONFIG_SPL_FS_LOAD_KERNEL_NAME 3145 CONFIG_SPL_FS_LOAD_KERNEL_NAME
3146 Filename to read to load kernel uImage when reading 3146 Filename to read to load kernel uImage when reading
3147 from filesystem (for Falcon mode) 3147 from filesystem (for Falcon mode)
3148 3148
3149 CONFIG_SPL_FS_LOAD_ARGS_NAME 3149 CONFIG_SPL_FS_LOAD_ARGS_NAME
3150 Filename to read to load kernel argument parameters 3150 Filename to read to load kernel argument parameters
3151 when reading from filesystem (for Falcon mode) 3151 when reading from filesystem (for Falcon mode)
3152 3152
3153 CONFIG_SPL_MPC83XX_WAIT_FOR_NAND 3153 CONFIG_SPL_MPC83XX_WAIT_FOR_NAND
3154 Set this for NAND SPL on PPC mpc83xx targets, so that 3154 Set this for NAND SPL on PPC mpc83xx targets, so that
3155 start.S waits for the rest of the SPL to load before 3155 start.S waits for the rest of the SPL to load before
3156 continuing (the hardware starts execution after just 3156 continuing (the hardware starts execution after just
3157 loading the first page rather than the full 4K). 3157 loading the first page rather than the full 4K).
3158 3158
3159 CONFIG_SPL_SKIP_RELOCATE 3159 CONFIG_SPL_SKIP_RELOCATE
3160 Avoid SPL relocation 3160 Avoid SPL relocation
3161 3161
3162 CONFIG_SPL_NAND_BASE 3162 CONFIG_SPL_NAND_BASE
3163 Include nand_base.c in the SPL. Requires 3163 Include nand_base.c in the SPL. Requires
3164 CONFIG_SPL_NAND_DRIVERS. 3164 CONFIG_SPL_NAND_DRIVERS.
3165 3165
3166 CONFIG_SPL_NAND_DRIVERS 3166 CONFIG_SPL_NAND_DRIVERS
3167 SPL uses normal NAND drivers, not minimal drivers. 3167 SPL uses normal NAND drivers, not minimal drivers.
3168 3168
3169 CONFIG_SPL_NAND_ECC 3169 CONFIG_SPL_NAND_ECC
3170 Include standard software ECC in the SPL 3170 Include standard software ECC in the SPL
3171 3171
3172 CONFIG_SPL_NAND_SIMPLE 3172 CONFIG_SPL_NAND_SIMPLE
3173 Support for NAND boot using simple NAND drivers that 3173 Support for NAND boot using simple NAND drivers that
3174 expose the cmd_ctrl() interface. 3174 expose the cmd_ctrl() interface.
3175 3175
3176 CONFIG_SPL_UBI 3176 CONFIG_SPL_UBI
3177 Support for a lightweight UBI (fastmap) scanner and 3177 Support for a lightweight UBI (fastmap) scanner and
3178 loader 3178 loader
3179 3179
3180 CONFIG_SPL_NAND_RAW_ONLY 3180 CONFIG_SPL_NAND_RAW_ONLY
3181 Support to boot only raw u-boot.bin images. Use this only 3181 Support to boot only raw u-boot.bin images. Use this only
3182 if you need to save space. 3182 if you need to save space.
3183 3183
3184 CONFIG_SPL_COMMON_INIT_DDR 3184 CONFIG_SPL_COMMON_INIT_DDR
3185 Set for common ddr init with serial presence detect in 3185 Set for common ddr init with serial presence detect in
3186 SPL binary. 3186 SPL binary.
3187 3187
3188 CONFIG_SYS_NAND_5_ADDR_CYCLE, CONFIG_SYS_NAND_PAGE_COUNT, 3188 CONFIG_SYS_NAND_5_ADDR_CYCLE, CONFIG_SYS_NAND_PAGE_COUNT,
3189 CONFIG_SYS_NAND_PAGE_SIZE, CONFIG_SYS_NAND_OOBSIZE, 3189 CONFIG_SYS_NAND_PAGE_SIZE, CONFIG_SYS_NAND_OOBSIZE,
3190 CONFIG_SYS_NAND_BLOCK_SIZE, CONFIG_SYS_NAND_BAD_BLOCK_POS, 3190 CONFIG_SYS_NAND_BLOCK_SIZE, CONFIG_SYS_NAND_BAD_BLOCK_POS,
3191 CONFIG_SYS_NAND_ECCPOS, CONFIG_SYS_NAND_ECCSIZE, 3191 CONFIG_SYS_NAND_ECCPOS, CONFIG_SYS_NAND_ECCSIZE,
3192 CONFIG_SYS_NAND_ECCBYTES 3192 CONFIG_SYS_NAND_ECCBYTES
3193 Defines the size and behavior of the NAND that SPL uses 3193 Defines the size and behavior of the NAND that SPL uses
3194 to read U-Boot 3194 to read U-Boot
3195 3195
3196 CONFIG_SPL_NAND_BOOT 3196 CONFIG_SPL_NAND_BOOT
3197 Add support NAND boot 3197 Add support NAND boot
3198 3198
3199 CONFIG_SYS_NAND_U_BOOT_OFFS 3199 CONFIG_SYS_NAND_U_BOOT_OFFS
3200 Location in NAND to read U-Boot from 3200 Location in NAND to read U-Boot from
3201 3201
3202 CONFIG_SYS_NAND_U_BOOT_DST 3202 CONFIG_SYS_NAND_U_BOOT_DST
3203 Location in memory to load U-Boot to 3203 Location in memory to load U-Boot to
3204 3204
3205 CONFIG_SYS_NAND_U_BOOT_SIZE 3205 CONFIG_SYS_NAND_U_BOOT_SIZE
3206 Size of image to load 3206 Size of image to load
3207 3207
3208 CONFIG_SYS_NAND_U_BOOT_START 3208 CONFIG_SYS_NAND_U_BOOT_START
3209 Entry point in loaded image to jump to 3209 Entry point in loaded image to jump to
3210 3210
3211 CONFIG_SYS_NAND_HW_ECC_OOBFIRST 3211 CONFIG_SYS_NAND_HW_ECC_OOBFIRST
3212 Define this if you need to first read the OOB and then the 3212 Define this if you need to first read the OOB and then the
3213 data. This is used, for example, on davinci platforms. 3213 data. This is used, for example, on davinci platforms.
3214 3214
3215 CONFIG_SPL_OMAP3_ID_NAND 3215 CONFIG_SPL_OMAP3_ID_NAND
3216 Support for an OMAP3-specific set of functions to return the 3216 Support for an OMAP3-specific set of functions to return the
3217 ID and MFR of the first attached NAND chip, if present. 3217 ID and MFR of the first attached NAND chip, if present.
3218 3218
3219 CONFIG_SPL_RAM_DEVICE 3219 CONFIG_SPL_RAM_DEVICE
3220 Support for running image already present in ram, in SPL binary 3220 Support for running image already present in ram, in SPL binary
3221 3221
3222 CONFIG_SPL_PAD_TO 3222 CONFIG_SPL_PAD_TO
3223 Image offset to which the SPL should be padded before appending 3223 Image offset to which the SPL should be padded before appending
3224 the SPL payload. By default, this is defined as 3224 the SPL payload. By default, this is defined as
3225 CONFIG_SPL_MAX_SIZE, or 0 if CONFIG_SPL_MAX_SIZE is undefined. 3225 CONFIG_SPL_MAX_SIZE, or 0 if CONFIG_SPL_MAX_SIZE is undefined.
3226 CONFIG_SPL_PAD_TO must be either 0, meaning to append the SPL 3226 CONFIG_SPL_PAD_TO must be either 0, meaning to append the SPL
3227 payload without any padding, or >= CONFIG_SPL_MAX_SIZE. 3227 payload without any padding, or >= CONFIG_SPL_MAX_SIZE.
3228 3228
3229 CONFIG_SPL_TARGET 3229 CONFIG_SPL_TARGET
3230 Final target image containing SPL and payload. Some SPLs 3230 Final target image containing SPL and payload. Some SPLs
3231 use an arch-specific makefile fragment instead, for 3231 use an arch-specific makefile fragment instead, for
3232 example if more than one image needs to be produced. 3232 example if more than one image needs to be produced.
3233 3233
3234 CONFIG_FIT_SPL_PRINT 3234 CONFIG_FIT_SPL_PRINT
3235 Printing information about a FIT image adds quite a bit of 3235 Printing information about a FIT image adds quite a bit of
3236 code to SPL. So this is normally disabled in SPL. Use this 3236 code to SPL. So this is normally disabled in SPL. Use this
3237 option to re-enable it. This will affect the output of the 3237 option to re-enable it. This will affect the output of the
3238 bootm command when booting a FIT image. 3238 bootm command when booting a FIT image.
3239 3239
3240 - TPL framework 3240 - TPL framework
3241 CONFIG_TPL 3241 CONFIG_TPL
3242 Enable building of TPL globally. 3242 Enable building of TPL globally.
3243 3243
3244 CONFIG_TPL_PAD_TO 3244 CONFIG_TPL_PAD_TO
3245 Image offset to which the TPL should be padded before appending 3245 Image offset to which the TPL should be padded before appending
3246 the TPL payload. By default, this is defined as 3246 the TPL payload. By default, this is defined as
3247 CONFIG_SPL_MAX_SIZE, or 0 if CONFIG_SPL_MAX_SIZE is undefined. 3247 CONFIG_SPL_MAX_SIZE, or 0 if CONFIG_SPL_MAX_SIZE is undefined.
3248 CONFIG_SPL_PAD_TO must be either 0, meaning to append the SPL 3248 CONFIG_SPL_PAD_TO must be either 0, meaning to append the SPL
3249 payload without any padding, or >= CONFIG_SPL_MAX_SIZE. 3249 payload without any padding, or >= CONFIG_SPL_MAX_SIZE.
3250 3250
3251 - Interrupt support (PPC): 3251 - Interrupt support (PPC):
3252 3252
3253 There are common interrupt_init() and timer_interrupt() 3253 There are common interrupt_init() and timer_interrupt()
3254 for all PPC archs. interrupt_init() calls interrupt_init_cpu() 3254 for all PPC archs. interrupt_init() calls interrupt_init_cpu()
3255 for CPU specific initialization. interrupt_init_cpu() 3255 for CPU specific initialization. interrupt_init_cpu()
3256 should set decrementer_count to appropriate value. If 3256 should set decrementer_count to appropriate value. If
3257 CPU resets decrementer automatically after interrupt 3257 CPU resets decrementer automatically after interrupt
3258 (ppc4xx) it should set decrementer_count to zero. 3258 (ppc4xx) it should set decrementer_count to zero.
3259 timer_interrupt() calls timer_interrupt_cpu() for CPU 3259 timer_interrupt() calls timer_interrupt_cpu() for CPU
3260 specific handling. If board has watchdog / status_led 3260 specific handling. If board has watchdog / status_led
3261 / other_activity_monitor it works automatically from 3261 / other_activity_monitor it works automatically from
3262 general timer_interrupt(). 3262 general timer_interrupt().
3263 3263
3264 3264
3265 Board initialization settings: 3265 Board initialization settings:
3266 ------------------------------ 3266 ------------------------------
3267 3267
3268 During Initialization u-boot calls a number of board specific functions 3268 During Initialization u-boot calls a number of board specific functions
3269 to allow the preparation of board specific prerequisites, e.g. pin setup 3269 to allow the preparation of board specific prerequisites, e.g. pin setup
3270 before drivers are initialized. To enable these callbacks the 3270 before drivers are initialized. To enable these callbacks the
3271 following configuration macros have to be defined. Currently this is 3271 following configuration macros have to be defined. Currently this is
3272 architecture specific, so please check arch/your_architecture/lib/board.c 3272 architecture specific, so please check arch/your_architecture/lib/board.c
3273 typically in board_init_f() and board_init_r(). 3273 typically in board_init_f() and board_init_r().
3274 3274
3275 - CONFIG_BOARD_EARLY_INIT_F: Call board_early_init_f() 3275 - CONFIG_BOARD_EARLY_INIT_F: Call board_early_init_f()
3276 - CONFIG_BOARD_EARLY_INIT_R: Call board_early_init_r() 3276 - CONFIG_BOARD_EARLY_INIT_R: Call board_early_init_r()
3277 - CONFIG_BOARD_LATE_INIT: Call board_late_init() 3277 - CONFIG_BOARD_LATE_INIT: Call board_late_init()
3278 - CONFIG_BOARD_POSTCLK_INIT: Call board_postclk_init() 3278 - CONFIG_BOARD_POSTCLK_INIT: Call board_postclk_init()
3279 3279
3280 Configuration Settings: 3280 Configuration Settings:
3281 ----------------------- 3281 -----------------------
3282 3282
3283 - CONFIG_SYS_SUPPORT_64BIT_DATA: Defined automatically if compiled as 64-bit. 3283 - CONFIG_SYS_SUPPORT_64BIT_DATA: Defined automatically if compiled as 64-bit.
3284 Optionally it can be defined to support 64-bit memory commands. 3284 Optionally it can be defined to support 64-bit memory commands.
3285 3285
3286 - CONFIG_SYS_LONGHELP: Defined when you want long help messages included; 3286 - CONFIG_SYS_LONGHELP: Defined when you want long help messages included;
3287 undefine this when you're short of memory. 3287 undefine this when you're short of memory.
3288 3288
3289 - CONFIG_SYS_HELP_CMD_WIDTH: Defined when you want to override the default 3289 - CONFIG_SYS_HELP_CMD_WIDTH: Defined when you want to override the default
3290 width of the commands listed in the 'help' command output. 3290 width of the commands listed in the 'help' command output.
3291 3291
3292 - CONFIG_SYS_PROMPT: This is what U-Boot prints on the console to 3292 - CONFIG_SYS_PROMPT: This is what U-Boot prints on the console to
3293 prompt for user input. 3293 prompt for user input.
3294 3294
3295 - CONFIG_SYS_CBSIZE: Buffer size for input from the Console 3295 - CONFIG_SYS_CBSIZE: Buffer size for input from the Console
3296 3296
3297 - CONFIG_SYS_PBSIZE: Buffer size for Console output 3297 - CONFIG_SYS_PBSIZE: Buffer size for Console output
3298 3298
3299 - CONFIG_SYS_MAXARGS: max. Number of arguments accepted for monitor commands 3299 - CONFIG_SYS_MAXARGS: max. Number of arguments accepted for monitor commands
3300 3300
3301 - CONFIG_SYS_BARGSIZE: Buffer size for Boot Arguments which are passed to 3301 - CONFIG_SYS_BARGSIZE: Buffer size for Boot Arguments which are passed to
3302 the application (usually a Linux kernel) when it is 3302 the application (usually a Linux kernel) when it is
3303 booted 3303 booted
3304 3304
3305 - CONFIG_SYS_BAUDRATE_TABLE: 3305 - CONFIG_SYS_BAUDRATE_TABLE:
3306 List of legal baudrate settings for this board. 3306 List of legal baudrate settings for this board.
3307 3307
3308 - CONFIG_SYS_MEMTEST_START, CONFIG_SYS_MEMTEST_END: 3308 - CONFIG_SYS_MEMTEST_START, CONFIG_SYS_MEMTEST_END:
3309 Begin and End addresses of the area used by the 3309 Begin and End addresses of the area used by the
3310 simple memory test. 3310 simple memory test.
3311 3311
3312 - CONFIG_SYS_ALT_MEMTEST: 3312 - CONFIG_SYS_ALT_MEMTEST:
3313 Enable an alternate, more extensive memory test. 3313 Enable an alternate, more extensive memory test.
3314 3314
3315 - CONFIG_SYS_MEMTEST_SCRATCH: 3315 - CONFIG_SYS_MEMTEST_SCRATCH:
3316 Scratch address used by the alternate memory test 3316 Scratch address used by the alternate memory test
3317 You only need to set this if address zero isn't writeable 3317 You only need to set this if address zero isn't writeable
3318 3318
3319 - CONFIG_SYS_MEM_RESERVE_SECURE 3319 - CONFIG_SYS_MEM_RESERVE_SECURE
3320 Only implemented for ARMv8 for now. 3320 Only implemented for ARMv8 for now.
3321 If defined, the size of CONFIG_SYS_MEM_RESERVE_SECURE memory 3321 If defined, the size of CONFIG_SYS_MEM_RESERVE_SECURE memory
3322 is substracted from total RAM and won't be reported to OS. 3322 is substracted from total RAM and won't be reported to OS.
3323 This memory can be used as secure memory. A variable 3323 This memory can be used as secure memory. A variable
3324 gd->arch.secure_ram is used to track the location. In systems 3324 gd->arch.secure_ram is used to track the location. In systems
3325 the RAM base is not zero, or RAM is divided into banks, 3325 the RAM base is not zero, or RAM is divided into banks,
3326 this variable needs to be recalcuated to get the address. 3326 this variable needs to be recalcuated to get the address.
3327 3327
3328 - CONFIG_SYS_MEM_TOP_HIDE: 3328 - CONFIG_SYS_MEM_TOP_HIDE:
3329 If CONFIG_SYS_MEM_TOP_HIDE is defined in the board config header, 3329 If CONFIG_SYS_MEM_TOP_HIDE is defined in the board config header,
3330 this specified memory area will get subtracted from the top 3330 this specified memory area will get subtracted from the top
3331 (end) of RAM and won't get "touched" at all by U-Boot. By 3331 (end) of RAM and won't get "touched" at all by U-Boot. By
3332 fixing up gd->ram_size the Linux kernel should gets passed 3332 fixing up gd->ram_size the Linux kernel should gets passed
3333 the now "corrected" memory size and won't touch it either. 3333 the now "corrected" memory size and won't touch it either.
3334 This should work for arch/ppc and arch/powerpc. Only Linux 3334 This should work for arch/ppc and arch/powerpc. Only Linux
3335 board ports in arch/powerpc with bootwrapper support that 3335 board ports in arch/powerpc with bootwrapper support that
3336 recalculate the memory size from the SDRAM controller setup 3336 recalculate the memory size from the SDRAM controller setup
3337 will have to get fixed in Linux additionally. 3337 will have to get fixed in Linux additionally.
3338 3338
3339 This option can be used as a workaround for the 440EPx/GRx 3339 This option can be used as a workaround for the 440EPx/GRx
3340 CHIP 11 errata where the last 256 bytes in SDRAM shouldn't 3340 CHIP 11 errata where the last 256 bytes in SDRAM shouldn't
3341 be touched. 3341 be touched.
3342 3342
3343 WARNING: Please make sure that this value is a multiple of 3343 WARNING: Please make sure that this value is a multiple of
3344 the Linux page size (normally 4k). If this is not the case, 3344 the Linux page size (normally 4k). If this is not the case,
3345 then the end address of the Linux memory will be located at a 3345 then the end address of the Linux memory will be located at a
3346 non page size aligned address and this could cause major 3346 non page size aligned address and this could cause major
3347 problems. 3347 problems.
3348 3348
3349 - CONFIG_SYS_LOADS_BAUD_CHANGE: 3349 - CONFIG_SYS_LOADS_BAUD_CHANGE:
3350 Enable temporary baudrate change while serial download 3350 Enable temporary baudrate change while serial download
3351 3351
3352 - CONFIG_SYS_SDRAM_BASE: 3352 - CONFIG_SYS_SDRAM_BASE:
3353 Physical start address of SDRAM. _Must_ be 0 here. 3353 Physical start address of SDRAM. _Must_ be 0 here.
3354 3354
3355 - CONFIG_SYS_FLASH_BASE: 3355 - CONFIG_SYS_FLASH_BASE:
3356 Physical start address of Flash memory. 3356 Physical start address of Flash memory.
3357 3357
3358 - CONFIG_SYS_MONITOR_BASE: 3358 - CONFIG_SYS_MONITOR_BASE:
3359 Physical start address of boot monitor code (set by 3359 Physical start address of boot monitor code (set by
3360 make config files to be same as the text base address 3360 make config files to be same as the text base address
3361 (CONFIG_SYS_TEXT_BASE) used when linking) - same as 3361 (CONFIG_SYS_TEXT_BASE) used when linking) - same as
3362 CONFIG_SYS_FLASH_BASE when booting from flash. 3362 CONFIG_SYS_FLASH_BASE when booting from flash.
3363 3363
3364 - CONFIG_SYS_MONITOR_LEN: 3364 - CONFIG_SYS_MONITOR_LEN:
3365 Size of memory reserved for monitor code, used to 3365 Size of memory reserved for monitor code, used to
3366 determine _at_compile_time_ (!) if the environment is 3366 determine _at_compile_time_ (!) if the environment is
3367 embedded within the U-Boot image, or in a separate 3367 embedded within the U-Boot image, or in a separate
3368 flash sector. 3368 flash sector.
3369 3369
3370 - CONFIG_SYS_MALLOC_LEN: 3370 - CONFIG_SYS_MALLOC_LEN:
3371 Size of DRAM reserved for malloc() use. 3371 Size of DRAM reserved for malloc() use.
3372 3372
3373 - CONFIG_SYS_MALLOC_F_LEN 3373 - CONFIG_SYS_MALLOC_F_LEN
3374 Size of the malloc() pool for use before relocation. If 3374 Size of the malloc() pool for use before relocation. If
3375 this is defined, then a very simple malloc() implementation 3375 this is defined, then a very simple malloc() implementation
3376 will become available before relocation. The address is just 3376 will become available before relocation. The address is just
3377 below the global data, and the stack is moved down to make 3377 below the global data, and the stack is moved down to make
3378 space. 3378 space.
3379 3379
3380 This feature allocates regions with increasing addresses 3380 This feature allocates regions with increasing addresses
3381 within the region. calloc() is supported, but realloc() 3381 within the region. calloc() is supported, but realloc()
3382 is not available. free() is supported but does nothing. 3382 is not available. free() is supported but does nothing.
3383 The memory will be freed (or in fact just forgotten) when 3383 The memory will be freed (or in fact just forgotten) when
3384 U-Boot relocates itself. 3384 U-Boot relocates itself.
3385 3385
3386 - CONFIG_SYS_MALLOC_SIMPLE 3386 - CONFIG_SYS_MALLOC_SIMPLE
3387 Provides a simple and small malloc() and calloc() for those 3387 Provides a simple and small malloc() and calloc() for those
3388 boards which do not use the full malloc in SPL (which is 3388 boards which do not use the full malloc in SPL (which is
3389 enabled with CONFIG_SYS_SPL_MALLOC_START). 3389 enabled with CONFIG_SYS_SPL_MALLOC_START).
3390 3390
3391 - CONFIG_SYS_NONCACHED_MEMORY: 3391 - CONFIG_SYS_NONCACHED_MEMORY:
3392 Size of non-cached memory area. This area of memory will be 3392 Size of non-cached memory area. This area of memory will be
3393 typically located right below the malloc() area and mapped 3393 typically located right below the malloc() area and mapped
3394 uncached in the MMU. This is useful for drivers that would 3394 uncached in the MMU. This is useful for drivers that would
3395 otherwise require a lot of explicit cache maintenance. For 3395 otherwise require a lot of explicit cache maintenance. For
3396 some drivers it's also impossible to properly maintain the 3396 some drivers it's also impossible to properly maintain the
3397 cache. For example if the regions that need to be flushed 3397 cache. For example if the regions that need to be flushed
3398 are not a multiple of the cache-line size, *and* padding 3398 are not a multiple of the cache-line size, *and* padding
3399 cannot be allocated between the regions to align them (i.e. 3399 cannot be allocated between the regions to align them (i.e.
3400 if the HW requires a contiguous array of regions, and the 3400 if the HW requires a contiguous array of regions, and the
3401 size of each region is not cache-aligned), then a flush of 3401 size of each region is not cache-aligned), then a flush of
3402 one region may result in overwriting data that hardware has 3402 one region may result in overwriting data that hardware has
3403 written to another region in the same cache-line. This can 3403 written to another region in the same cache-line. This can
3404 happen for example in network drivers where descriptors for 3404 happen for example in network drivers where descriptors for
3405 buffers are typically smaller than the CPU cache-line (e.g. 3405 buffers are typically smaller than the CPU cache-line (e.g.
3406 16 bytes vs. 32 or 64 bytes). 3406 16 bytes vs. 32 or 64 bytes).
3407 3407
3408 Non-cached memory is only supported on 32-bit ARM at present. 3408 Non-cached memory is only supported on 32-bit ARM at present.
3409 3409
3410 - CONFIG_SYS_BOOTM_LEN: 3410 - CONFIG_SYS_BOOTM_LEN:
3411 Normally compressed uImages are limited to an 3411 Normally compressed uImages are limited to an
3412 uncompressed size of 8 MBytes. If this is not enough, 3412 uncompressed size of 8 MBytes. If this is not enough,
3413 you can define CONFIG_SYS_BOOTM_LEN in your board config file 3413 you can define CONFIG_SYS_BOOTM_LEN in your board config file
3414 to adjust this setting to your needs. 3414 to adjust this setting to your needs.
3415 3415
3416 - CONFIG_SYS_BOOTMAPSZ: 3416 - CONFIG_SYS_BOOTMAPSZ:
3417 Maximum size of memory mapped by the startup code of 3417 Maximum size of memory mapped by the startup code of
3418 the Linux kernel; all data that must be processed by 3418 the Linux kernel; all data that must be processed by
3419 the Linux kernel (bd_info, boot arguments, FDT blob if 3419 the Linux kernel (bd_info, boot arguments, FDT blob if
3420 used) must be put below this limit, unless "bootm_low" 3420 used) must be put below this limit, unless "bootm_low"
3421 environment variable is defined and non-zero. In such case 3421 environment variable is defined and non-zero. In such case
3422 all data for the Linux kernel must be between "bootm_low" 3422 all data for the Linux kernel must be between "bootm_low"
3423 and "bootm_low" + CONFIG_SYS_BOOTMAPSZ. The environment 3423 and "bootm_low" + CONFIG_SYS_BOOTMAPSZ. The environment
3424 variable "bootm_mapsize" will override the value of 3424 variable "bootm_mapsize" will override the value of
3425 CONFIG_SYS_BOOTMAPSZ. If CONFIG_SYS_BOOTMAPSZ is undefined, 3425 CONFIG_SYS_BOOTMAPSZ. If CONFIG_SYS_BOOTMAPSZ is undefined,
3426 then the value in "bootm_size" will be used instead. 3426 then the value in "bootm_size" will be used instead.
3427 3427
3428 - CONFIG_SYS_BOOT_RAMDISK_HIGH: 3428 - CONFIG_SYS_BOOT_RAMDISK_HIGH:
3429 Enable initrd_high functionality. If defined then the 3429 Enable initrd_high functionality. If defined then the
3430 initrd_high feature is enabled and the bootm ramdisk subcommand 3430 initrd_high feature is enabled and the bootm ramdisk subcommand
3431 is enabled. 3431 is enabled.
3432 3432
3433 - CONFIG_SYS_BOOT_GET_CMDLINE: 3433 - CONFIG_SYS_BOOT_GET_CMDLINE:
3434 Enables allocating and saving kernel cmdline in space between 3434 Enables allocating and saving kernel cmdline in space between
3435 "bootm_low" and "bootm_low" + BOOTMAPSZ. 3435 "bootm_low" and "bootm_low" + BOOTMAPSZ.
3436 3436
3437 - CONFIG_SYS_BOOT_GET_KBD: 3437 - CONFIG_SYS_BOOT_GET_KBD:
3438 Enables allocating and saving a kernel copy of the bd_info in 3438 Enables allocating and saving a kernel copy of the bd_info in
3439 space between "bootm_low" and "bootm_low" + BOOTMAPSZ. 3439 space between "bootm_low" and "bootm_low" + BOOTMAPSZ.
3440 3440
3441 - CONFIG_SYS_MAX_FLASH_BANKS: 3441 - CONFIG_SYS_MAX_FLASH_BANKS:
3442 Max number of Flash memory banks 3442 Max number of Flash memory banks
3443 3443
3444 - CONFIG_SYS_MAX_FLASH_SECT: 3444 - CONFIG_SYS_MAX_FLASH_SECT:
3445 Max number of sectors on a Flash chip 3445 Max number of sectors on a Flash chip
3446 3446
3447 - CONFIG_SYS_FLASH_ERASE_TOUT: 3447 - CONFIG_SYS_FLASH_ERASE_TOUT:
3448 Timeout for Flash erase operations (in ms) 3448 Timeout for Flash erase operations (in ms)
3449 3449
3450 - CONFIG_SYS_FLASH_WRITE_TOUT: 3450 - CONFIG_SYS_FLASH_WRITE_TOUT:
3451 Timeout for Flash write operations (in ms) 3451 Timeout for Flash write operations (in ms)
3452 3452
3453 - CONFIG_SYS_FLASH_LOCK_TOUT 3453 - CONFIG_SYS_FLASH_LOCK_TOUT
3454 Timeout for Flash set sector lock bit operation (in ms) 3454 Timeout for Flash set sector lock bit operation (in ms)
3455 3455
3456 - CONFIG_SYS_FLASH_UNLOCK_TOUT 3456 - CONFIG_SYS_FLASH_UNLOCK_TOUT
3457 Timeout for Flash clear lock bits operation (in ms) 3457 Timeout for Flash clear lock bits operation (in ms)
3458 3458
3459 - CONFIG_SYS_FLASH_PROTECTION 3459 - CONFIG_SYS_FLASH_PROTECTION
3460 If defined, hardware flash sectors protection is used 3460 If defined, hardware flash sectors protection is used
3461 instead of U-Boot software protection. 3461 instead of U-Boot software protection.
3462 3462
3463 - CONFIG_SYS_DIRECT_FLASH_TFTP: 3463 - CONFIG_SYS_DIRECT_FLASH_TFTP:
3464 3464
3465 Enable TFTP transfers directly to flash memory; 3465 Enable TFTP transfers directly to flash memory;
3466 without this option such a download has to be 3466 without this option such a download has to be
3467 performed in two steps: (1) download to RAM, and (2) 3467 performed in two steps: (1) download to RAM, and (2)
3468 copy from RAM to flash. 3468 copy from RAM to flash.
3469 3469
3470 The two-step approach is usually more reliable, since 3470 The two-step approach is usually more reliable, since
3471 you can check if the download worked before you erase 3471 you can check if the download worked before you erase
3472 the flash, but in some situations (when system RAM is 3472 the flash, but in some situations (when system RAM is
3473 too limited to allow for a temporary copy of the 3473 too limited to allow for a temporary copy of the
3474 downloaded image) this option may be very useful. 3474 downloaded image) this option may be very useful.
3475 3475
3476 - CONFIG_SYS_FLASH_CFI: 3476 - CONFIG_SYS_FLASH_CFI:
3477 Define if the flash driver uses extra elements in the 3477 Define if the flash driver uses extra elements in the
3478 common flash structure for storing flash geometry. 3478 common flash structure for storing flash geometry.
3479 3479
3480 - CONFIG_FLASH_CFI_DRIVER 3480 - CONFIG_FLASH_CFI_DRIVER
3481 This option also enables the building of the cfi_flash driver 3481 This option also enables the building of the cfi_flash driver
3482 in the drivers directory 3482 in the drivers directory
3483 3483
3484 - CONFIG_FLASH_CFI_MTD 3484 - CONFIG_FLASH_CFI_MTD
3485 This option enables the building of the cfi_mtd driver 3485 This option enables the building of the cfi_mtd driver
3486 in the drivers directory. The driver exports CFI flash 3486 in the drivers directory. The driver exports CFI flash
3487 to the MTD layer. 3487 to the MTD layer.
3488 3488
3489 - CONFIG_SYS_FLASH_USE_BUFFER_WRITE 3489 - CONFIG_SYS_FLASH_USE_BUFFER_WRITE
3490 Use buffered writes to flash. 3490 Use buffered writes to flash.
3491 3491
3492 - CONFIG_FLASH_SPANSION_S29WS_N 3492 - CONFIG_FLASH_SPANSION_S29WS_N
3493 s29ws-n MirrorBit flash has non-standard addresses for buffered 3493 s29ws-n MirrorBit flash has non-standard addresses for buffered
3494 write commands. 3494 write commands.
3495 3495
3496 - CONFIG_SYS_FLASH_QUIET_TEST 3496 - CONFIG_SYS_FLASH_QUIET_TEST
3497 If this option is defined, the common CFI flash doesn't 3497 If this option is defined, the common CFI flash doesn't
3498 print it's warning upon not recognized FLASH banks. This 3498 print it's warning upon not recognized FLASH banks. This
3499 is useful, if some of the configured banks are only 3499 is useful, if some of the configured banks are only
3500 optionally available. 3500 optionally available.
3501 3501
3502 - CONFIG_FLASH_SHOW_PROGRESS 3502 - CONFIG_FLASH_SHOW_PROGRESS
3503 If defined (must be an integer), print out countdown 3503 If defined (must be an integer), print out countdown
3504 digits and dots. Recommended value: 45 (9..1) for 80 3504 digits and dots. Recommended value: 45 (9..1) for 80
3505 column displays, 15 (3..1) for 40 column displays. 3505 column displays, 15 (3..1) for 40 column displays.
3506 3506
3507 - CONFIG_FLASH_VERIFY 3507 - CONFIG_FLASH_VERIFY
3508 If defined, the content of the flash (destination) is compared 3508 If defined, the content of the flash (destination) is compared
3509 against the source after the write operation. An error message 3509 against the source after the write operation. An error message
3510 will be printed when the contents are not identical. 3510 will be printed when the contents are not identical.
3511 Please note that this option is useless in nearly all cases, 3511 Please note that this option is useless in nearly all cases,
3512 since such flash programming errors usually are detected earlier 3512 since such flash programming errors usually are detected earlier
3513 while unprotecting/erasing/programming. Please only enable 3513 while unprotecting/erasing/programming. Please only enable
3514 this option if you really know what you are doing. 3514 this option if you really know what you are doing.
3515 3515
3516 - CONFIG_SYS_RX_ETH_BUFFER: 3516 - CONFIG_SYS_RX_ETH_BUFFER:
3517 Defines the number of Ethernet receive buffers. On some 3517 Defines the number of Ethernet receive buffers. On some
3518 Ethernet controllers it is recommended to set this value 3518 Ethernet controllers it is recommended to set this value
3519 to 8 or even higher (EEPRO100 or 405 EMAC), since all 3519 to 8 or even higher (EEPRO100 or 405 EMAC), since all
3520 buffers can be full shortly after enabling the interface 3520 buffers can be full shortly after enabling the interface
3521 on high Ethernet traffic. 3521 on high Ethernet traffic.
3522 Defaults to 4 if not defined. 3522 Defaults to 4 if not defined.
3523 3523
3524 - CONFIG_ENV_MAX_ENTRIES 3524 - CONFIG_ENV_MAX_ENTRIES
3525 3525
3526 Maximum number of entries in the hash table that is used 3526 Maximum number of entries in the hash table that is used
3527 internally to store the environment settings. The default 3527 internally to store the environment settings. The default
3528 setting is supposed to be generous and should work in most 3528 setting is supposed to be generous and should work in most
3529 cases. This setting can be used to tune behaviour; see 3529 cases. This setting can be used to tune behaviour; see
3530 lib/hashtable.c for details. 3530 lib/hashtable.c for details.
3531 3531
3532 - CONFIG_ENV_FLAGS_LIST_DEFAULT 3532 - CONFIG_ENV_FLAGS_LIST_DEFAULT
3533 - CONFIG_ENV_FLAGS_LIST_STATIC 3533 - CONFIG_ENV_FLAGS_LIST_STATIC
3534 Enable validation of the values given to environment variables when 3534 Enable validation of the values given to environment variables when
3535 calling env set. Variables can be restricted to only decimal, 3535 calling env set. Variables can be restricted to only decimal,
3536 hexadecimal, or boolean. If CONFIG_CMD_NET is also defined, 3536 hexadecimal, or boolean. If CONFIG_CMD_NET is also defined,
3537 the variables can also be restricted to IP address or MAC address. 3537 the variables can also be restricted to IP address or MAC address.
3538 3538
3539 The format of the list is: 3539 The format of the list is:
3540 type_attribute = [s|d|x|b|i|m] 3540 type_attribute = [s|d|x|b|i|m]
3541 access_attribute = [a|r|o|c] 3541 access_attribute = [a|r|o|c]
3542 attributes = type_attribute[access_attribute] 3542 attributes = type_attribute[access_attribute]
3543 entry = variable_name[:attributes] 3543 entry = variable_name[:attributes]
3544 list = entry[,list] 3544 list = entry[,list]
3545 3545
3546 The type attributes are: 3546 The type attributes are:
3547 s - String (default) 3547 s - String (default)
3548 d - Decimal 3548 d - Decimal
3549 x - Hexadecimal 3549 x - Hexadecimal
3550 b - Boolean ([1yYtT|0nNfF]) 3550 b - Boolean ([1yYtT|0nNfF])
3551 i - IP address 3551 i - IP address
3552 m - MAC address 3552 m - MAC address
3553 3553
3554 The access attributes are: 3554 The access attributes are:
3555 a - Any (default) 3555 a - Any (default)
3556 r - Read-only 3556 r - Read-only
3557 o - Write-once 3557 o - Write-once
3558 c - Change-default 3558 c - Change-default
3559 3559
3560 - CONFIG_ENV_FLAGS_LIST_DEFAULT 3560 - CONFIG_ENV_FLAGS_LIST_DEFAULT
3561 Define this to a list (string) to define the ".flags" 3561 Define this to a list (string) to define the ".flags"
3562 environment variable in the default or embedded environment. 3562 environment variable in the default or embedded environment.
3563 3563
3564 - CONFIG_ENV_FLAGS_LIST_STATIC 3564 - CONFIG_ENV_FLAGS_LIST_STATIC
3565 Define this to a list (string) to define validation that 3565 Define this to a list (string) to define validation that
3566 should be done if an entry is not found in the ".flags" 3566 should be done if an entry is not found in the ".flags"
3567 environment variable. To override a setting in the static 3567 environment variable. To override a setting in the static
3568 list, simply add an entry for the same variable name to the 3568 list, simply add an entry for the same variable name to the
3569 ".flags" variable. 3569 ".flags" variable.
3570 3570
3571 If CONFIG_REGEX is defined, the variable_name above is evaluated as a 3571 If CONFIG_REGEX is defined, the variable_name above is evaluated as a
3572 regular expression. This allows multiple variables to define the same 3572 regular expression. This allows multiple variables to define the same
3573 flags without explicitly listing them for each variable. 3573 flags without explicitly listing them for each variable.
3574 3574
3575 - CONFIG_ENV_ACCESS_IGNORE_FORCE 3575 - CONFIG_ENV_ACCESS_IGNORE_FORCE
3576 If defined, don't allow the -f switch to env set override variable 3576 If defined, don't allow the -f switch to env set override variable
3577 access flags. 3577 access flags.
3578 3578
3579 - CONFIG_USE_STDINT 3579 - CONFIG_USE_STDINT
3580 If stdint.h is available with your toolchain you can define this 3580 If stdint.h is available with your toolchain you can define this
3581 option to enable it. You can provide option 'USE_STDINT=1' when 3581 option to enable it. You can provide option 'USE_STDINT=1' when
3582 building U-Boot to enable this. 3582 building U-Boot to enable this.
3583 3583
3584 The following definitions that deal with the placement and management 3584 The following definitions that deal with the placement and management
3585 of environment data (variable area); in general, we support the 3585 of environment data (variable area); in general, we support the
3586 following configurations: 3586 following configurations:
3587 3587
3588 - CONFIG_BUILD_ENVCRC: 3588 - CONFIG_BUILD_ENVCRC:
3589 3589
3590 Builds up envcrc with the target environment so that external utils 3590 Builds up envcrc with the target environment so that external utils
3591 may easily extract it and embed it in final U-Boot images. 3591 may easily extract it and embed it in final U-Boot images.
3592 3592
3593 - CONFIG_ENV_IS_IN_FLASH: 3593 - CONFIG_ENV_IS_IN_FLASH:
3594 3594
3595 Define this if the environment is in flash memory. 3595 Define this if the environment is in flash memory.
3596 3596
3597 a) The environment occupies one whole flash sector, which is 3597 a) The environment occupies one whole flash sector, which is
3598 "embedded" in the text segment with the U-Boot code. This 3598 "embedded" in the text segment with the U-Boot code. This
3599 happens usually with "bottom boot sector" or "top boot 3599 happens usually with "bottom boot sector" or "top boot
3600 sector" type flash chips, which have several smaller 3600 sector" type flash chips, which have several smaller
3601 sectors at the start or the end. For instance, such a 3601 sectors at the start or the end. For instance, such a
3602 layout can have sector sizes of 8, 2x4, 16, Nx32 kB. In 3602 layout can have sector sizes of 8, 2x4, 16, Nx32 kB. In
3603 such a case you would place the environment in one of the 3603 such a case you would place the environment in one of the
3604 4 kB sectors - with U-Boot code before and after it. With 3604 4 kB sectors - with U-Boot code before and after it. With
3605 "top boot sector" type flash chips, you would put the 3605 "top boot sector" type flash chips, you would put the
3606 environment in one of the last sectors, leaving a gap 3606 environment in one of the last sectors, leaving a gap
3607 between U-Boot and the environment. 3607 between U-Boot and the environment.
3608 3608
3609 - CONFIG_ENV_OFFSET: 3609 - CONFIG_ENV_OFFSET:
3610 3610
3611 Offset of environment data (variable area) to the 3611 Offset of environment data (variable area) to the
3612 beginning of flash memory; for instance, with bottom boot 3612 beginning of flash memory; for instance, with bottom boot
3613 type flash chips the second sector can be used: the offset 3613 type flash chips the second sector can be used: the offset
3614 for this sector is given here. 3614 for this sector is given here.
3615 3615
3616 CONFIG_ENV_OFFSET is used relative to CONFIG_SYS_FLASH_BASE. 3616 CONFIG_ENV_OFFSET is used relative to CONFIG_SYS_FLASH_BASE.
3617 3617
3618 - CONFIG_ENV_ADDR: 3618 - CONFIG_ENV_ADDR:
3619 3619
3620 This is just another way to specify the start address of 3620 This is just another way to specify the start address of
3621 the flash sector containing the environment (instead of 3621 the flash sector containing the environment (instead of
3622 CONFIG_ENV_OFFSET). 3622 CONFIG_ENV_OFFSET).
3623 3623
3624 - CONFIG_ENV_SECT_SIZE: 3624 - CONFIG_ENV_SECT_SIZE:
3625 3625
3626 Size of the sector containing the environment. 3626 Size of the sector containing the environment.
3627 3627
3628 3628
3629 b) Sometimes flash chips have few, equal sized, BIG sectors. 3629 b) Sometimes flash chips have few, equal sized, BIG sectors.
3630 In such a case you don't want to spend a whole sector for 3630 In such a case you don't want to spend a whole sector for
3631 the environment. 3631 the environment.
3632 3632
3633 - CONFIG_ENV_SIZE: 3633 - CONFIG_ENV_SIZE:
3634 3634
3635 If you use this in combination with CONFIG_ENV_IS_IN_FLASH 3635 If you use this in combination with CONFIG_ENV_IS_IN_FLASH
3636 and CONFIG_ENV_SECT_SIZE, you can specify to use only a part 3636 and CONFIG_ENV_SECT_SIZE, you can specify to use only a part
3637 of this flash sector for the environment. This saves 3637 of this flash sector for the environment. This saves
3638 memory for the RAM copy of the environment. 3638 memory for the RAM copy of the environment.
3639 3639
3640 It may also save flash memory if you decide to use this 3640 It may also save flash memory if you decide to use this
3641 when your environment is "embedded" within U-Boot code, 3641 when your environment is "embedded" within U-Boot code,
3642 since then the remainder of the flash sector could be used 3642 since then the remainder of the flash sector could be used
3643 for U-Boot code. It should be pointed out that this is 3643 for U-Boot code. It should be pointed out that this is
3644 STRONGLY DISCOURAGED from a robustness point of view: 3644 STRONGLY DISCOURAGED from a robustness point of view:
3645 updating the environment in flash makes it always 3645 updating the environment in flash makes it always
3646 necessary to erase the WHOLE sector. If something goes 3646 necessary to erase the WHOLE sector. If something goes
3647 wrong before the contents has been restored from a copy in 3647 wrong before the contents has been restored from a copy in
3648 RAM, your target system will be dead. 3648 RAM, your target system will be dead.
3649 3649
3650 - CONFIG_ENV_ADDR_REDUND 3650 - CONFIG_ENV_ADDR_REDUND
3651 CONFIG_ENV_SIZE_REDUND 3651 CONFIG_ENV_SIZE_REDUND
3652 3652
3653 These settings describe a second storage area used to hold 3653 These settings describe a second storage area used to hold
3654 a redundant copy of the environment data, so that there is 3654 a redundant copy of the environment data, so that there is
3655 a valid backup copy in case there is a power failure during 3655 a valid backup copy in case there is a power failure during
3656 a "saveenv" operation. 3656 a "saveenv" operation.
3657 3657
3658 BE CAREFUL! Any changes to the flash layout, and some changes to the 3658 BE CAREFUL! Any changes to the flash layout, and some changes to the
3659 source code will make it necessary to adapt <board>/u-boot.lds* 3659 source code will make it necessary to adapt <board>/u-boot.lds*
3660 accordingly! 3660 accordingly!
3661 3661
3662 3662
3663 - CONFIG_ENV_IS_IN_NVRAM: 3663 - CONFIG_ENV_IS_IN_NVRAM:
3664 3664
3665 Define this if you have some non-volatile memory device 3665 Define this if you have some non-volatile memory device
3666 (NVRAM, battery buffered SRAM) which you want to use for the 3666 (NVRAM, battery buffered SRAM) which you want to use for the
3667 environment. 3667 environment.
3668 3668
3669 - CONFIG_ENV_ADDR: 3669 - CONFIG_ENV_ADDR:
3670 - CONFIG_ENV_SIZE: 3670 - CONFIG_ENV_SIZE:
3671 3671
3672 These two #defines are used to determine the memory area you 3672 These two #defines are used to determine the memory area you
3673 want to use for environment. It is assumed that this memory 3673 want to use for environment. It is assumed that this memory
3674 can just be read and written to, without any special 3674 can just be read and written to, without any special
3675 provision. 3675 provision.
3676 3676
3677 BE CAREFUL! The first access to the environment happens quite early 3677 BE CAREFUL! The first access to the environment happens quite early
3678 in U-Boot initialization (when we try to get the setting of for the 3678 in U-Boot initialization (when we try to get the setting of for the
3679 console baudrate). You *MUST* have mapped your NVRAM area then, or 3679 console baudrate). You *MUST* have mapped your NVRAM area then, or
3680 U-Boot will hang. 3680 U-Boot will hang.
3681 3681
3682 Please note that even with NVRAM we still use a copy of the 3682 Please note that even with NVRAM we still use a copy of the
3683 environment in RAM: we could work on NVRAM directly, but we want to 3683 environment in RAM: we could work on NVRAM directly, but we want to
3684 keep settings there always unmodified except somebody uses "saveenv" 3684 keep settings there always unmodified except somebody uses "saveenv"
3685 to save the current settings. 3685 to save the current settings.
3686 3686
3687 3687
3688 - CONFIG_ENV_IS_IN_EEPROM: 3688 - CONFIG_ENV_IS_IN_EEPROM:
3689 3689
3690 Use this if you have an EEPROM or similar serial access 3690 Use this if you have an EEPROM or similar serial access
3691 device and a driver for it. 3691 device and a driver for it.
3692 3692
3693 - CONFIG_ENV_OFFSET: 3693 - CONFIG_ENV_OFFSET:
3694 - CONFIG_ENV_SIZE: 3694 - CONFIG_ENV_SIZE:
3695 3695
3696 These two #defines specify the offset and size of the 3696 These two #defines specify the offset and size of the
3697 environment area within the total memory of your EEPROM. 3697 environment area within the total memory of your EEPROM.
3698 3698
3699 - CONFIG_SYS_I2C_EEPROM_ADDR: 3699 - CONFIG_SYS_I2C_EEPROM_ADDR:
3700 If defined, specified the chip address of the EEPROM device. 3700 If defined, specified the chip address of the EEPROM device.
3701 The default address is zero. 3701 The default address is zero.
3702 3702
3703 - CONFIG_SYS_I2C_EEPROM_BUS: 3703 - CONFIG_SYS_I2C_EEPROM_BUS:
3704 If defined, specified the i2c bus of the EEPROM device. 3704 If defined, specified the i2c bus of the EEPROM device.
3705 3705
3706 - CONFIG_SYS_EEPROM_PAGE_WRITE_BITS: 3706 - CONFIG_SYS_EEPROM_PAGE_WRITE_BITS:
3707 If defined, the number of bits used to address bytes in a 3707 If defined, the number of bits used to address bytes in a
3708 single page in the EEPROM device. A 64 byte page, for example 3708 single page in the EEPROM device. A 64 byte page, for example
3709 would require six bits. 3709 would require six bits.
3710 3710
3711 - CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS: 3711 - CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS:
3712 If defined, the number of milliseconds to delay between 3712 If defined, the number of milliseconds to delay between
3713 page writes. The default is zero milliseconds. 3713 page writes. The default is zero milliseconds.
3714 3714
3715 - CONFIG_SYS_I2C_EEPROM_ADDR_LEN: 3715 - CONFIG_SYS_I2C_EEPROM_ADDR_LEN:
3716 The length in bytes of the EEPROM memory array address. Note 3716 The length in bytes of the EEPROM memory array address. Note
3717 that this is NOT the chip address length! 3717 that this is NOT the chip address length!
3718 3718
3719 - CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW: 3719 - CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW:
3720 EEPROM chips that implement "address overflow" are ones 3720 EEPROM chips that implement "address overflow" are ones
3721 like Catalyst 24WC04/08/16 which has 9/10/11 bits of 3721 like Catalyst 24WC04/08/16 which has 9/10/11 bits of
3722 address and the extra bits end up in the "chip address" bit 3722 address and the extra bits end up in the "chip address" bit
3723 slots. This makes a 24WC08 (1Kbyte) chip look like four 256 3723 slots. This makes a 24WC08 (1Kbyte) chip look like four 256
3724 byte chips. 3724 byte chips.
3725 3725
3726 Note that we consider the length of the address field to 3726 Note that we consider the length of the address field to
3727 still be one byte because the extra address bits are hidden 3727 still be one byte because the extra address bits are hidden
3728 in the chip address. 3728 in the chip address.
3729 3729
3730 - CONFIG_SYS_EEPROM_SIZE: 3730 - CONFIG_SYS_EEPROM_SIZE:
3731 The size in bytes of the EEPROM device. 3731 The size in bytes of the EEPROM device.
3732 3732
3733 - CONFIG_ENV_EEPROM_IS_ON_I2C 3733 - CONFIG_ENV_EEPROM_IS_ON_I2C
3734 define this, if you have I2C and SPI activated, and your 3734 define this, if you have I2C and SPI activated, and your
3735 EEPROM, which holds the environment, is on the I2C bus. 3735 EEPROM, which holds the environment, is on the I2C bus.
3736 3736
3737 - CONFIG_I2C_ENV_EEPROM_BUS 3737 - CONFIG_I2C_ENV_EEPROM_BUS
3738 if you have an Environment on an EEPROM reached over 3738 if you have an Environment on an EEPROM reached over
3739 I2C muxes, you can define here, how to reach this 3739 I2C muxes, you can define here, how to reach this
3740 EEPROM. For example: 3740 EEPROM. For example:
3741 3741
3742 #define CONFIG_I2C_ENV_EEPROM_BUS 1 3742 #define CONFIG_I2C_ENV_EEPROM_BUS 1
3743 3743
3744 EEPROM which holds the environment, is reached over 3744 EEPROM which holds the environment, is reached over
3745 a pca9547 i2c mux with address 0x70, channel 3. 3745 a pca9547 i2c mux with address 0x70, channel 3.
3746 3746
3747 - CONFIG_ENV_IS_IN_DATAFLASH: 3747 - CONFIG_ENV_IS_IN_DATAFLASH:
3748 3748
3749 Define this if you have a DataFlash memory device which you 3749 Define this if you have a DataFlash memory device which you
3750 want to use for the environment. 3750 want to use for the environment.
3751 3751
3752 - CONFIG_ENV_OFFSET: 3752 - CONFIG_ENV_OFFSET:
3753 - CONFIG_ENV_ADDR: 3753 - CONFIG_ENV_ADDR:
3754 - CONFIG_ENV_SIZE: 3754 - CONFIG_ENV_SIZE:
3755 3755
3756 These three #defines specify the offset and size of the 3756 These three #defines specify the offset and size of the
3757 environment area within the total memory of your DataFlash placed 3757 environment area within the total memory of your DataFlash placed
3758 at the specified address. 3758 at the specified address.
3759 3759
3760 - CONFIG_ENV_IS_IN_SPI_FLASH: 3760 - CONFIG_ENV_IS_IN_SPI_FLASH:
3761 3761
3762 Define this if you have a SPI Flash memory device which you 3762 Define this if you have a SPI Flash memory device which you
3763 want to use for the environment. 3763 want to use for the environment.
3764 3764
3765 - CONFIG_ENV_OFFSET: 3765 - CONFIG_ENV_OFFSET:
3766 - CONFIG_ENV_SIZE: 3766 - CONFIG_ENV_SIZE:
3767 3767
3768 These two #defines specify the offset and size of the 3768 These two #defines specify the offset and size of the
3769 environment area within the SPI Flash. CONFIG_ENV_OFFSET must be 3769 environment area within the SPI Flash. CONFIG_ENV_OFFSET must be
3770 aligned to an erase sector boundary. 3770 aligned to an erase sector boundary.
3771 3771
3772 - CONFIG_ENV_SECT_SIZE: 3772 - CONFIG_ENV_SECT_SIZE:
3773 3773
3774 Define the SPI flash's sector size. 3774 Define the SPI flash's sector size.
3775 3775
3776 - CONFIG_ENV_OFFSET_REDUND (optional): 3776 - CONFIG_ENV_OFFSET_REDUND (optional):
3777 3777
3778 This setting describes a second storage area of CONFIG_ENV_SIZE 3778 This setting describes a second storage area of CONFIG_ENV_SIZE
3779 size used to hold a redundant copy of the environment data, so 3779 size used to hold a redundant copy of the environment data, so
3780 that there is a valid backup copy in case there is a power failure 3780 that there is a valid backup copy in case there is a power failure
3781 during a "saveenv" operation. CONFIG_ENV_OFFSET_REDUND must be 3781 during a "saveenv" operation. CONFIG_ENV_OFFSET_REDUND must be
3782 aligned to an erase sector boundary. 3782 aligned to an erase sector boundary.
3783 3783
3784 - CONFIG_ENV_SPI_BUS (optional): 3784 - CONFIG_ENV_SPI_BUS (optional):
3785 - CONFIG_ENV_SPI_CS (optional): 3785 - CONFIG_ENV_SPI_CS (optional):
3786 3786
3787 Define the SPI bus and chip select. If not defined they will be 0. 3787 Define the SPI bus and chip select. If not defined they will be 0.
3788 3788
3789 - CONFIG_ENV_SPI_MAX_HZ (optional): 3789 - CONFIG_ENV_SPI_MAX_HZ (optional):
3790 3790
3791 Define the SPI max work clock. If not defined then use 1MHz. 3791 Define the SPI max work clock. If not defined then use 1MHz.
3792 3792
3793 - CONFIG_ENV_SPI_MODE (optional): 3793 - CONFIG_ENV_SPI_MODE (optional):
3794 3794
3795 Define the SPI work mode. If not defined then use SPI_MODE_3. 3795 Define the SPI work mode. If not defined then use SPI_MODE_3.
3796 3796
3797 - CONFIG_ENV_IS_IN_REMOTE: 3797 - CONFIG_ENV_IS_IN_REMOTE:
3798 3798
3799 Define this if you have a remote memory space which you 3799 Define this if you have a remote memory space which you
3800 want to use for the local device's environment. 3800 want to use for the local device's environment.
3801 3801
3802 - CONFIG_ENV_ADDR: 3802 - CONFIG_ENV_ADDR:
3803 - CONFIG_ENV_SIZE: 3803 - CONFIG_ENV_SIZE:
3804 3804
3805 These two #defines specify the address and size of the 3805 These two #defines specify the address and size of the
3806 environment area within the remote memory space. The 3806 environment area within the remote memory space. The
3807 local device can get the environment from remote memory 3807 local device can get the environment from remote memory
3808 space by SRIO or PCIE links. 3808 space by SRIO or PCIE links.
3809 3809
3810 BE CAREFUL! For some special cases, the local device can not use 3810 BE CAREFUL! For some special cases, the local device can not use
3811 "saveenv" command. For example, the local device will get the 3811 "saveenv" command. For example, the local device will get the
3812 environment stored in a remote NOR flash by SRIO or PCIE link, 3812 environment stored in a remote NOR flash by SRIO or PCIE link,
3813 but it can not erase, write this NOR flash by SRIO or PCIE interface. 3813 but it can not erase, write this NOR flash by SRIO or PCIE interface.
3814 3814
3815 - CONFIG_ENV_IS_IN_NAND: 3815 - CONFIG_ENV_IS_IN_NAND:
3816 3816
3817 Define this if you have a NAND device which you want to use 3817 Define this if you have a NAND device which you want to use
3818 for the environment. 3818 for the environment.
3819 3819
3820 - CONFIG_ENV_OFFSET: 3820 - CONFIG_ENV_OFFSET:
3821 - CONFIG_ENV_SIZE: 3821 - CONFIG_ENV_SIZE:
3822 3822
3823 These two #defines specify the offset and size of the environment 3823 These two #defines specify the offset and size of the environment
3824 area within the first NAND device. CONFIG_ENV_OFFSET must be 3824 area within the first NAND device. CONFIG_ENV_OFFSET must be
3825 aligned to an erase block boundary. 3825 aligned to an erase block boundary.
3826 3826
3827 - CONFIG_ENV_OFFSET_REDUND (optional): 3827 - CONFIG_ENV_OFFSET_REDUND (optional):
3828 3828
3829 This setting describes a second storage area of CONFIG_ENV_SIZE 3829 This setting describes a second storage area of CONFIG_ENV_SIZE
3830 size used to hold a redundant copy of the environment data, so 3830 size used to hold a redundant copy of the environment data, so
3831 that there is a valid backup copy in case there is a power failure 3831 that there is a valid backup copy in case there is a power failure
3832 during a "saveenv" operation. CONFIG_ENV_OFFSET_REDUND must be 3832 during a "saveenv" operation. CONFIG_ENV_OFFSET_REDUND must be
3833 aligned to an erase block boundary. 3833 aligned to an erase block boundary.
3834 3834
3835 - CONFIG_ENV_RANGE (optional): 3835 - CONFIG_ENV_RANGE (optional):
3836 3836
3837 Specifies the length of the region in which the environment 3837 Specifies the length of the region in which the environment
3838 can be written. This should be a multiple of the NAND device's 3838 can be written. This should be a multiple of the NAND device's
3839 block size. Specifying a range with more erase blocks than 3839 block size. Specifying a range with more erase blocks than
3840 are needed to hold CONFIG_ENV_SIZE allows bad blocks within 3840 are needed to hold CONFIG_ENV_SIZE allows bad blocks within
3841 the range to be avoided. 3841 the range to be avoided.
3842 3842
3843 - CONFIG_ENV_OFFSET_OOB (optional): 3843 - CONFIG_ENV_OFFSET_OOB (optional):
3844 3844
3845 Enables support for dynamically retrieving the offset of the 3845 Enables support for dynamically retrieving the offset of the
3846 environment from block zero's out-of-band data. The 3846 environment from block zero's out-of-band data. The
3847 "nand env.oob" command can be used to record this offset. 3847 "nand env.oob" command can be used to record this offset.
3848 Currently, CONFIG_ENV_OFFSET_REDUND is not supported when 3848 Currently, CONFIG_ENV_OFFSET_REDUND is not supported when
3849 using CONFIG_ENV_OFFSET_OOB. 3849 using CONFIG_ENV_OFFSET_OOB.
3850 3850
3851 - CONFIG_NAND_ENV_DST 3851 - CONFIG_NAND_ENV_DST
3852 3852
3853 Defines address in RAM to which the nand_spl code should copy the 3853 Defines address in RAM to which the nand_spl code should copy the
3854 environment. If redundant environment is used, it will be copied to 3854 environment. If redundant environment is used, it will be copied to
3855 CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE. 3855 CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE.
3856 3856
3857 - CONFIG_ENV_IS_IN_UBI: 3857 - CONFIG_ENV_IS_IN_UBI:
3858 3858
3859 Define this if you have an UBI volume that you want to use for the 3859 Define this if you have an UBI volume that you want to use for the
3860 environment. This has the benefit of wear-leveling the environment 3860 environment. This has the benefit of wear-leveling the environment
3861 accesses, which is important on NAND. 3861 accesses, which is important on NAND.
3862 3862
3863 - CONFIG_ENV_UBI_PART: 3863 - CONFIG_ENV_UBI_PART:
3864 3864
3865 Define this to a string that is the mtd partition containing the UBI. 3865 Define this to a string that is the mtd partition containing the UBI.
3866 3866
3867 - CONFIG_ENV_UBI_VOLUME: 3867 - CONFIG_ENV_UBI_VOLUME:
3868 3868
3869 Define this to the name of the volume that you want to store the 3869 Define this to the name of the volume that you want to store the
3870 environment in. 3870 environment in.
3871 3871
3872 - CONFIG_ENV_UBI_VOLUME_REDUND: 3872 - CONFIG_ENV_UBI_VOLUME_REDUND:
3873 3873
3874 Define this to the name of another volume to store a second copy of 3874 Define this to the name of another volume to store a second copy of
3875 the environment in. This will enable redundant environments in UBI. 3875 the environment in. This will enable redundant environments in UBI.
3876 It is assumed that both volumes are in the same MTD partition. 3876 It is assumed that both volumes are in the same MTD partition.
3877 3877
3878 - CONFIG_UBI_SILENCE_MSG 3878 - CONFIG_UBI_SILENCE_MSG
3879 - CONFIG_UBIFS_SILENCE_MSG 3879 - CONFIG_UBIFS_SILENCE_MSG
3880 3880
3881 You will probably want to define these to avoid a really noisy system 3881 You will probably want to define these to avoid a really noisy system
3882 when storing the env in UBI. 3882 when storing the env in UBI.
3883 3883
3884 - CONFIG_ENV_IS_IN_FAT: 3884 - CONFIG_ENV_IS_IN_FAT:
3885 Define this if you want to use the FAT file system for the environment. 3885 Define this if you want to use the FAT file system for the environment.
3886 3886
3887 - FAT_ENV_INTERFACE: 3887 - FAT_ENV_INTERFACE:
3888 3888
3889 Define this to a string that is the name of the block device. 3889 Define this to a string that is the name of the block device.
3890 3890
3891 - FAT_ENV_DEVICE_AND_PART: 3891 - FAT_ENV_DEVICE_AND_PART:
3892 3892
3893 Define this to a string to specify the partition of the device. It can 3893 Define this to a string to specify the partition of the device. It can
3894 be as following: 3894 be as following:
3895 3895
3896 "D:P", "D:0", "D", "D:" or "D:auto" (D, P are integers. And P >= 1) 3896 "D:P", "D:0", "D", "D:" or "D:auto" (D, P are integers. And P >= 1)
3897 - "D:P": device D partition P. Error occurs if device D has no 3897 - "D:P": device D partition P. Error occurs if device D has no
3898 partition table. 3898 partition table.
3899 - "D:0": device D. 3899 - "D:0": device D.
3900 - "D" or "D:": device D partition 1 if device D has partition 3900 - "D" or "D:": device D partition 1 if device D has partition
3901 table, or the whole device D if has no partition 3901 table, or the whole device D if has no partition
3902 table. 3902 table.
3903 - "D:auto": first partition in device D with bootable flag set. 3903 - "D:auto": first partition in device D with bootable flag set.
3904 If none, first valid partition in device D. If no 3904 If none, first valid partition in device D. If no
3905 partition table then means device D. 3905 partition table then means device D.
3906 3906
3907 - FAT_ENV_FILE: 3907 - FAT_ENV_FILE:
3908 3908
3909 It's a string of the FAT file name. This file use to store the 3909 It's a string of the FAT file name. This file use to store the
3910 environment. 3910 environment.
3911 3911
3912 - CONFIG_FAT_WRITE: 3912 - CONFIG_FAT_WRITE:
3913 This should be defined. Otherwise it cannot save the environment file. 3913 This should be defined. Otherwise it cannot save the environment file.
3914 3914
3915 - CONFIG_ENV_IS_IN_MMC: 3915 - CONFIG_ENV_IS_IN_MMC:
3916 3916
3917 Define this if you have an MMC device which you want to use for the 3917 Define this if you have an MMC device which you want to use for the
3918 environment. 3918 environment.
3919 3919
3920 - CONFIG_SYS_MMC_ENV_DEV: 3920 - CONFIG_SYS_MMC_ENV_DEV:
3921 3921
3922 Specifies which MMC device the environment is stored in. 3922 Specifies which MMC device the environment is stored in.
3923 3923
3924 - CONFIG_SYS_MMC_ENV_PART (optional): 3924 - CONFIG_SYS_MMC_ENV_PART (optional):
3925 3925
3926 Specifies which MMC partition the environment is stored in. If not 3926 Specifies which MMC partition the environment is stored in. If not
3927 set, defaults to partition 0, the user area. Common values might be 3927 set, defaults to partition 0, the user area. Common values might be
3928 1 (first MMC boot partition), 2 (second MMC boot partition). 3928 1 (first MMC boot partition), 2 (second MMC boot partition).
3929 3929
3930 - CONFIG_ENV_OFFSET: 3930 - CONFIG_ENV_OFFSET:
3931 - CONFIG_ENV_SIZE: 3931 - CONFIG_ENV_SIZE:
3932 3932
3933 These two #defines specify the offset and size of the environment 3933 These two #defines specify the offset and size of the environment
3934 area within the specified MMC device. 3934 area within the specified MMC device.
3935 3935
3936 If offset is positive (the usual case), it is treated as relative to 3936 If offset is positive (the usual case), it is treated as relative to
3937 the start of the MMC partition. If offset is negative, it is treated 3937 the start of the MMC partition. If offset is negative, it is treated
3938 as relative to the end of the MMC partition. This can be useful if 3938 as relative to the end of the MMC partition. This can be useful if
3939 your board may be fitted with different MMC devices, which have 3939 your board may be fitted with different MMC devices, which have
3940 different sizes for the MMC partitions, and you always want the 3940 different sizes for the MMC partitions, and you always want the
3941 environment placed at the very end of the partition, to leave the 3941 environment placed at the very end of the partition, to leave the
3942 maximum possible space before it, to store other data. 3942 maximum possible space before it, to store other data.
3943 3943
3944 These two values are in units of bytes, but must be aligned to an 3944 These two values are in units of bytes, but must be aligned to an
3945 MMC sector boundary. 3945 MMC sector boundary.
3946 3946
3947 - CONFIG_ENV_OFFSET_REDUND (optional): 3947 - CONFIG_ENV_OFFSET_REDUND (optional):
3948 3948
3949 Specifies a second storage area, of CONFIG_ENV_SIZE size, used to 3949 Specifies a second storage area, of CONFIG_ENV_SIZE size, used to
3950 hold a redundant copy of the environment data. This provides a 3950 hold a redundant copy of the environment data. This provides a
3951 valid backup copy in case the other copy is corrupted, e.g. due 3951 valid backup copy in case the other copy is corrupted, e.g. due
3952 to a power failure during a "saveenv" operation. 3952 to a power failure during a "saveenv" operation.
3953 3953
3954 This value may also be positive or negative; this is handled in the 3954 This value may also be positive or negative; this is handled in the
3955 same way as CONFIG_ENV_OFFSET. 3955 same way as CONFIG_ENV_OFFSET.
3956 3956
3957 This value is also in units of bytes, but must also be aligned to 3957 This value is also in units of bytes, but must also be aligned to
3958 an MMC sector boundary. 3958 an MMC sector boundary.
3959 3959
3960 - CONFIG_ENV_SIZE_REDUND (optional): 3960 - CONFIG_ENV_SIZE_REDUND (optional):
3961 3961
3962 This value need not be set, even when CONFIG_ENV_OFFSET_REDUND is 3962 This value need not be set, even when CONFIG_ENV_OFFSET_REDUND is
3963 set. If this value is set, it must be set to the same value as 3963 set. If this value is set, it must be set to the same value as
3964 CONFIG_ENV_SIZE. 3964 CONFIG_ENV_SIZE.
3965 3965
3966 - CONFIG_SYS_SPI_INIT_OFFSET 3966 - CONFIG_SYS_SPI_INIT_OFFSET
3967 3967
3968 Defines offset to the initial SPI buffer area in DPRAM. The 3968 Defines offset to the initial SPI buffer area in DPRAM. The
3969 area is used at an early stage (ROM part) if the environment 3969 area is used at an early stage (ROM part) if the environment
3970 is configured to reside in the SPI EEPROM: We need a 520 byte 3970 is configured to reside in the SPI EEPROM: We need a 520 byte
3971 scratch DPRAM area. It is used between the two initialization 3971 scratch DPRAM area. It is used between the two initialization
3972 calls (spi_init_f() and spi_init_r()). A value of 0xB00 seems 3972 calls (spi_init_f() and spi_init_r()). A value of 0xB00 seems
3973 to be a good choice since it makes it far enough from the 3973 to be a good choice since it makes it far enough from the
3974 start of the data area as well as from the stack pointer. 3974 start of the data area as well as from the stack pointer.
3975 3975
3976 Please note that the environment is read-only until the monitor 3976 Please note that the environment is read-only until the monitor
3977 has been relocated to RAM and a RAM copy of the environment has been 3977 has been relocated to RAM and a RAM copy of the environment has been
3978 created; also, when using EEPROM you will have to use getenv_f() 3978 created; also, when using EEPROM you will have to use getenv_f()
3979 until then to read environment variables. 3979 until then to read environment variables.
3980 3980
3981 The environment is protected by a CRC32 checksum. Before the monitor 3981 The environment is protected by a CRC32 checksum. Before the monitor
3982 is relocated into RAM, as a result of a bad CRC you will be working 3982 is relocated into RAM, as a result of a bad CRC you will be working
3983 with the compiled-in default environment - *silently*!!! [This is 3983 with the compiled-in default environment - *silently*!!! [This is
3984 necessary, because the first environment variable we need is the 3984 necessary, because the first environment variable we need is the
3985 "baudrate" setting for the console - if we have a bad CRC, we don't 3985 "baudrate" setting for the console - if we have a bad CRC, we don't
3986 have any device yet where we could complain.] 3986 have any device yet where we could complain.]
3987 3987
3988 Note: once the monitor has been relocated, then it will complain if 3988 Note: once the monitor has been relocated, then it will complain if
3989 the default environment is used; a new CRC is computed as soon as you 3989 the default environment is used; a new CRC is computed as soon as you
3990 use the "saveenv" command to store a valid environment. 3990 use the "saveenv" command to store a valid environment.
3991 3991
3992 - CONFIG_SYS_FAULT_ECHO_LINK_DOWN: 3992 - CONFIG_SYS_FAULT_ECHO_LINK_DOWN:
3993 Echo the inverted Ethernet link state to the fault LED. 3993 Echo the inverted Ethernet link state to the fault LED.
3994 3994
3995 Note: If this option is active, then CONFIG_SYS_FAULT_MII_ADDR 3995 Note: If this option is active, then CONFIG_SYS_FAULT_MII_ADDR
3996 also needs to be defined. 3996 also needs to be defined.
3997 3997
3998 - CONFIG_SYS_FAULT_MII_ADDR: 3998 - CONFIG_SYS_FAULT_MII_ADDR:
3999 MII address of the PHY to check for the Ethernet link state. 3999 MII address of the PHY to check for the Ethernet link state.
4000 4000
4001 - CONFIG_NS16550_MIN_FUNCTIONS: 4001 - CONFIG_NS16550_MIN_FUNCTIONS:
4002 Define this if you desire to only have use of the NS16550_init 4002 Define this if you desire to only have use of the NS16550_init
4003 and NS16550_putc functions for the serial driver located at 4003 and NS16550_putc functions for the serial driver located at
4004 drivers/serial/ns16550.c. This option is useful for saving 4004 drivers/serial/ns16550.c. This option is useful for saving
4005 space for already greatly restricted images, including but not 4005 space for already greatly restricted images, including but not
4006 limited to NAND_SPL configurations. 4006 limited to NAND_SPL configurations.
4007 4007
4008 - CONFIG_DISPLAY_BOARDINFO 4008 - CONFIG_DISPLAY_BOARDINFO
4009 Display information about the board that U-Boot is running on 4009 Display information about the board that U-Boot is running on
4010 when U-Boot starts up. The board function checkboard() is called 4010 when U-Boot starts up. The board function checkboard() is called
4011 to do this. 4011 to do this.
4012 4012
4013 - CONFIG_DISPLAY_BOARDINFO_LATE 4013 - CONFIG_DISPLAY_BOARDINFO_LATE
4014 Similar to the previous option, but display this information 4014 Similar to the previous option, but display this information
4015 later, once stdio is running and output goes to the LCD, if 4015 later, once stdio is running and output goes to the LCD, if
4016 present. 4016 present.
4017 4017
4018 - CONFIG_BOARD_SIZE_LIMIT: 4018 - CONFIG_BOARD_SIZE_LIMIT:
4019 Maximum size of the U-Boot image. When defined, the 4019 Maximum size of the U-Boot image. When defined, the
4020 build system checks that the actual size does not 4020 build system checks that the actual size does not
4021 exceed it. 4021 exceed it.
4022 4022
4023 Low Level (hardware related) configuration options: 4023 Low Level (hardware related) configuration options:
4024 --------------------------------------------------- 4024 ---------------------------------------------------
4025 4025
4026 - CONFIG_SYS_CACHELINE_SIZE: 4026 - CONFIG_SYS_CACHELINE_SIZE:
4027 Cache Line Size of the CPU. 4027 Cache Line Size of the CPU.
4028 4028
4029 - CONFIG_SYS_DEFAULT_IMMR: 4029 - CONFIG_SYS_DEFAULT_IMMR:
4030 Default address of the IMMR after system reset. 4030 Default address of the IMMR after system reset.
4031 4031
4032 Needed on some 8260 systems (MPC8260ADS, PQ2FADS-ZU, 4032 Needed on some 8260 systems (MPC8260ADS, PQ2FADS-ZU,
4033 and RPXsuper) to be able to adjust the position of 4033 and RPXsuper) to be able to adjust the position of
4034 the IMMR register after a reset. 4034 the IMMR register after a reset.
4035 4035
4036 - CONFIG_SYS_CCSRBAR_DEFAULT: 4036 - CONFIG_SYS_CCSRBAR_DEFAULT:
4037 Default (power-on reset) physical address of CCSR on Freescale 4037 Default (power-on reset) physical address of CCSR on Freescale
4038 PowerPC SOCs. 4038 PowerPC SOCs.
4039 4039
4040 - CONFIG_SYS_CCSRBAR: 4040 - CONFIG_SYS_CCSRBAR:
4041 Virtual address of CCSR. On a 32-bit build, this is typically 4041 Virtual address of CCSR. On a 32-bit build, this is typically
4042 the same value as CONFIG_SYS_CCSRBAR_DEFAULT. 4042 the same value as CONFIG_SYS_CCSRBAR_DEFAULT.
4043 4043
4044 CONFIG_SYS_DEFAULT_IMMR must also be set to this value, 4044 CONFIG_SYS_DEFAULT_IMMR must also be set to this value,
4045 for cross-platform code that uses that macro instead. 4045 for cross-platform code that uses that macro instead.
4046 4046
4047 - CONFIG_SYS_CCSRBAR_PHYS: 4047 - CONFIG_SYS_CCSRBAR_PHYS:
4048 Physical address of CCSR. CCSR can be relocated to a new 4048 Physical address of CCSR. CCSR can be relocated to a new
4049 physical address, if desired. In this case, this macro should 4049 physical address, if desired. In this case, this macro should
4050 be set to that address. Otherwise, it should be set to the 4050 be set to that address. Otherwise, it should be set to the
4051 same value as CONFIG_SYS_CCSRBAR_DEFAULT. For example, CCSR 4051 same value as CONFIG_SYS_CCSRBAR_DEFAULT. For example, CCSR
4052 is typically relocated on 36-bit builds. It is recommended 4052 is typically relocated on 36-bit builds. It is recommended
4053 that this macro be defined via the _HIGH and _LOW macros: 4053 that this macro be defined via the _HIGH and _LOW macros:
4054 4054
4055 #define CONFIG_SYS_CCSRBAR_PHYS ((CONFIG_SYS_CCSRBAR_PHYS_HIGH 4055 #define CONFIG_SYS_CCSRBAR_PHYS ((CONFIG_SYS_CCSRBAR_PHYS_HIGH
4056 * 1ull) << 32 | CONFIG_SYS_CCSRBAR_PHYS_LOW) 4056 * 1ull) << 32 | CONFIG_SYS_CCSRBAR_PHYS_LOW)
4057 4057
4058 - CONFIG_SYS_CCSRBAR_PHYS_HIGH: 4058 - CONFIG_SYS_CCSRBAR_PHYS_HIGH:
4059 Bits 33-36 of CONFIG_SYS_CCSRBAR_PHYS. This value is typically 4059 Bits 33-36 of CONFIG_SYS_CCSRBAR_PHYS. This value is typically
4060 either 0 (32-bit build) or 0xF (36-bit build). This macro is 4060 either 0 (32-bit build) or 0xF (36-bit build). This macro is
4061 used in assembly code, so it must not contain typecasts or 4061 used in assembly code, so it must not contain typecasts or
4062 integer size suffixes (e.g. "ULL"). 4062 integer size suffixes (e.g. "ULL").
4063 4063
4064 - CONFIG_SYS_CCSRBAR_PHYS_LOW: 4064 - CONFIG_SYS_CCSRBAR_PHYS_LOW:
4065 Lower 32-bits of CONFIG_SYS_CCSRBAR_PHYS. This macro is 4065 Lower 32-bits of CONFIG_SYS_CCSRBAR_PHYS. This macro is
4066 used in assembly code, so it must not contain typecasts or 4066 used in assembly code, so it must not contain typecasts or
4067 integer size suffixes (e.g. "ULL"). 4067 integer size suffixes (e.g. "ULL").
4068 4068
4069 - CONFIG_SYS_CCSR_DO_NOT_RELOCATE: 4069 - CONFIG_SYS_CCSR_DO_NOT_RELOCATE:
4070 If this macro is defined, then CONFIG_SYS_CCSRBAR_PHYS will be 4070 If this macro is defined, then CONFIG_SYS_CCSRBAR_PHYS will be
4071 forced to a value that ensures that CCSR is not relocated. 4071 forced to a value that ensures that CCSR is not relocated.
4072 4072
4073 - Floppy Disk Support: 4073 - Floppy Disk Support:
4074 CONFIG_SYS_FDC_DRIVE_NUMBER 4074 CONFIG_SYS_FDC_DRIVE_NUMBER
4075 4075
4076 the default drive number (default value 0) 4076 the default drive number (default value 0)
4077 4077
4078 CONFIG_SYS_ISA_IO_STRIDE 4078 CONFIG_SYS_ISA_IO_STRIDE
4079 4079
4080 defines the spacing between FDC chipset registers 4080 defines the spacing between FDC chipset registers
4081 (default value 1) 4081 (default value 1)
4082 4082
4083 CONFIG_SYS_ISA_IO_OFFSET 4083 CONFIG_SYS_ISA_IO_OFFSET
4084 4084
4085 defines the offset of register from address. It 4085 defines the offset of register from address. It
4086 depends on which part of the data bus is connected to 4086 depends on which part of the data bus is connected to
4087 the FDC chipset. (default value 0) 4087 the FDC chipset. (default value 0)
4088 4088
4089 If CONFIG_SYS_ISA_IO_STRIDE CONFIG_SYS_ISA_IO_OFFSET and 4089 If CONFIG_SYS_ISA_IO_STRIDE CONFIG_SYS_ISA_IO_OFFSET and
4090 CONFIG_SYS_FDC_DRIVE_NUMBER are undefined, they take their 4090 CONFIG_SYS_FDC_DRIVE_NUMBER are undefined, they take their
4091 default value. 4091 default value.
4092 4092
4093 if CONFIG_SYS_FDC_HW_INIT is defined, then the function 4093 if CONFIG_SYS_FDC_HW_INIT is defined, then the function
4094 fdc_hw_init() is called at the beginning of the FDC 4094 fdc_hw_init() is called at the beginning of the FDC
4095 setup. fdc_hw_init() must be provided by the board 4095 setup. fdc_hw_init() must be provided by the board
4096 source code. It is used to make hardware-dependent 4096 source code. It is used to make hardware-dependent
4097 initializations. 4097 initializations.
4098 4098
4099 - CONFIG_IDE_AHB: 4099 - CONFIG_IDE_AHB:
4100 Most IDE controllers were designed to be connected with PCI 4100 Most IDE controllers were designed to be connected with PCI
4101 interface. Only few of them were designed for AHB interface. 4101 interface. Only few of them were designed for AHB interface.
4102 When software is doing ATA command and data transfer to 4102 When software is doing ATA command and data transfer to
4103 IDE devices through IDE-AHB controller, some additional 4103 IDE devices through IDE-AHB controller, some additional
4104 registers accessing to these kind of IDE-AHB controller 4104 registers accessing to these kind of IDE-AHB controller
4105 is required. 4105 is required.
4106 4106
4107 - CONFIG_SYS_IMMR: Physical address of the Internal Memory. 4107 - CONFIG_SYS_IMMR: Physical address of the Internal Memory.
4108 DO NOT CHANGE unless you know exactly what you're 4108 DO NOT CHANGE unless you know exactly what you're
4109 doing! (11-4) [MPC8xx/82xx systems only] 4109 doing! (11-4) [MPC8xx/82xx systems only]
4110 4110
4111 - CONFIG_SYS_INIT_RAM_ADDR: 4111 - CONFIG_SYS_INIT_RAM_ADDR:
4112 4112
4113 Start address of memory area that can be used for 4113 Start address of memory area that can be used for
4114 initial data and stack; please note that this must be 4114 initial data and stack; please note that this must be
4115 writable memory that is working WITHOUT special 4115 writable memory that is working WITHOUT special
4116 initialization, i. e. you CANNOT use normal RAM which 4116 initialization, i. e. you CANNOT use normal RAM which
4117 will become available only after programming the 4117 will become available only after programming the
4118 memory controller and running certain initialization 4118 memory controller and running certain initialization
4119 sequences. 4119 sequences.
4120 4120
4121 U-Boot uses the following memory types: 4121 U-Boot uses the following memory types:
4122 - MPC8xx and MPC8260: IMMR (internal memory of the CPU) 4122 - MPC8xx and MPC8260: IMMR (internal memory of the CPU)
4123 - MPC824X: data cache 4123 - MPC824X: data cache
4124 - PPC4xx: data cache 4124 - PPC4xx: data cache
4125 4125
4126 - CONFIG_SYS_GBL_DATA_OFFSET: 4126 - CONFIG_SYS_GBL_DATA_OFFSET:
4127 4127
4128 Offset of the initial data structure in the memory 4128 Offset of the initial data structure in the memory
4129 area defined by CONFIG_SYS_INIT_RAM_ADDR. Usually 4129 area defined by CONFIG_SYS_INIT_RAM_ADDR. Usually
4130 CONFIG_SYS_GBL_DATA_OFFSET is chosen such that the initial 4130 CONFIG_SYS_GBL_DATA_OFFSET is chosen such that the initial
4131 data is located at the end of the available space 4131 data is located at the end of the available space
4132 (sometimes written as (CONFIG_SYS_INIT_RAM_SIZE - 4132 (sometimes written as (CONFIG_SYS_INIT_RAM_SIZE -
4133 GENERATED_GBL_DATA_SIZE), and the initial stack is just 4133 GENERATED_GBL_DATA_SIZE), and the initial stack is just
4134 below that area (growing from (CONFIG_SYS_INIT_RAM_ADDR + 4134 below that area (growing from (CONFIG_SYS_INIT_RAM_ADDR +
4135 CONFIG_SYS_GBL_DATA_OFFSET) downward. 4135 CONFIG_SYS_GBL_DATA_OFFSET) downward.
4136 4136
4137 Note: 4137 Note:
4138 On the MPC824X (or other systems that use the data 4138 On the MPC824X (or other systems that use the data
4139 cache for initial memory) the address chosen for 4139 cache for initial memory) the address chosen for
4140 CONFIG_SYS_INIT_RAM_ADDR is basically arbitrary - it must 4140 CONFIG_SYS_INIT_RAM_ADDR is basically arbitrary - it must
4141 point to an otherwise UNUSED address space between 4141 point to an otherwise UNUSED address space between
4142 the top of RAM and the start of the PCI space. 4142 the top of RAM and the start of the PCI space.
4143 4143
4144 - CONFIG_SYS_SIUMCR: SIU Module Configuration (11-6) 4144 - CONFIG_SYS_SIUMCR: SIU Module Configuration (11-6)
4145 4145
4146 - CONFIG_SYS_SYPCR: System Protection Control (11-9) 4146 - CONFIG_SYS_SYPCR: System Protection Control (11-9)
4147 4147
4148 - CONFIG_SYS_TBSCR: Time Base Status and Control (11-26) 4148 - CONFIG_SYS_TBSCR: Time Base Status and Control (11-26)
4149 4149
4150 - CONFIG_SYS_PISCR: Periodic Interrupt Status and Control (11-31) 4150 - CONFIG_SYS_PISCR: Periodic Interrupt Status and Control (11-31)
4151 4151
4152 - CONFIG_SYS_PLPRCR: PLL, Low-Power, and Reset Control Register (15-30) 4152 - CONFIG_SYS_PLPRCR: PLL, Low-Power, and Reset Control Register (15-30)
4153 4153
4154 - CONFIG_SYS_SCCR: System Clock and reset Control Register (15-27) 4154 - CONFIG_SYS_SCCR: System Clock and reset Control Register (15-27)
4155 4155
4156 - CONFIG_SYS_OR_TIMING_SDRAM: 4156 - CONFIG_SYS_OR_TIMING_SDRAM:
4157 SDRAM timing 4157 SDRAM timing
4158 4158
4159 - CONFIG_SYS_MAMR_PTA: 4159 - CONFIG_SYS_MAMR_PTA:
4160 periodic timer for refresh 4160 periodic timer for refresh
4161 4161
4162 - CONFIG_SYS_DER: Debug Event Register (37-47) 4162 - CONFIG_SYS_DER: Debug Event Register (37-47)
4163 4163
4164 - FLASH_BASE0_PRELIM, FLASH_BASE1_PRELIM, CONFIG_SYS_REMAP_OR_AM, 4164 - FLASH_BASE0_PRELIM, FLASH_BASE1_PRELIM, CONFIG_SYS_REMAP_OR_AM,
4165 CONFIG_SYS_PRELIM_OR_AM, CONFIG_SYS_OR_TIMING_FLASH, CONFIG_SYS_OR0_REMAP, 4165 CONFIG_SYS_PRELIM_OR_AM, CONFIG_SYS_OR_TIMING_FLASH, CONFIG_SYS_OR0_REMAP,
4166 CONFIG_SYS_OR0_PRELIM, CONFIG_SYS_BR0_PRELIM, CONFIG_SYS_OR1_REMAP, CONFIG_SYS_OR1_PRELIM, 4166 CONFIG_SYS_OR0_PRELIM, CONFIG_SYS_BR0_PRELIM, CONFIG_SYS_OR1_REMAP, CONFIG_SYS_OR1_PRELIM,
4167 CONFIG_SYS_BR1_PRELIM: 4167 CONFIG_SYS_BR1_PRELIM:
4168 Memory Controller Definitions: BR0/1 and OR0/1 (FLASH) 4168 Memory Controller Definitions: BR0/1 and OR0/1 (FLASH)
4169 4169
4170 - SDRAM_BASE2_PRELIM, SDRAM_BASE3_PRELIM, SDRAM_MAX_SIZE, 4170 - SDRAM_BASE2_PRELIM, SDRAM_BASE3_PRELIM, SDRAM_MAX_SIZE,
4171 CONFIG_SYS_OR_TIMING_SDRAM, CONFIG_SYS_OR2_PRELIM, CONFIG_SYS_BR2_PRELIM, 4171 CONFIG_SYS_OR_TIMING_SDRAM, CONFIG_SYS_OR2_PRELIM, CONFIG_SYS_BR2_PRELIM,
4172 CONFIG_SYS_OR3_PRELIM, CONFIG_SYS_BR3_PRELIM: 4172 CONFIG_SYS_OR3_PRELIM, CONFIG_SYS_BR3_PRELIM:
4173 Memory Controller Definitions: BR2/3 and OR2/3 (SDRAM) 4173 Memory Controller Definitions: BR2/3 and OR2/3 (SDRAM)
4174 4174
4175 - CONFIG_SYS_MAMR_PTA, CONFIG_SYS_MPTPR_2BK_4K, CONFIG_SYS_MPTPR_1BK_4K, CONFIG_SYS_MPTPR_2BK_8K, 4175 - CONFIG_SYS_MAMR_PTA, CONFIG_SYS_MPTPR_2BK_4K, CONFIG_SYS_MPTPR_1BK_4K, CONFIG_SYS_MPTPR_2BK_8K,
4176 CONFIG_SYS_MPTPR_1BK_8K, CONFIG_SYS_MAMR_8COL, CONFIG_SYS_MAMR_9COL: 4176 CONFIG_SYS_MPTPR_1BK_8K, CONFIG_SYS_MAMR_8COL, CONFIG_SYS_MAMR_9COL:
4177 Machine Mode Register and Memory Periodic Timer 4177 Machine Mode Register and Memory Periodic Timer
4178 Prescaler definitions (SDRAM timing) 4178 Prescaler definitions (SDRAM timing)
4179 4179
4180 - CONFIG_SYS_I2C_UCODE_PATCH, CONFIG_SYS_I2C_DPMEM_OFFSET [0x1FC0]: 4180 - CONFIG_SYS_I2C_UCODE_PATCH, CONFIG_SYS_I2C_DPMEM_OFFSET [0x1FC0]:
4181 enable I2C microcode relocation patch (MPC8xx); 4181 enable I2C microcode relocation patch (MPC8xx);
4182 define relocation offset in DPRAM [DSP2] 4182 define relocation offset in DPRAM [DSP2]
4183 4183
4184 - CONFIG_SYS_SMC_UCODE_PATCH, CONFIG_SYS_SMC_DPMEM_OFFSET [0x1FC0]: 4184 - CONFIG_SYS_SMC_UCODE_PATCH, CONFIG_SYS_SMC_DPMEM_OFFSET [0x1FC0]:
4185 enable SMC microcode relocation patch (MPC8xx); 4185 enable SMC microcode relocation patch (MPC8xx);
4186 define relocation offset in DPRAM [SMC1] 4186 define relocation offset in DPRAM [SMC1]
4187 4187
4188 - CONFIG_SYS_SPI_UCODE_PATCH, CONFIG_SYS_SPI_DPMEM_OFFSET [0x1FC0]: 4188 - CONFIG_SYS_SPI_UCODE_PATCH, CONFIG_SYS_SPI_DPMEM_OFFSET [0x1FC0]:
4189 enable SPI microcode relocation patch (MPC8xx); 4189 enable SPI microcode relocation patch (MPC8xx);
4190 define relocation offset in DPRAM [SCC4] 4190 define relocation offset in DPRAM [SCC4]
4191 4191
4192 - CONFIG_SYS_CPM_POST_WORD_ADDR: (MPC8xx, MPC8260 only) 4192 - CONFIG_SYS_CPM_POST_WORD_ADDR: (MPC8xx, MPC8260 only)
4193 Offset of the bootmode word in DPRAM used by post 4193 Offset of the bootmode word in DPRAM used by post
4194 (Power On Self Tests). This definition overrides 4194 (Power On Self Tests). This definition overrides
4195 #define'd default value in commproc.h resp. 4195 #define'd default value in commproc.h resp.
4196 cpm_8260.h. 4196 cpm_8260.h.
4197 4197
4198 - CONFIG_SYS_PCI_SLV_MEM_LOCAL, CONFIG_SYS_PCI_SLV_MEM_BUS, CONFIG_SYS_PICMR0_MASK_ATTRIB, 4198 - CONFIG_SYS_PCI_SLV_MEM_LOCAL, CONFIG_SYS_PCI_SLV_MEM_BUS, CONFIG_SYS_PICMR0_MASK_ATTRIB,
4199 CONFIG_SYS_PCI_MSTR0_LOCAL, CONFIG_SYS_PCIMSK0_MASK, CONFIG_SYS_PCI_MSTR1_LOCAL, 4199 CONFIG_SYS_PCI_MSTR0_LOCAL, CONFIG_SYS_PCIMSK0_MASK, CONFIG_SYS_PCI_MSTR1_LOCAL,
4200 CONFIG_SYS_PCIMSK1_MASK, CONFIG_SYS_PCI_MSTR_MEM_LOCAL, CONFIG_SYS_PCI_MSTR_MEM_BUS, 4200 CONFIG_SYS_PCIMSK1_MASK, CONFIG_SYS_PCI_MSTR_MEM_LOCAL, CONFIG_SYS_PCI_MSTR_MEM_BUS,
4201 CONFIG_SYS_CPU_PCI_MEM_START, CONFIG_SYS_PCI_MSTR_MEM_SIZE, CONFIG_SYS_POCMR0_MASK_ATTRIB, 4201 CONFIG_SYS_CPU_PCI_MEM_START, CONFIG_SYS_PCI_MSTR_MEM_SIZE, CONFIG_SYS_POCMR0_MASK_ATTRIB,
4202 CONFIG_SYS_PCI_MSTR_MEMIO_LOCAL, CONFIG_SYS_PCI_MSTR_MEMIO_BUS, CPU_PCI_MEMIO_START, 4202 CONFIG_SYS_PCI_MSTR_MEMIO_LOCAL, CONFIG_SYS_PCI_MSTR_MEMIO_BUS, CPU_PCI_MEMIO_START,
4203 CONFIG_SYS_PCI_MSTR_MEMIO_SIZE, CONFIG_SYS_POCMR1_MASK_ATTRIB, CONFIG_SYS_PCI_MSTR_IO_LOCAL, 4203 CONFIG_SYS_PCI_MSTR_MEMIO_SIZE, CONFIG_SYS_POCMR1_MASK_ATTRIB, CONFIG_SYS_PCI_MSTR_IO_LOCAL,
4204 CONFIG_SYS_PCI_MSTR_IO_BUS, CONFIG_SYS_CPU_PCI_IO_START, CONFIG_SYS_PCI_MSTR_IO_SIZE, 4204 CONFIG_SYS_PCI_MSTR_IO_BUS, CONFIG_SYS_CPU_PCI_IO_START, CONFIG_SYS_PCI_MSTR_IO_SIZE,
4205 CONFIG_SYS_POCMR2_MASK_ATTRIB: (MPC826x only) 4205 CONFIG_SYS_POCMR2_MASK_ATTRIB: (MPC826x only)
4206 Overrides the default PCI memory map in arch/powerpc/cpu/mpc8260/pci.c if set. 4206 Overrides the default PCI memory map in arch/powerpc/cpu/mpc8260/pci.c if set.
4207 4207
4208 - CONFIG_PCI_DISABLE_PCIE: 4208 - CONFIG_PCI_DISABLE_PCIE:
4209 Disable PCI-Express on systems where it is supported but not 4209 Disable PCI-Express on systems where it is supported but not
4210 required. 4210 required.
4211 4211
4212 - CONFIG_PCI_ENUM_ONLY 4212 - CONFIG_PCI_ENUM_ONLY
4213 Only scan through and get the devices on the buses. 4213 Only scan through and get the devices on the buses.
4214 Don't do any setup work, presumably because someone or 4214 Don't do any setup work, presumably because someone or
4215 something has already done it, and we don't need to do it 4215 something has already done it, and we don't need to do it
4216 a second time. Useful for platforms that are pre-booted 4216 a second time. Useful for platforms that are pre-booted
4217 by coreboot or similar. 4217 by coreboot or similar.
4218 4218
4219 - CONFIG_PCI_INDIRECT_BRIDGE: 4219 - CONFIG_PCI_INDIRECT_BRIDGE:
4220 Enable support for indirect PCI bridges. 4220 Enable support for indirect PCI bridges.
4221 4221
4222 - CONFIG_SYS_SRIO: 4222 - CONFIG_SYS_SRIO:
4223 Chip has SRIO or not 4223 Chip has SRIO or not
4224 4224
4225 - CONFIG_SRIO1: 4225 - CONFIG_SRIO1:
4226 Board has SRIO 1 port available 4226 Board has SRIO 1 port available
4227 4227
4228 - CONFIG_SRIO2: 4228 - CONFIG_SRIO2:
4229 Board has SRIO 2 port available 4229 Board has SRIO 2 port available
4230 4230
4231 - CONFIG_SRIO_PCIE_BOOT_MASTER 4231 - CONFIG_SRIO_PCIE_BOOT_MASTER
4232 Board can support master function for Boot from SRIO and PCIE 4232 Board can support master function for Boot from SRIO and PCIE
4233 4233
4234 - CONFIG_SYS_SRIOn_MEM_VIRT: 4234 - CONFIG_SYS_SRIOn_MEM_VIRT:
4235 Virtual Address of SRIO port 'n' memory region 4235 Virtual Address of SRIO port 'n' memory region
4236 4236
4237 - CONFIG_SYS_SRIOn_MEM_PHYS: 4237 - CONFIG_SYS_SRIOn_MEM_PHYS:
4238 Physical Address of SRIO port 'n' memory region 4238 Physical Address of SRIO port 'n' memory region
4239 4239
4240 - CONFIG_SYS_SRIOn_MEM_SIZE: 4240 - CONFIG_SYS_SRIOn_MEM_SIZE:
4241 Size of SRIO port 'n' memory region 4241 Size of SRIO port 'n' memory region
4242 4242
4243 - CONFIG_SYS_NAND_BUSWIDTH_16BIT 4243 - CONFIG_SYS_NAND_BUSWIDTH_16BIT
4244 Defined to tell the NAND controller that the NAND chip is using 4244 Defined to tell the NAND controller that the NAND chip is using
4245 a 16 bit bus. 4245 a 16 bit bus.
4246 Not all NAND drivers use this symbol. 4246 Not all NAND drivers use this symbol.
4247 Example of drivers that use it: 4247 Example of drivers that use it:
4248 - drivers/mtd/nand/ndfc.c 4248 - drivers/mtd/nand/ndfc.c
4249 - drivers/mtd/nand/mxc_nand.c 4249 - drivers/mtd/nand/mxc_nand.c
4250 4250
4251 - CONFIG_SYS_NDFC_EBC0_CFG 4251 - CONFIG_SYS_NDFC_EBC0_CFG
4252 Sets the EBC0_CFG register for the NDFC. If not defined 4252 Sets the EBC0_CFG register for the NDFC. If not defined
4253 a default value will be used. 4253 a default value will be used.
4254 4254
4255 - CONFIG_SPD_EEPROM 4255 - CONFIG_SPD_EEPROM
4256 Get DDR timing information from an I2C EEPROM. Common 4256 Get DDR timing information from an I2C EEPROM. Common
4257 with pluggable memory modules such as SODIMMs 4257 with pluggable memory modules such as SODIMMs
4258 4258
4259 SPD_EEPROM_ADDRESS 4259 SPD_EEPROM_ADDRESS
4260 I2C address of the SPD EEPROM 4260 I2C address of the SPD EEPROM
4261 4261
4262 - CONFIG_SYS_SPD_BUS_NUM 4262 - CONFIG_SYS_SPD_BUS_NUM
4263 If SPD EEPROM is on an I2C bus other than the first 4263 If SPD EEPROM is on an I2C bus other than the first
4264 one, specify here. Note that the value must resolve 4264 one, specify here. Note that the value must resolve
4265 to something your driver can deal with. 4265 to something your driver can deal with.
4266 4266
4267 - CONFIG_SYS_DDR_RAW_TIMING 4267 - CONFIG_SYS_DDR_RAW_TIMING
4268 Get DDR timing information from other than SPD. Common with 4268 Get DDR timing information from other than SPD. Common with
4269 soldered DDR chips onboard without SPD. DDR raw timing 4269 soldered DDR chips onboard without SPD. DDR raw timing
4270 parameters are extracted from datasheet and hard-coded into 4270 parameters are extracted from datasheet and hard-coded into
4271 header files or board specific files. 4271 header files or board specific files.
4272 4272
4273 - CONFIG_FSL_DDR_INTERACTIVE 4273 - CONFIG_FSL_DDR_INTERACTIVE
4274 Enable interactive DDR debugging. See doc/README.fsl-ddr. 4274 Enable interactive DDR debugging. See doc/README.fsl-ddr.
4275 4275
4276 - CONFIG_FSL_DDR_SYNC_REFRESH 4276 - CONFIG_FSL_DDR_SYNC_REFRESH
4277 Enable sync of refresh for multiple controllers. 4277 Enable sync of refresh for multiple controllers.
4278 4278
4279 - CONFIG_FSL_DDR_BIST 4279 - CONFIG_FSL_DDR_BIST
4280 Enable built-in memory test for Freescale DDR controllers. 4280 Enable built-in memory test for Freescale DDR controllers.
4281 4281
4282 - CONFIG_SYS_83XX_DDR_USES_CS0 4282 - CONFIG_SYS_83XX_DDR_USES_CS0
4283 Only for 83xx systems. If specified, then DDR should 4283 Only for 83xx systems. If specified, then DDR should
4284 be configured using CS0 and CS1 instead of CS2 and CS3. 4284 be configured using CS0 and CS1 instead of CS2 and CS3.
4285 4285
4286 - CONFIG_ETHER_ON_FEC[12] 4286 - CONFIG_ETHER_ON_FEC[12]
4287 Define to enable FEC[12] on a 8xx series processor. 4287 Define to enable FEC[12] on a 8xx series processor.
4288 4288
4289 - CONFIG_FEC[12]_PHY 4289 - CONFIG_FEC[12]_PHY
4290 Define to the hardcoded PHY address which corresponds 4290 Define to the hardcoded PHY address which corresponds
4291 to the given FEC; i. e. 4291 to the given FEC; i. e.
4292 #define CONFIG_FEC1_PHY 4 4292 #define CONFIG_FEC1_PHY 4
4293 means that the PHY with address 4 is connected to FEC1 4293 means that the PHY with address 4 is connected to FEC1
4294 4294
4295 When set to -1, means to probe for first available. 4295 When set to -1, means to probe for first available.
4296 4296
4297 - CONFIG_FEC[12]_PHY_NORXERR 4297 - CONFIG_FEC[12]_PHY_NORXERR
4298 The PHY does not have a RXERR line (RMII only). 4298 The PHY does not have a RXERR line (RMII only).
4299 (so program the FEC to ignore it). 4299 (so program the FEC to ignore it).
4300 4300
4301 - CONFIG_RMII 4301 - CONFIG_RMII
4302 Enable RMII mode for all FECs. 4302 Enable RMII mode for all FECs.
4303 Note that this is a global option, we can't 4303 Note that this is a global option, we can't
4304 have one FEC in standard MII mode and another in RMII mode. 4304 have one FEC in standard MII mode and another in RMII mode.
4305 4305
4306 - CONFIG_CRC32_VERIFY 4306 - CONFIG_CRC32_VERIFY
4307 Add a verify option to the crc32 command. 4307 Add a verify option to the crc32 command.
4308 The syntax is: 4308 The syntax is:
4309 4309
4310 => crc32 -v <address> <count> <crc32> 4310 => crc32 -v <address> <count> <crc32>
4311 4311
4312 Where address/count indicate a memory area 4312 Where address/count indicate a memory area
4313 and crc32 is the correct crc32 which the 4313 and crc32 is the correct crc32 which the
4314 area should have. 4314 area should have.
4315 4315
4316 - CONFIG_LOOPW 4316 - CONFIG_LOOPW
4317 Add the "loopw" memory command. This only takes effect if 4317 Add the "loopw" memory command. This only takes effect if
4318 the memory commands are activated globally (CONFIG_CMD_MEM). 4318 the memory commands are activated globally (CONFIG_CMD_MEM).
4319 4319
4320 - CONFIG_MX_CYCLIC 4320 - CONFIG_MX_CYCLIC
4321 Add the "mdc" and "mwc" memory commands. These are cyclic 4321 Add the "mdc" and "mwc" memory commands. These are cyclic
4322 "md/mw" commands. 4322 "md/mw" commands.
4323 Examples: 4323 Examples:
4324 4324
4325 => mdc.b 10 4 500 4325 => mdc.b 10 4 500
4326 This command will print 4 bytes (10,11,12,13) each 500 ms. 4326 This command will print 4 bytes (10,11,12,13) each 500 ms.
4327 4327
4328 => mwc.l 100 12345678 10 4328 => mwc.l 100 12345678 10
4329 This command will write 12345678 to address 100 all 10 ms. 4329 This command will write 12345678 to address 100 all 10 ms.
4330 4330
4331 This only takes effect if the memory commands are activated 4331 This only takes effect if the memory commands are activated
4332 globally (CONFIG_CMD_MEM). 4332 globally (CONFIG_CMD_MEM).
4333 4333
4334 - CONFIG_SKIP_LOWLEVEL_INIT 4334 - CONFIG_SKIP_LOWLEVEL_INIT
4335 [ARM, NDS32, MIPS only] If this variable is defined, then certain 4335 [ARM, NDS32, MIPS only] If this variable is defined, then certain
4336 low level initializations (like setting up the memory 4336 low level initializations (like setting up the memory
4337 controller) are omitted and/or U-Boot does not 4337 controller) are omitted and/or U-Boot does not
4338 relocate itself into RAM. 4338 relocate itself into RAM.
4339 4339
4340 Normally this variable MUST NOT be defined. The only 4340 Normally this variable MUST NOT be defined. The only
4341 exception is when U-Boot is loaded (to RAM) by some 4341 exception is when U-Boot is loaded (to RAM) by some
4342 other boot loader or by a debugger which performs 4342 other boot loader or by a debugger which performs
4343 these initializations itself. 4343 these initializations itself.
4344 4344
4345 - CONFIG_SKIP_LOWLEVEL_INIT_ONLY 4345 - CONFIG_SKIP_LOWLEVEL_INIT_ONLY
4346 [ARM926EJ-S only] This allows just the call to lowlevel_init() 4346 [ARM926EJ-S only] This allows just the call to lowlevel_init()
4347 to be skipped. The normal CP15 init (such as enabling the 4347 to be skipped. The normal CP15 init (such as enabling the
4348 instruction cache) is still performed. 4348 instruction cache) is still performed.
4349 4349
4350 - CONFIG_SPL_BUILD 4350 - CONFIG_SPL_BUILD
4351 Modifies the behaviour of start.S when compiling a loader 4351 Modifies the behaviour of start.S when compiling a loader
4352 that is executed before the actual U-Boot. E.g. when 4352 that is executed before the actual U-Boot. E.g. when
4353 compiling a NAND SPL. 4353 compiling a NAND SPL.
4354 4354
4355 - CONFIG_TPL_BUILD 4355 - CONFIG_TPL_BUILD
4356 Modifies the behaviour of start.S when compiling a loader 4356 Modifies the behaviour of start.S when compiling a loader
4357 that is executed after the SPL and before the actual U-Boot. 4357 that is executed after the SPL and before the actual U-Boot.
4358 It is loaded by the SPL. 4358 It is loaded by the SPL.
4359 4359
4360 - CONFIG_SYS_MPC85XX_NO_RESETVEC 4360 - CONFIG_SYS_MPC85XX_NO_RESETVEC
4361 Only for 85xx systems. If this variable is specified, the section 4361 Only for 85xx systems. If this variable is specified, the section
4362 .resetvec is not kept and the section .bootpg is placed in the 4362 .resetvec is not kept and the section .bootpg is placed in the
4363 previous 4k of the .text section. 4363 previous 4k of the .text section.
4364 4364
4365 - CONFIG_ARCH_MAP_SYSMEM 4365 - CONFIG_ARCH_MAP_SYSMEM
4366 Generally U-Boot (and in particular the md command) uses 4366 Generally U-Boot (and in particular the md command) uses
4367 effective address. It is therefore not necessary to regard 4367 effective address. It is therefore not necessary to regard
4368 U-Boot address as virtual addresses that need to be translated 4368 U-Boot address as virtual addresses that need to be translated
4369 to physical addresses. However, sandbox requires this, since 4369 to physical addresses. However, sandbox requires this, since
4370 it maintains its own little RAM buffer which contains all 4370 it maintains its own little RAM buffer which contains all
4371 addressable memory. This option causes some memory accesses 4371 addressable memory. This option causes some memory accesses
4372 to be mapped through map_sysmem() / unmap_sysmem(). 4372 to be mapped through map_sysmem() / unmap_sysmem().
4373 4373
4374 - CONFIG_X86_RESET_VECTOR 4374 - CONFIG_X86_RESET_VECTOR
4375 If defined, the x86 reset vector code is included. This is not 4375 If defined, the x86 reset vector code is included. This is not
4376 needed when U-Boot is running from Coreboot. 4376 needed when U-Boot is running from Coreboot.
4377 4377
4378 - CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC: 4378 - CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC:
4379 Enables the RTC32K OSC on AM33xx based plattforms 4379 Enables the RTC32K OSC on AM33xx based plattforms
4380 4380
4381 - CONFIG_SYS_NAND_NO_SUBPAGE_WRITE 4381 - CONFIG_SYS_NAND_NO_SUBPAGE_WRITE
4382 Option to disable subpage write in NAND driver 4382 Option to disable subpage write in NAND driver
4383 driver that uses this: 4383 driver that uses this:
4384 drivers/mtd/nand/davinci_nand.c 4384 drivers/mtd/nand/davinci_nand.c
4385 4385
4386 Freescale QE/FMAN Firmware Support: 4386 Freescale QE/FMAN Firmware Support:
4387 ----------------------------------- 4387 -----------------------------------
4388 4388
4389 The Freescale QUICCEngine (QE) and Frame Manager (FMAN) both support the 4389 The Freescale QUICCEngine (QE) and Frame Manager (FMAN) both support the
4390 loading of "firmware", which is encoded in the QE firmware binary format. 4390 loading of "firmware", which is encoded in the QE firmware binary format.
4391 This firmware often needs to be loaded during U-Boot booting, so macros 4391 This firmware often needs to be loaded during U-Boot booting, so macros
4392 are used to identify the storage device (NOR flash, SPI, etc) and the address 4392 are used to identify the storage device (NOR flash, SPI, etc) and the address
4393 within that device. 4393 within that device.
4394 4394
4395 - CONFIG_SYS_FMAN_FW_ADDR 4395 - CONFIG_SYS_FMAN_FW_ADDR
4396 The address in the storage device where the FMAN microcode is located. The 4396 The address in the storage device where the FMAN microcode is located. The
4397 meaning of this address depends on which CONFIG_SYS_QE_FW_IN_xxx macro 4397 meaning of this address depends on which CONFIG_SYS_QE_FW_IN_xxx macro
4398 is also specified. 4398 is also specified.
4399 4399
4400 - CONFIG_SYS_QE_FW_ADDR 4400 - CONFIG_SYS_QE_FW_ADDR
4401 The address in the storage device where the QE microcode is located. The 4401 The address in the storage device where the QE microcode is located. The
4402 meaning of this address depends on which CONFIG_SYS_QE_FW_IN_xxx macro 4402 meaning of this address depends on which CONFIG_SYS_QE_FW_IN_xxx macro
4403 is also specified. 4403 is also specified.
4404 4404
4405 - CONFIG_SYS_QE_FMAN_FW_LENGTH 4405 - CONFIG_SYS_QE_FMAN_FW_LENGTH
4406 The maximum possible size of the firmware. The firmware binary format 4406 The maximum possible size of the firmware. The firmware binary format
4407 has a field that specifies the actual size of the firmware, but it 4407 has a field that specifies the actual size of the firmware, but it
4408 might not be possible to read any part of the firmware unless some 4408 might not be possible to read any part of the firmware unless some
4409 local storage is allocated to hold the entire firmware first. 4409 local storage is allocated to hold the entire firmware first.
4410 4410
4411 - CONFIG_SYS_QE_FMAN_FW_IN_NOR 4411 - CONFIG_SYS_QE_FMAN_FW_IN_NOR
4412 Specifies that QE/FMAN firmware is located in NOR flash, mapped as 4412 Specifies that QE/FMAN firmware is located in NOR flash, mapped as
4413 normal addressable memory via the LBC. CONFIG_SYS_FMAN_FW_ADDR is the 4413 normal addressable memory via the LBC. CONFIG_SYS_FMAN_FW_ADDR is the
4414 virtual address in NOR flash. 4414 virtual address in NOR flash.
4415 4415
4416 - CONFIG_SYS_QE_FMAN_FW_IN_NAND 4416 - CONFIG_SYS_QE_FMAN_FW_IN_NAND
4417 Specifies that QE/FMAN firmware is located in NAND flash. 4417 Specifies that QE/FMAN firmware is located in NAND flash.
4418 CONFIG_SYS_FMAN_FW_ADDR is the offset within NAND flash. 4418 CONFIG_SYS_FMAN_FW_ADDR is the offset within NAND flash.
4419 4419
4420 - CONFIG_SYS_QE_FMAN_FW_IN_MMC 4420 - CONFIG_SYS_QE_FMAN_FW_IN_MMC
4421 Specifies that QE/FMAN firmware is located on the primary SD/MMC 4421 Specifies that QE/FMAN firmware is located on the primary SD/MMC
4422 device. CONFIG_SYS_FMAN_FW_ADDR is the byte offset on that device. 4422 device. CONFIG_SYS_FMAN_FW_ADDR is the byte offset on that device.
4423 4423
4424 - CONFIG_SYS_QE_FMAN_FW_IN_REMOTE 4424 - CONFIG_SYS_QE_FMAN_FW_IN_REMOTE
4425 Specifies that QE/FMAN firmware is located in the remote (master) 4425 Specifies that QE/FMAN firmware is located in the remote (master)
4426 memory space. CONFIG_SYS_FMAN_FW_ADDR is a virtual address which 4426 memory space. CONFIG_SYS_FMAN_FW_ADDR is a virtual address which
4427 can be mapped from slave TLB->slave LAW->slave SRIO or PCIE outbound 4427 can be mapped from slave TLB->slave LAW->slave SRIO or PCIE outbound
4428 window->master inbound window->master LAW->the ucode address in 4428 window->master inbound window->master LAW->the ucode address in
4429 master's memory space. 4429 master's memory space.
4430 4430
4431 Freescale Layerscape Management Complex Firmware Support: 4431 Freescale Layerscape Management Complex Firmware Support:
4432 --------------------------------------------------------- 4432 ---------------------------------------------------------
4433 The Freescale Layerscape Management Complex (MC) supports the loading of 4433 The Freescale Layerscape Management Complex (MC) supports the loading of
4434 "firmware". 4434 "firmware".
4435 This firmware often needs to be loaded during U-Boot booting, so macros 4435 This firmware often needs to be loaded during U-Boot booting, so macros
4436 are used to identify the storage device (NOR flash, SPI, etc) and the address 4436 are used to identify the storage device (NOR flash, SPI, etc) and the address
4437 within that device. 4437 within that device.
4438 4438
4439 - CONFIG_FSL_MC_ENET 4439 - CONFIG_FSL_MC_ENET
4440 Enable the MC driver for Layerscape SoCs. 4440 Enable the MC driver for Layerscape SoCs.
4441 4441
4442 Freescale Layerscape Debug Server Support: 4442 Freescale Layerscape Debug Server Support:
4443 ------------------------------------------- 4443 -------------------------------------------
4444 The Freescale Layerscape Debug Server Support supports the loading of 4444 The Freescale Layerscape Debug Server Support supports the loading of
4445 "Debug Server firmware" and triggering SP boot-rom. 4445 "Debug Server firmware" and triggering SP boot-rom.
4446 This firmware often needs to be loaded during U-Boot booting. 4446 This firmware often needs to be loaded during U-Boot booting.
4447 4447
4448 - CONFIG_SYS_MC_RSV_MEM_ALIGN 4448 - CONFIG_SYS_MC_RSV_MEM_ALIGN
4449 Define alignment of reserved memory MC requires 4449 Define alignment of reserved memory MC requires
4450 4450
4451 Reproducible builds 4451 Reproducible builds
4452 ------------------- 4452 -------------------
4453 4453
4454 In order to achieve reproducible builds, timestamps used in the U-Boot build 4454 In order to achieve reproducible builds, timestamps used in the U-Boot build
4455 process have to be set to a fixed value. 4455 process have to be set to a fixed value.
4456 4456
4457 This is done using the SOURCE_DATE_EPOCH environment variable. 4457 This is done using the SOURCE_DATE_EPOCH environment variable.
4458 SOURCE_DATE_EPOCH is to be set on the build host's shell, not as a configuration 4458 SOURCE_DATE_EPOCH is to be set on the build host's shell, not as a configuration
4459 option for U-Boot or an environment variable in U-Boot. 4459 option for U-Boot or an environment variable in U-Boot.
4460 4460
4461 SOURCE_DATE_EPOCH should be set to a number of seconds since the epoch, in UTC. 4461 SOURCE_DATE_EPOCH should be set to a number of seconds since the epoch, in UTC.
4462 4462
4463 Building the Software: 4463 Building the Software:
4464 ====================== 4464 ======================
4465 4465
4466 Building U-Boot has been tested in several native build environments 4466 Building U-Boot has been tested in several native build environments
4467 and in many different cross environments. Of course we cannot support 4467 and in many different cross environments. Of course we cannot support
4468 all possibly existing versions of cross development tools in all 4468 all possibly existing versions of cross development tools in all
4469 (potentially obsolete) versions. In case of tool chain problems we 4469 (potentially obsolete) versions. In case of tool chain problems we
4470 recommend to use the ELDK (see http://www.denx.de/wiki/DULG/ELDK) 4470 recommend to use the ELDK (see http://www.denx.de/wiki/DULG/ELDK)
4471 which is extensively used to build and test U-Boot. 4471 which is extensively used to build and test U-Boot.
4472 4472
4473 If you are not using a native environment, it is assumed that you 4473 If you are not using a native environment, it is assumed that you
4474 have GNU cross compiling tools available in your path. In this case, 4474 have GNU cross compiling tools available in your path. In this case,
4475 you must set the environment variable CROSS_COMPILE in your shell. 4475 you must set the environment variable CROSS_COMPILE in your shell.
4476 Note that no changes to the Makefile or any other source files are 4476 Note that no changes to the Makefile or any other source files are
4477 necessary. For example using the ELDK on a 4xx CPU, please enter: 4477 necessary. For example using the ELDK on a 4xx CPU, please enter:
4478 4478
4479 $ CROSS_COMPILE=ppc_4xx- 4479 $ CROSS_COMPILE=ppc_4xx-
4480 $ export CROSS_COMPILE 4480 $ export CROSS_COMPILE
4481 4481
4482 Note: If you wish to generate Windows versions of the utilities in 4482 Note: If you wish to generate Windows versions of the utilities in
4483 the tools directory you can use the MinGW toolchain 4483 the tools directory you can use the MinGW toolchain
4484 (http://www.mingw.org). Set your HOST tools to the MinGW 4484 (http://www.mingw.org). Set your HOST tools to the MinGW
4485 toolchain and execute 'make tools'. For example: 4485 toolchain and execute 'make tools'. For example:
4486 4486
4487 $ make HOSTCC=i586-mingw32msvc-gcc HOSTSTRIP=i586-mingw32msvc-strip tools 4487 $ make HOSTCC=i586-mingw32msvc-gcc HOSTSTRIP=i586-mingw32msvc-strip tools
4488 4488
4489 Binaries such as tools/mkimage.exe will be created which can 4489 Binaries such as tools/mkimage.exe will be created which can
4490 be executed on computers running Windows. 4490 be executed on computers running Windows.
4491 4491
4492 U-Boot is intended to be simple to build. After installing the 4492 U-Boot is intended to be simple to build. After installing the
4493 sources you must configure U-Boot for one specific board type. This 4493 sources you must configure U-Boot for one specific board type. This
4494 is done by typing: 4494 is done by typing:
4495 4495
4496 make NAME_defconfig 4496 make NAME_defconfig
4497 4497
4498 where "NAME_defconfig" is the name of one of the existing configu- 4498 where "NAME_defconfig" is the name of one of the existing configu-
4499 rations; see boards.cfg for supported names. 4499 rations; see boards.cfg for supported names.
4500 4500
4501 Note: for some board special configuration names may exist; check if 4501 Note: for some board special configuration names may exist; check if
4502 additional information is available from the board vendor; for 4502 additional information is available from the board vendor; for
4503 instance, the TQM823L systems are available without (standard) 4503 instance, the TQM823L systems are available without (standard)
4504 or with LCD support. You can select such additional "features" 4504 or with LCD support. You can select such additional "features"
4505 when choosing the configuration, i. e. 4505 when choosing the configuration, i. e.
4506 4506
4507 make TQM823L_defconfig 4507 make TQM823L_defconfig
4508 - will configure for a plain TQM823L, i. e. no LCD support 4508 - will configure for a plain TQM823L, i. e. no LCD support
4509 4509
4510 make TQM823L_LCD_defconfig 4510 make TQM823L_LCD_defconfig
4511 - will configure for a TQM823L with U-Boot console on LCD 4511 - will configure for a TQM823L with U-Boot console on LCD
4512 4512
4513 etc. 4513 etc.
4514 4514
4515 4515
4516 Finally, type "make all", and you should get some working U-Boot 4516 Finally, type "make all", and you should get some working U-Boot
4517 images ready for download to / installation on your system: 4517 images ready for download to / installation on your system:
4518 4518
4519 - "u-boot.bin" is a raw binary image 4519 - "u-boot.bin" is a raw binary image
4520 - "u-boot" is an image in ELF binary format 4520 - "u-boot" is an image in ELF binary format
4521 - "u-boot.srec" is in Motorola S-Record format 4521 - "u-boot.srec" is in Motorola S-Record format
4522 4522
4523 By default the build is performed locally and the objects are saved 4523 By default the build is performed locally and the objects are saved
4524 in the source directory. One of the two methods can be used to change 4524 in the source directory. One of the two methods can be used to change
4525 this behavior and build U-Boot to some external directory: 4525 this behavior and build U-Boot to some external directory:
4526 4526
4527 1. Add O= to the make command line invocations: 4527 1. Add O= to the make command line invocations:
4528 4528
4529 make O=/tmp/build distclean 4529 make O=/tmp/build distclean
4530 make O=/tmp/build NAME_defconfig 4530 make O=/tmp/build NAME_defconfig
4531 make O=/tmp/build all 4531 make O=/tmp/build all
4532 4532
4533 2. Set environment variable KBUILD_OUTPUT to point to the desired location: 4533 2. Set environment variable KBUILD_OUTPUT to point to the desired location:
4534 4534
4535 export KBUILD_OUTPUT=/tmp/build 4535 export KBUILD_OUTPUT=/tmp/build
4536 make distclean 4536 make distclean
4537 make NAME_defconfig 4537 make NAME_defconfig
4538 make all 4538 make all
4539 4539
4540 Note that the command line "O=" setting overrides the KBUILD_OUTPUT environment 4540 Note that the command line "O=" setting overrides the KBUILD_OUTPUT environment
4541 variable. 4541 variable.
4542 4542
4543 4543
4544 Please be aware that the Makefiles assume you are using GNU make, so 4544 Please be aware that the Makefiles assume you are using GNU make, so
4545 for instance on NetBSD you might need to use "gmake" instead of 4545 for instance on NetBSD you might need to use "gmake" instead of
4546 native "make". 4546 native "make".
4547 4547
4548 4548
4549 If the system board that you have is not listed, then you will need 4549 If the system board that you have is not listed, then you will need
4550 to port U-Boot to your hardware platform. To do this, follow these 4550 to port U-Boot to your hardware platform. To do this, follow these
4551 steps: 4551 steps:
4552 4552
4553 1. Create a new directory to hold your board specific code. Add any 4553 1. Create a new directory to hold your board specific code. Add any
4554 files you need. In your board directory, you will need at least 4554 files you need. In your board directory, you will need at least
4555 the "Makefile" and a "<board>.c". 4555 the "Makefile" and a "<board>.c".
4556 2. Create a new configuration file "include/configs/<board>.h" for 4556 2. Create a new configuration file "include/configs/<board>.h" for
4557 your board. 4557 your board.
4558 3. If you're porting U-Boot to a new CPU, then also create a new 4558 3. If you're porting U-Boot to a new CPU, then also create a new
4559 directory to hold your CPU specific code. Add any files you need. 4559 directory to hold your CPU specific code. Add any files you need.
4560 4. Run "make <board>_defconfig" with your new name. 4560 4. Run "make <board>_defconfig" with your new name.
4561 5. Type "make", and you should get a working "u-boot.srec" file 4561 5. Type "make", and you should get a working "u-boot.srec" file
4562 to be installed on your target system. 4562 to be installed on your target system.
4563 6. Debug and solve any problems that might arise. 4563 6. Debug and solve any problems that might arise.
4564 [Of course, this last step is much harder than it sounds.] 4564 [Of course, this last step is much harder than it sounds.]
4565 4565
4566 4566
4567 Testing of U-Boot Modifications, Ports to New Hardware, etc.: 4567 Testing of U-Boot Modifications, Ports to New Hardware, etc.:
4568 ============================================================== 4568 ==============================================================
4569 4569
4570 If you have modified U-Boot sources (for instance added a new board 4570 If you have modified U-Boot sources (for instance added a new board
4571 or support for new devices, a new CPU, etc.) you are expected to 4571 or support for new devices, a new CPU, etc.) you are expected to
4572 provide feedback to the other developers. The feedback normally takes 4572 provide feedback to the other developers. The feedback normally takes
4573 the form of a "patch", i. e. a context diff against a certain (latest 4573 the form of a "patch", i. e. a context diff against a certain (latest
4574 official or latest in the git repository) version of U-Boot sources. 4574 official or latest in the git repository) version of U-Boot sources.
4575 4575
4576 But before you submit such a patch, please verify that your modifi- 4576 But before you submit such a patch, please verify that your modifi-
4577 cation did not break existing code. At least make sure that *ALL* of 4577 cation did not break existing code. At least make sure that *ALL* of
4578 the supported boards compile WITHOUT ANY compiler warnings. To do so, 4578 the supported boards compile WITHOUT ANY compiler warnings. To do so,
4579 just run the buildman script (tools/buildman/buildman), which will 4579 just run the buildman script (tools/buildman/buildman), which will
4580 configure and build U-Boot for ALL supported system. Be warned, this 4580 configure and build U-Boot for ALL supported system. Be warned, this
4581 will take a while. Please see the buildman README, or run 'buildman -H' 4581 will take a while. Please see the buildman README, or run 'buildman -H'
4582 for documentation. 4582 for documentation.
4583 4583
4584 4584
4585 See also "U-Boot Porting Guide" below. 4585 See also "U-Boot Porting Guide" below.
4586 4586
4587 4587
4588 Monitor Commands - Overview: 4588 Monitor Commands - Overview:
4589 ============================ 4589 ============================
4590 4590
4591 go - start application at address 'addr' 4591 go - start application at address 'addr'
4592 run - run commands in an environment variable 4592 run - run commands in an environment variable
4593 bootm - boot application image from memory 4593 bootm - boot application image from memory
4594 bootp - boot image via network using BootP/TFTP protocol 4594 bootp - boot image via network using BootP/TFTP protocol
4595 bootz - boot zImage from memory 4595 bootz - boot zImage from memory
4596 tftpboot- boot image via network using TFTP protocol 4596 tftpboot- boot image via network using TFTP protocol
4597 and env variables "ipaddr" and "serverip" 4597 and env variables "ipaddr" and "serverip"
4598 (and eventually "gatewayip") 4598 (and eventually "gatewayip")
4599 tftpput - upload a file via network using TFTP protocol 4599 tftpput - upload a file via network using TFTP protocol
4600 rarpboot- boot image via network using RARP/TFTP protocol 4600 rarpboot- boot image via network using RARP/TFTP protocol
4601 diskboot- boot from IDE devicebootd - boot default, i.e., run 'bootcmd' 4601 diskboot- boot from IDE devicebootd - boot default, i.e., run 'bootcmd'
4602 loads - load S-Record file over serial line 4602 loads - load S-Record file over serial line
4603 loadb - load binary file over serial line (kermit mode) 4603 loadb - load binary file over serial line (kermit mode)
4604 md - memory display 4604 md - memory display
4605 mm - memory modify (auto-incrementing) 4605 mm - memory modify (auto-incrementing)
4606 nm - memory modify (constant address) 4606 nm - memory modify (constant address)
4607 mw - memory write (fill) 4607 mw - memory write (fill)
4608 cp - memory copy 4608 cp - memory copy
4609 cmp - memory compare 4609 cmp - memory compare
4610 crc32 - checksum calculation 4610 crc32 - checksum calculation
4611 i2c - I2C sub-system 4611 i2c - I2C sub-system
4612 sspi - SPI utility commands 4612 sspi - SPI utility commands
4613 base - print or set address offset 4613 base - print or set address offset
4614 printenv- print environment variables 4614 printenv- print environment variables
4615 setenv - set environment variables 4615 setenv - set environment variables
4616 saveenv - save environment variables to persistent storage 4616 saveenv - save environment variables to persistent storage
4617 protect - enable or disable FLASH write protection 4617 protect - enable or disable FLASH write protection
4618 erase - erase FLASH memory 4618 erase - erase FLASH memory
4619 flinfo - print FLASH memory information 4619 flinfo - print FLASH memory information
4620 nand - NAND memory operations (see doc/README.nand) 4620 nand - NAND memory operations (see doc/README.nand)
4621 bdinfo - print Board Info structure 4621 bdinfo - print Board Info structure
4622 iminfo - print header information for application image 4622 iminfo - print header information for application image
4623 coninfo - print console devices and informations 4623 coninfo - print console devices and informations
4624 ide - IDE sub-system 4624 ide - IDE sub-system
4625 loop - infinite loop on address range 4625 loop - infinite loop on address range
4626 loopw - infinite write loop on address range 4626 loopw - infinite write loop on address range
4627 mtest - simple RAM test 4627 mtest - simple RAM test
4628 icache - enable or disable instruction cache 4628 icache - enable or disable instruction cache
4629 dcache - enable or disable data cache 4629 dcache - enable or disable data cache
4630 reset - Perform RESET of the CPU 4630 reset - Perform RESET of the CPU
4631 echo - echo args to console 4631 echo - echo args to console
4632 version - print monitor version 4632 version - print monitor version
4633 help - print online help 4633 help - print online help
4634 ? - alias for 'help' 4634 ? - alias for 'help'
4635 4635
4636 4636
4637 Monitor Commands - Detailed Description: 4637 Monitor Commands - Detailed Description:
4638 ======================================== 4638 ========================================
4639 4639
4640 TODO. 4640 TODO.
4641 4641
4642 For now: just type "help <command>". 4642 For now: just type "help <command>".
4643 4643
4644 4644
4645 Environment Variables: 4645 Environment Variables:
4646 ====================== 4646 ======================
4647 4647
4648 U-Boot supports user configuration using Environment Variables which 4648 U-Boot supports user configuration using Environment Variables which
4649 can be made persistent by saving to Flash memory. 4649 can be made persistent by saving to Flash memory.
4650 4650
4651 Environment Variables are set using "setenv", printed using 4651 Environment Variables are set using "setenv", printed using
4652 "printenv", and saved to Flash using "saveenv". Using "setenv" 4652 "printenv", and saved to Flash using "saveenv". Using "setenv"
4653 without a value can be used to delete a variable from the 4653 without a value can be used to delete a variable from the
4654 environment. As long as you don't save the environment you are 4654 environment. As long as you don't save the environment you are
4655 working with an in-memory copy. In case the Flash area containing the 4655 working with an in-memory copy. In case the Flash area containing the
4656 environment is erased by accident, a default environment is provided. 4656 environment is erased by accident, a default environment is provided.
4657 4657
4658 Some configuration options can be set using Environment Variables. 4658 Some configuration options can be set using Environment Variables.
4659 4659
4660 List of environment variables (most likely not complete): 4660 List of environment variables (most likely not complete):
4661 4661
4662 baudrate - see CONFIG_BAUDRATE 4662 baudrate - see CONFIG_BAUDRATE
4663 4663
4664 bootdelay - see CONFIG_BOOTDELAY 4664 bootdelay - see CONFIG_BOOTDELAY
4665 4665
4666 bootcmd - see CONFIG_BOOTCOMMAND 4666 bootcmd - see CONFIG_BOOTCOMMAND
4667 4667
4668 bootargs - Boot arguments when booting an RTOS image 4668 bootargs - Boot arguments when booting an RTOS image
4669 4669
4670 bootfile - Name of the image to load with TFTP 4670 bootfile - Name of the image to load with TFTP
4671 4671
4672 bootm_low - Memory range available for image processing in the bootm 4672 bootm_low - Memory range available for image processing in the bootm
4673 command can be restricted. This variable is given as 4673 command can be restricted. This variable is given as
4674 a hexadecimal number and defines lowest address allowed 4674 a hexadecimal number and defines lowest address allowed
4675 for use by the bootm command. See also "bootm_size" 4675 for use by the bootm command. See also "bootm_size"
4676 environment variable. Address defined by "bootm_low" is 4676 environment variable. Address defined by "bootm_low" is
4677 also the base of the initial memory mapping for the Linux 4677 also the base of the initial memory mapping for the Linux
4678 kernel -- see the description of CONFIG_SYS_BOOTMAPSZ and 4678 kernel -- see the description of CONFIG_SYS_BOOTMAPSZ and
4679 bootm_mapsize. 4679 bootm_mapsize.
4680 4680
4681 bootm_mapsize - Size of the initial memory mapping for the Linux kernel. 4681 bootm_mapsize - Size of the initial memory mapping for the Linux kernel.
4682 This variable is given as a hexadecimal number and it 4682 This variable is given as a hexadecimal number and it
4683 defines the size of the memory region starting at base 4683 defines the size of the memory region starting at base
4684 address bootm_low that is accessible by the Linux kernel 4684 address bootm_low that is accessible by the Linux kernel
4685 during early boot. If unset, CONFIG_SYS_BOOTMAPSZ is used 4685 during early boot. If unset, CONFIG_SYS_BOOTMAPSZ is used
4686 as the default value if it is defined, and bootm_size is 4686 as the default value if it is defined, and bootm_size is
4687 used otherwise. 4687 used otherwise.
4688 4688
4689 bootm_size - Memory range available for image processing in the bootm 4689 bootm_size - Memory range available for image processing in the bootm
4690 command can be restricted. This variable is given as 4690 command can be restricted. This variable is given as
4691 a hexadecimal number and defines the size of the region 4691 a hexadecimal number and defines the size of the region
4692 allowed for use by the bootm command. See also "bootm_low" 4692 allowed for use by the bootm command. See also "bootm_low"
4693 environment variable. 4693 environment variable.
4694 4694
4695 updatefile - Location of the software update file on a TFTP server, used 4695 updatefile - Location of the software update file on a TFTP server, used
4696 by the automatic software update feature. Please refer to 4696 by the automatic software update feature. Please refer to
4697 documentation in doc/README.update for more details. 4697 documentation in doc/README.update for more details.
4698 4698
4699 autoload - if set to "no" (any string beginning with 'n'), 4699 autoload - if set to "no" (any string beginning with 'n'),
4700 "bootp" will just load perform a lookup of the 4700 "bootp" will just load perform a lookup of the
4701 configuration from the BOOTP server, but not try to 4701 configuration from the BOOTP server, but not try to
4702 load any image using TFTP 4702 load any image using TFTP
4703 4703
4704 autostart - if set to "yes", an image loaded using the "bootp", 4704 autostart - if set to "yes", an image loaded using the "bootp",
4705 "rarpboot", "tftpboot" or "diskboot" commands will 4705 "rarpboot", "tftpboot" or "diskboot" commands will
4706 be automatically started (by internally calling 4706 be automatically started (by internally calling
4707 "bootm") 4707 "bootm")
4708 4708
4709 If set to "no", a standalone image passed to the 4709 If set to "no", a standalone image passed to the
4710 "bootm" command will be copied to the load address 4710 "bootm" command will be copied to the load address
4711 (and eventually uncompressed), but NOT be started. 4711 (and eventually uncompressed), but NOT be started.
4712 This can be used to load and uncompress arbitrary 4712 This can be used to load and uncompress arbitrary
4713 data. 4713 data.
4714 4714
4715 fdt_high - if set this restricts the maximum address that the 4715 fdt_high - if set this restricts the maximum address that the
4716 flattened device tree will be copied into upon boot. 4716 flattened device tree will be copied into upon boot.
4717 For example, if you have a system with 1 GB memory 4717 For example, if you have a system with 1 GB memory
4718 at physical address 0x10000000, while Linux kernel 4718 at physical address 0x10000000, while Linux kernel
4719 only recognizes the first 704 MB as low memory, you 4719 only recognizes the first 704 MB as low memory, you
4720 may need to set fdt_high as 0x3C000000 to have the 4720 may need to set fdt_high as 0x3C000000 to have the
4721 device tree blob be copied to the maximum address 4721 device tree blob be copied to the maximum address
4722 of the 704 MB low memory, so that Linux kernel can 4722 of the 704 MB low memory, so that Linux kernel can
4723 access it during the boot procedure. 4723 access it during the boot procedure.
4724 4724
4725 If this is set to the special value 0xFFFFFFFF then 4725 If this is set to the special value 0xFFFFFFFF then
4726 the fdt will not be copied at all on boot. For this 4726 the fdt will not be copied at all on boot. For this
4727 to work it must reside in writable memory, have 4727 to work it must reside in writable memory, have
4728 sufficient padding on the end of it for u-boot to 4728 sufficient padding on the end of it for u-boot to
4729 add the information it needs into it, and the memory 4729 add the information it needs into it, and the memory
4730 must be accessible by the kernel. 4730 must be accessible by the kernel.
4731 4731
4732 fdtcontroladdr- if set this is the address of the control flattened 4732 fdtcontroladdr- if set this is the address of the control flattened
4733 device tree used by U-Boot when CONFIG_OF_CONTROL is 4733 device tree used by U-Boot when CONFIG_OF_CONTROL is
4734 defined. 4734 defined.
4735 4735
4736 i2cfast - (PPC405GP|PPC405EP only) 4736 i2cfast - (PPC405GP|PPC405EP only)
4737 if set to 'y' configures Linux I2C driver for fast 4737 if set to 'y' configures Linux I2C driver for fast
4738 mode (400kHZ). This environment variable is used in 4738 mode (400kHZ). This environment variable is used in
4739 initialization code. So, for changes to be effective 4739 initialization code. So, for changes to be effective
4740 it must be saved and board must be reset. 4740 it must be saved and board must be reset.
4741 4741
4742 initrd_high - restrict positioning of initrd images: 4742 initrd_high - restrict positioning of initrd images:
4743 If this variable is not set, initrd images will be 4743 If this variable is not set, initrd images will be
4744 copied to the highest possible address in RAM; this 4744 copied to the highest possible address in RAM; this
4745 is usually what you want since it allows for 4745 is usually what you want since it allows for
4746 maximum initrd size. If for some reason you want to 4746 maximum initrd size. If for some reason you want to
4747 make sure that the initrd image is loaded below the 4747 make sure that the initrd image is loaded below the
4748 CONFIG_SYS_BOOTMAPSZ limit, you can set this environment 4748 CONFIG_SYS_BOOTMAPSZ limit, you can set this environment
4749 variable to a value of "no" or "off" or "0". 4749 variable to a value of "no" or "off" or "0".
4750 Alternatively, you can set it to a maximum upper 4750 Alternatively, you can set it to a maximum upper
4751 address to use (U-Boot will still check that it 4751 address to use (U-Boot will still check that it
4752 does not overwrite the U-Boot stack and data). 4752 does not overwrite the U-Boot stack and data).
4753 4753
4754 For instance, when you have a system with 16 MB 4754 For instance, when you have a system with 16 MB
4755 RAM, and want to reserve 4 MB from use by Linux, 4755 RAM, and want to reserve 4 MB from use by Linux,
4756 you can do this by adding "mem=12M" to the value of 4756 you can do this by adding "mem=12M" to the value of
4757 the "bootargs" variable. However, now you must make 4757 the "bootargs" variable. However, now you must make
4758 sure that the initrd image is placed in the first 4758 sure that the initrd image is placed in the first
4759 12 MB as well - this can be done with 4759 12 MB as well - this can be done with
4760 4760
4761 setenv initrd_high 00c00000 4761 setenv initrd_high 00c00000
4762 4762
4763 If you set initrd_high to 0xFFFFFFFF, this is an 4763 If you set initrd_high to 0xFFFFFFFF, this is an
4764 indication to U-Boot that all addresses are legal 4764 indication to U-Boot that all addresses are legal
4765 for the Linux kernel, including addresses in flash 4765 for the Linux kernel, including addresses in flash
4766 memory. In this case U-Boot will NOT COPY the 4766 memory. In this case U-Boot will NOT COPY the
4767 ramdisk at all. This may be useful to reduce the 4767 ramdisk at all. This may be useful to reduce the
4768 boot time on your system, but requires that this 4768 boot time on your system, but requires that this
4769 feature is supported by your Linux kernel. 4769 feature is supported by your Linux kernel.
4770 4770
4771 ipaddr - IP address; needed for tftpboot command 4771 ipaddr - IP address; needed for tftpboot command
4772 4772
4773 loadaddr - Default load address for commands like "bootp", 4773 loadaddr - Default load address for commands like "bootp",
4774 "rarpboot", "tftpboot", "loadb" or "diskboot" 4774 "rarpboot", "tftpboot", "loadb" or "diskboot"
4775 4775
4776 loads_echo - see CONFIG_LOADS_ECHO 4776 loads_echo - see CONFIG_LOADS_ECHO
4777 4777
4778 serverip - TFTP server IP address; needed for tftpboot command 4778 serverip - TFTP server IP address; needed for tftpboot command
4779 4779
4780 bootretry - see CONFIG_BOOT_RETRY_TIME 4780 bootretry - see CONFIG_BOOT_RETRY_TIME
4781 4781
4782 bootdelaykey - see CONFIG_AUTOBOOT_DELAY_STR 4782 bootdelaykey - see CONFIG_AUTOBOOT_DELAY_STR
4783 4783
4784 bootstopkey - see CONFIG_AUTOBOOT_STOP_STR 4784 bootstopkey - see CONFIG_AUTOBOOT_STOP_STR
4785 4785
4786 ethprime - controls which interface is used first. 4786 ethprime - controls which interface is used first.
4787 4787
4788 ethact - controls which interface is currently active. 4788 ethact - controls which interface is currently active.
4789 For example you can do the following 4789 For example you can do the following
4790 4790
4791 => setenv ethact FEC 4791 => setenv ethact FEC
4792 => ping 192.168.0.1 # traffic sent on FEC 4792 => ping 192.168.0.1 # traffic sent on FEC
4793 => setenv ethact SCC 4793 => setenv ethact SCC
4794 => ping 10.0.0.1 # traffic sent on SCC 4794 => ping 10.0.0.1 # traffic sent on SCC
4795 4795
4796 ethrotate - When set to "no" U-Boot does not go through all 4796 ethrotate - When set to "no" U-Boot does not go through all
4797 available network interfaces. 4797 available network interfaces.
4798 It just stays at the currently selected interface. 4798 It just stays at the currently selected interface.
4799 4799
4800 netretry - When set to "no" each network operation will 4800 netretry - When set to "no" each network operation will
4801 either succeed or fail without retrying. 4801 either succeed or fail without retrying.
4802 When set to "once" the network operation will 4802 When set to "once" the network operation will
4803 fail when all the available network interfaces 4803 fail when all the available network interfaces
4804 are tried once without success. 4804 are tried once without success.
4805 Useful on scripts which control the retry operation 4805 Useful on scripts which control the retry operation
4806 themselves. 4806 themselves.
4807 4807
4808 npe_ucode - set load address for the NPE microcode 4808 npe_ucode - set load address for the NPE microcode
4809 4809
4810 silent_linux - If set then Linux will be told to boot silently, by 4810 silent_linux - If set then Linux will be told to boot silently, by
4811 changing the console to be empty. If "yes" it will be 4811 changing the console to be empty. If "yes" it will be
4812 made silent. If "no" it will not be made silent. If 4812 made silent. If "no" it will not be made silent. If
4813 unset, then it will be made silent if the U-Boot console 4813 unset, then it will be made silent if the U-Boot console
4814 is silent. 4814 is silent.
4815 4815
4816 tftpsrcp - If this is set, the value is used for TFTP's 4816 tftpsrcp - If this is set, the value is used for TFTP's
4817 UDP source port. 4817 UDP source port.
4818 4818
4819 tftpdstp - If this is set, the value is used for TFTP's UDP 4819 tftpdstp - If this is set, the value is used for TFTP's UDP
4820 destination port instead of the Well Know Port 69. 4820 destination port instead of the Well Know Port 69.
4821 4821
4822 tftpblocksize - Block size to use for TFTP transfers; if not set, 4822 tftpblocksize - Block size to use for TFTP transfers; if not set,
4823 we use the TFTP server's default block size 4823 we use the TFTP server's default block size
4824 4824
4825 tftptimeout - Retransmission timeout for TFTP packets (in milli- 4825 tftptimeout - Retransmission timeout for TFTP packets (in milli-
4826 seconds, minimum value is 1000 = 1 second). Defines 4826 seconds, minimum value is 1000 = 1 second). Defines
4827 when a packet is considered to be lost so it has to 4827 when a packet is considered to be lost so it has to
4828 be retransmitted. The default is 5000 = 5 seconds. 4828 be retransmitted. The default is 5000 = 5 seconds.
4829 Lowering this value may make downloads succeed 4829 Lowering this value may make downloads succeed
4830 faster in networks with high packet loss rates or 4830 faster in networks with high packet loss rates or
4831 with unreliable TFTP servers. 4831 with unreliable TFTP servers.
4832 4832
4833 tftptimeoutcountmax - maximum count of TFTP timeouts (no 4833 tftptimeoutcountmax - maximum count of TFTP timeouts (no
4834 unit, minimum value = 0). Defines how many timeouts 4834 unit, minimum value = 0). Defines how many timeouts
4835 can happen during a single file transfer before that 4835 can happen during a single file transfer before that
4836 transfer is aborted. The default is 10, and 0 means 4836 transfer is aborted. The default is 10, and 0 means
4837 'no timeouts allowed'. Increasing this value may help 4837 'no timeouts allowed'. Increasing this value may help
4838 downloads succeed with high packet loss rates, or with 4838 downloads succeed with high packet loss rates, or with
4839 unreliable TFTP servers or client hardware. 4839 unreliable TFTP servers or client hardware.
4840 4840
4841 vlan - When set to a value < 4095 the traffic over 4841 vlan - When set to a value < 4095 the traffic over
4842 Ethernet is encapsulated/received over 802.1q 4842 Ethernet is encapsulated/received over 802.1q
4843 VLAN tagged frames. 4843 VLAN tagged frames.
4844 4844
4845 bootpretryperiod - Period during which BOOTP/DHCP sends retries. 4845 bootpretryperiod - Period during which BOOTP/DHCP sends retries.
4846 Unsigned value, in milliseconds. If not set, the period will 4846 Unsigned value, in milliseconds. If not set, the period will
4847 be either the default (28000), or a value based on 4847 be either the default (28000), or a value based on
4848 CONFIG_NET_RETRY_COUNT, if defined. This value has 4848 CONFIG_NET_RETRY_COUNT, if defined. This value has
4849 precedence over the valu based on CONFIG_NET_RETRY_COUNT. 4849 precedence over the valu based on CONFIG_NET_RETRY_COUNT.
4850 4850
4851 The following image location variables contain the location of images 4851 The following image location variables contain the location of images
4852 used in booting. The "Image" column gives the role of the image and is 4852 used in booting. The "Image" column gives the role of the image and is
4853 not an environment variable name. The other columns are environment 4853 not an environment variable name. The other columns are environment
4854 variable names. "File Name" gives the name of the file on a TFTP 4854 variable names. "File Name" gives the name of the file on a TFTP
4855 server, "RAM Address" gives the location in RAM the image will be 4855 server, "RAM Address" gives the location in RAM the image will be
4856 loaded to, and "Flash Location" gives the image's address in NOR 4856 loaded to, and "Flash Location" gives the image's address in NOR
4857 flash or offset in NAND flash. 4857 flash or offset in NAND flash.
4858 4858
4859 *Note* - these variables don't have to be defined for all boards, some 4859 *Note* - these variables don't have to be defined for all boards, some
4860 boards currently use other variables for these purposes, and some 4860 boards currently use other variables for these purposes, and some
4861 boards use these variables for other purposes. 4861 boards use these variables for other purposes.
4862 4862
4863 Image File Name RAM Address Flash Location 4863 Image File Name RAM Address Flash Location
4864 ----- --------- ----------- -------------- 4864 ----- --------- ----------- --------------
4865 u-boot u-boot u-boot_addr_r u-boot_addr 4865 u-boot u-boot u-boot_addr_r u-boot_addr
4866 Linux kernel bootfile kernel_addr_r kernel_addr 4866 Linux kernel bootfile kernel_addr_r kernel_addr
4867 device tree blob fdtfile fdt_addr_r fdt_addr 4867 device tree blob fdtfile fdt_addr_r fdt_addr
4868 ramdisk ramdiskfile ramdisk_addr_r ramdisk_addr 4868 ramdisk ramdiskfile ramdisk_addr_r ramdisk_addr
4869 4869
4870 The following environment variables may be used and automatically 4870 The following environment variables may be used and automatically
4871 updated by the network boot commands ("bootp" and "rarpboot"), 4871 updated by the network boot commands ("bootp" and "rarpboot"),
4872 depending the information provided by your boot server: 4872 depending the information provided by your boot server:
4873 4873
4874 bootfile - see above 4874 bootfile - see above
4875 dnsip - IP address of your Domain Name Server 4875 dnsip - IP address of your Domain Name Server
4876 dnsip2 - IP address of your secondary Domain Name Server 4876 dnsip2 - IP address of your secondary Domain Name Server
4877 gatewayip - IP address of the Gateway (Router) to use 4877 gatewayip - IP address of the Gateway (Router) to use
4878 hostname - Target hostname 4878 hostname - Target hostname
4879 ipaddr - see above 4879 ipaddr - see above
4880 netmask - Subnet Mask 4880 netmask - Subnet Mask
4881 rootpath - Pathname of the root filesystem on the NFS server 4881 rootpath - Pathname of the root filesystem on the NFS server
4882 serverip - see above 4882 serverip - see above
4883 4883
4884 4884
4885 There are two special Environment Variables: 4885 There are two special Environment Variables:
4886 4886
4887 serial# - contains hardware identification information such 4887 serial# - contains hardware identification information such
4888 as type string and/or serial number 4888 as type string and/or serial number
4889 ethaddr - Ethernet address 4889 ethaddr - Ethernet address
4890 4890
4891 These variables can be set only once (usually during manufacturing of 4891 These variables can be set only once (usually during manufacturing of
4892 the board). U-Boot refuses to delete or overwrite these variables 4892 the board). U-Boot refuses to delete or overwrite these variables
4893 once they have been set once. 4893 once they have been set once.
4894 4894
4895 4895
4896 Further special Environment Variables: 4896 Further special Environment Variables:
4897 4897
4898 ver - Contains the U-Boot version string as printed 4898 ver - Contains the U-Boot version string as printed
4899 with the "version" command. This variable is 4899 with the "version" command. This variable is
4900 readonly (see CONFIG_VERSION_VARIABLE). 4900 readonly (see CONFIG_VERSION_VARIABLE).
4901 4901
4902 4902
4903 Please note that changes to some configuration parameters may take 4903 Please note that changes to some configuration parameters may take
4904 only effect after the next boot (yes, that's just like Windoze :-). 4904 only effect after the next boot (yes, that's just like Windoze :-).
4905 4905
4906 4906
4907 Callback functions for environment variables: 4907 Callback functions for environment variables:
4908 --------------------------------------------- 4908 ---------------------------------------------
4909 4909
4910 For some environment variables, the behavior of u-boot needs to change 4910 For some environment variables, the behavior of u-boot needs to change
4911 when their values are changed. This functionality allows functions to 4911 when their values are changed. This functionality allows functions to
4912 be associated with arbitrary variables. On creation, overwrite, or 4912 be associated with arbitrary variables. On creation, overwrite, or
4913 deletion, the callback will provide the opportunity for some side 4913 deletion, the callback will provide the opportunity for some side
4914 effect to happen or for the change to be rejected. 4914 effect to happen or for the change to be rejected.
4915 4915
4916 The callbacks are named and associated with a function using the 4916 The callbacks are named and associated with a function using the
4917 U_BOOT_ENV_CALLBACK macro in your board or driver code. 4917 U_BOOT_ENV_CALLBACK macro in your board or driver code.
4918 4918
4919 These callbacks are associated with variables in one of two ways. The 4919 These callbacks are associated with variables in one of two ways. The
4920 static list can be added to by defining CONFIG_ENV_CALLBACK_LIST_STATIC 4920 static list can be added to by defining CONFIG_ENV_CALLBACK_LIST_STATIC
4921 in the board configuration to a string that defines a list of 4921 in the board configuration to a string that defines a list of
4922 associations. The list must be in the following format: 4922 associations. The list must be in the following format:
4923 4923
4924 entry = variable_name[:callback_name] 4924 entry = variable_name[:callback_name]
4925 list = entry[,list] 4925 list = entry[,list]
4926 4926
4927 If the callback name is not specified, then the callback is deleted. 4927 If the callback name is not specified, then the callback is deleted.
4928 Spaces are also allowed anywhere in the list. 4928 Spaces are also allowed anywhere in the list.
4929 4929
4930 Callbacks can also be associated by defining the ".callbacks" variable 4930 Callbacks can also be associated by defining the ".callbacks" variable
4931 with the same list format above. Any association in ".callbacks" will 4931 with the same list format above. Any association in ".callbacks" will
4932 override any association in the static list. You can define 4932 override any association in the static list. You can define
4933 CONFIG_ENV_CALLBACK_LIST_DEFAULT to a list (string) to define the 4933 CONFIG_ENV_CALLBACK_LIST_DEFAULT to a list (string) to define the
4934 ".callbacks" environment variable in the default or embedded environment. 4934 ".callbacks" environment variable in the default or embedded environment.
4935 4935
4936 If CONFIG_REGEX is defined, the variable_name above is evaluated as a 4936 If CONFIG_REGEX is defined, the variable_name above is evaluated as a
4937 regular expression. This allows multiple variables to be connected to 4937 regular expression. This allows multiple variables to be connected to
4938 the same callback without explicitly listing them all out. 4938 the same callback without explicitly listing them all out.
4939 4939
4940 4940
4941 Command Line Parsing: 4941 Command Line Parsing:
4942 ===================== 4942 =====================
4943 4943
4944 There are two different command line parsers available with U-Boot: 4944 There are two different command line parsers available with U-Boot:
4945 the old "simple" one, and the much more powerful "hush" shell: 4945 the old "simple" one, and the much more powerful "hush" shell:
4946 4946
4947 Old, simple command line parser: 4947 Old, simple command line parser:
4948 -------------------------------- 4948 --------------------------------
4949 4949
4950 - supports environment variables (through setenv / saveenv commands) 4950 - supports environment variables (through setenv / saveenv commands)
4951 - several commands on one line, separated by ';' 4951 - several commands on one line, separated by ';'
4952 - variable substitution using "... ${name} ..." syntax 4952 - variable substitution using "... ${name} ..." syntax
4953 - special characters ('$', ';') can be escaped by prefixing with '\', 4953 - special characters ('$', ';') can be escaped by prefixing with '\',
4954 for example: 4954 for example:
4955 setenv bootcmd bootm \${address} 4955 setenv bootcmd bootm \${address}
4956 - You can also escape text by enclosing in single apostrophes, for example: 4956 - You can also escape text by enclosing in single apostrophes, for example:
4957 setenv addip 'setenv bootargs $bootargs ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname::off' 4957 setenv addip 'setenv bootargs $bootargs ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname::off'
4958 4958
4959 Hush shell: 4959 Hush shell:
4960 ----------- 4960 -----------
4961 4961
4962 - similar to Bourne shell, with control structures like 4962 - similar to Bourne shell, with control structures like
4963 if...then...else...fi, for...do...done; while...do...done, 4963 if...then...else...fi, for...do...done; while...do...done,
4964 until...do...done, ... 4964 until...do...done, ...
4965 - supports environment ("global") variables (through setenv / saveenv 4965 - supports environment ("global") variables (through setenv / saveenv
4966 commands) and local shell variables (through standard shell syntax 4966 commands) and local shell variables (through standard shell syntax
4967 "name=value"); only environment variables can be used with "run" 4967 "name=value"); only environment variables can be used with "run"
4968 command 4968 command
4969 4969
4970 General rules: 4970 General rules:
4971 -------------- 4971 --------------
4972 4972
4973 (1) If a command line (or an environment variable executed by a "run" 4973 (1) If a command line (or an environment variable executed by a "run"
4974 command) contains several commands separated by semicolon, and 4974 command) contains several commands separated by semicolon, and
4975 one of these commands fails, then the remaining commands will be 4975 one of these commands fails, then the remaining commands will be
4976 executed anyway. 4976 executed anyway.
4977 4977
4978 (2) If you execute several variables with one call to run (i. e. 4978 (2) If you execute several variables with one call to run (i. e.
4979 calling run with a list of variables as arguments), any failing 4979 calling run with a list of variables as arguments), any failing
4980 command will cause "run" to terminate, i. e. the remaining 4980 command will cause "run" to terminate, i. e. the remaining
4981 variables are not executed. 4981 variables are not executed.
4982 4982
4983 Note for Redundant Ethernet Interfaces: 4983 Note for Redundant Ethernet Interfaces:
4984 ======================================= 4984 =======================================
4985 4985
4986 Some boards come with redundant Ethernet interfaces; U-Boot supports 4986 Some boards come with redundant Ethernet interfaces; U-Boot supports
4987 such configurations and is capable of automatic selection of a 4987 such configurations and is capable of automatic selection of a
4988 "working" interface when needed. MAC assignment works as follows: 4988 "working" interface when needed. MAC assignment works as follows:
4989 4989
4990 Network interfaces are numbered eth0, eth1, eth2, ... Corresponding 4990 Network interfaces are numbered eth0, eth1, eth2, ... Corresponding
4991 MAC addresses can be stored in the environment as "ethaddr" (=>eth0), 4991 MAC addresses can be stored in the environment as "ethaddr" (=>eth0),
4992 "eth1addr" (=>eth1), "eth2addr", ... 4992 "eth1addr" (=>eth1), "eth2addr", ...
4993 4993
4994 If the network interface stores some valid MAC address (for instance 4994 If the network interface stores some valid MAC address (for instance
4995 in SROM), this is used as default address if there is NO correspon- 4995 in SROM), this is used as default address if there is NO correspon-
4996 ding setting in the environment; if the corresponding environment 4996 ding setting in the environment; if the corresponding environment
4997 variable is set, this overrides the settings in the card; that means: 4997 variable is set, this overrides the settings in the card; that means:
4998 4998
4999 o If the SROM has a valid MAC address, and there is no address in the 4999 o If the SROM has a valid MAC address, and there is no address in the
5000 environment, the SROM's address is used. 5000 environment, the SROM's address is used.
5001 5001
5002 o If there is no valid address in the SROM, and a definition in the 5002 o If there is no valid address in the SROM, and a definition in the
5003 environment exists, then the value from the environment variable is 5003 environment exists, then the value from the environment variable is
5004 used. 5004 used.
5005 5005
5006 o If both the SROM and the environment contain a MAC address, and 5006 o If both the SROM and the environment contain a MAC address, and
5007 both addresses are the same, this MAC address is used. 5007 both addresses are the same, this MAC address is used.
5008 5008
5009 o If both the SROM and the environment contain a MAC address, and the 5009 o If both the SROM and the environment contain a MAC address, and the
5010 addresses differ, the value from the environment is used and a 5010 addresses differ, the value from the environment is used and a
5011 warning is printed. 5011 warning is printed.
5012 5012
5013 o If neither SROM nor the environment contain a MAC address, an error 5013 o If neither SROM nor the environment contain a MAC address, an error
5014 is raised. If CONFIG_NET_RANDOM_ETHADDR is defined, then in this case 5014 is raised. If CONFIG_NET_RANDOM_ETHADDR is defined, then in this case
5015 a random, locally-assigned MAC is used. 5015 a random, locally-assigned MAC is used.
5016 5016
5017 If Ethernet drivers implement the 'write_hwaddr' function, valid MAC addresses 5017 If Ethernet drivers implement the 'write_hwaddr' function, valid MAC addresses
5018 will be programmed into hardware as part of the initialization process. This 5018 will be programmed into hardware as part of the initialization process. This
5019 may be skipped by setting the appropriate 'ethmacskip' environment variable. 5019 may be skipped by setting the appropriate 'ethmacskip' environment variable.
5020 The naming convention is as follows: 5020 The naming convention is as follows:
5021 "ethmacskip" (=>eth0), "eth1macskip" (=>eth1) etc. 5021 "ethmacskip" (=>eth0), "eth1macskip" (=>eth1) etc.
5022 5022
5023 Image Formats: 5023 Image Formats:
5024 ============== 5024 ==============
5025 5025
5026 U-Boot is capable of booting (and performing other auxiliary operations on) 5026 U-Boot is capable of booting (and performing other auxiliary operations on)
5027 images in two formats: 5027 images in two formats:
5028 5028
5029 New uImage format (FIT) 5029 New uImage format (FIT)
5030 ----------------------- 5030 -----------------------
5031 5031
5032 Flexible and powerful format based on Flattened Image Tree -- FIT (similar 5032 Flexible and powerful format based on Flattened Image Tree -- FIT (similar
5033 to Flattened Device Tree). It allows the use of images with multiple 5033 to Flattened Device Tree). It allows the use of images with multiple
5034 components (several kernels, ramdisks, etc.), with contents protected by 5034 components (several kernels, ramdisks, etc.), with contents protected by
5035 SHA1, MD5 or CRC32. More details are found in the doc/uImage.FIT directory. 5035 SHA1, MD5 or CRC32. More details are found in the doc/uImage.FIT directory.
5036 5036
5037 5037
5038 Old uImage format 5038 Old uImage format
5039 ----------------- 5039 -----------------
5040 5040
5041 Old image format is based on binary files which can be basically anything, 5041 Old image format is based on binary files which can be basically anything,
5042 preceded by a special header; see the definitions in include/image.h for 5042 preceded by a special header; see the definitions in include/image.h for
5043 details; basically, the header defines the following image properties: 5043 details; basically, the header defines the following image properties:
5044 5044
5045 * Target Operating System (Provisions for OpenBSD, NetBSD, FreeBSD, 5045 * Target Operating System (Provisions for OpenBSD, NetBSD, FreeBSD,
5046 4.4BSD, Linux, SVR4, Esix, Solaris, Irix, SCO, Dell, NCR, VxWorks, 5046 4.4BSD, Linux, SVR4, Esix, Solaris, Irix, SCO, Dell, NCR, VxWorks,
5047 LynxOS, pSOS, QNX, RTEMS, INTEGRITY; 5047 LynxOS, pSOS, QNX, RTEMS, INTEGRITY;
5048 Currently supported: Linux, NetBSD, VxWorks, QNX, RTEMS, LynxOS, 5048 Currently supported: Linux, NetBSD, VxWorks, QNX, RTEMS, LynxOS,
5049 INTEGRITY). 5049 INTEGRITY).
5050 * Target CPU Architecture (Provisions for Alpha, ARM, AVR32, Intel x86, 5050 * Target CPU Architecture (Provisions for Alpha, ARM, AVR32, Intel x86,
5051 IA64, MIPS, NDS32, Nios II, PowerPC, IBM S390, SuperH, Sparc, Sparc 64 Bit; 5051 IA64, MIPS, NDS32, Nios II, PowerPC, IBM S390, SuperH, Sparc, Sparc 64 Bit;
5052 Currently supported: ARM, AVR32, Intel x86, MIPS, NDS32, Nios II, PowerPC). 5052 Currently supported: ARM, AVR32, Intel x86, MIPS, NDS32, Nios II, PowerPC).
5053 * Compression Type (uncompressed, gzip, bzip2) 5053 * Compression Type (uncompressed, gzip, bzip2)
5054 * Load Address 5054 * Load Address
5055 * Entry Point 5055 * Entry Point
5056 * Image Name 5056 * Image Name
5057 * Image Timestamp 5057 * Image Timestamp
5058 5058
5059 The header is marked by a special Magic Number, and both the header 5059 The header is marked by a special Magic Number, and both the header
5060 and the data portions of the image are secured against corruption by 5060 and the data portions of the image are secured against corruption by
5061 CRC32 checksums. 5061 CRC32 checksums.
5062 5062
5063 5063
5064 Linux Support: 5064 Linux Support:
5065 ============== 5065 ==============
5066 5066
5067 Although U-Boot should support any OS or standalone application 5067 Although U-Boot should support any OS or standalone application
5068 easily, the main focus has always been on Linux during the design of 5068 easily, the main focus has always been on Linux during the design of
5069 U-Boot. 5069 U-Boot.
5070 5070
5071 U-Boot includes many features that so far have been part of some 5071 U-Boot includes many features that so far have been part of some
5072 special "boot loader" code within the Linux kernel. Also, any 5072 special "boot loader" code within the Linux kernel. Also, any
5073 "initrd" images to be used are no longer part of one big Linux image; 5073 "initrd" images to be used are no longer part of one big Linux image;
5074 instead, kernel and "initrd" are separate images. This implementation 5074 instead, kernel and "initrd" are separate images. This implementation
5075 serves several purposes: 5075 serves several purposes:
5076 5076
5077 - the same features can be used for other OS or standalone 5077 - the same features can be used for other OS or standalone
5078 applications (for instance: using compressed images to reduce the 5078 applications (for instance: using compressed images to reduce the
5079 Flash memory footprint) 5079 Flash memory footprint)
5080 5080
5081 - it becomes much easier to port new Linux kernel versions because 5081 - it becomes much easier to port new Linux kernel versions because
5082 lots of low-level, hardware dependent stuff are done by U-Boot 5082 lots of low-level, hardware dependent stuff are done by U-Boot
5083 5083
5084 - the same Linux kernel image can now be used with different "initrd" 5084 - the same Linux kernel image can now be used with different "initrd"
5085 images; of course this also means that different kernel images can 5085 images; of course this also means that different kernel images can
5086 be run with the same "initrd". This makes testing easier (you don't 5086 be run with the same "initrd". This makes testing easier (you don't
5087 have to build a new "zImage.initrd" Linux image when you just 5087 have to build a new "zImage.initrd" Linux image when you just
5088 change a file in your "initrd"). Also, a field-upgrade of the 5088 change a file in your "initrd"). Also, a field-upgrade of the
5089 software is easier now. 5089 software is easier now.
5090 5090
5091 5091
5092 Linux HOWTO: 5092 Linux HOWTO:
5093 ============ 5093 ============
5094 5094
5095 Porting Linux to U-Boot based systems: 5095 Porting Linux to U-Boot based systems:
5096 --------------------------------------- 5096 ---------------------------------------
5097 5097
5098 U-Boot cannot save you from doing all the necessary modifications to 5098 U-Boot cannot save you from doing all the necessary modifications to
5099 configure the Linux device drivers for use with your target hardware 5099 configure the Linux device drivers for use with your target hardware
5100 (no, we don't intend to provide a full virtual machine interface to 5100 (no, we don't intend to provide a full virtual machine interface to
5101 Linux :-). 5101 Linux :-).
5102 5102
5103 But now you can ignore ALL boot loader code (in arch/powerpc/mbxboot). 5103 But now you can ignore ALL boot loader code (in arch/powerpc/mbxboot).
5104 5104
5105 Just make sure your machine specific header file (for instance 5105 Just make sure your machine specific header file (for instance
5106 include/asm-ppc/tqm8xx.h) includes the same definition of the Board 5106 include/asm-ppc/tqm8xx.h) includes the same definition of the Board
5107 Information structure as we define in include/asm-<arch>/u-boot.h, 5107 Information structure as we define in include/asm-<arch>/u-boot.h,
5108 and make sure that your definition of IMAP_ADDR uses the same value 5108 and make sure that your definition of IMAP_ADDR uses the same value
5109 as your U-Boot configuration in CONFIG_SYS_IMMR. 5109 as your U-Boot configuration in CONFIG_SYS_IMMR.
5110 5110
5111 Note that U-Boot now has a driver model, a unified model for drivers. 5111 Note that U-Boot now has a driver model, a unified model for drivers.
5112 If you are adding a new driver, plumb it into driver model. If there 5112 If you are adding a new driver, plumb it into driver model. If there
5113 is no uclass available, you are encouraged to create one. See 5113 is no uclass available, you are encouraged to create one. See
5114 doc/driver-model. 5114 doc/driver-model.
5115 5115
5116 5116
5117 Configuring the Linux kernel: 5117 Configuring the Linux kernel:
5118 ----------------------------- 5118 -----------------------------
5119 5119
5120 No specific requirements for U-Boot. Make sure you have some root 5120 No specific requirements for U-Boot. Make sure you have some root
5121 device (initial ramdisk, NFS) for your target system. 5121 device (initial ramdisk, NFS) for your target system.
5122 5122
5123 5123
5124 Building a Linux Image: 5124 Building a Linux Image:
5125 ----------------------- 5125 -----------------------
5126 5126
5127 With U-Boot, "normal" build targets like "zImage" or "bzImage" are 5127 With U-Boot, "normal" build targets like "zImage" or "bzImage" are
5128 not used. If you use recent kernel source, a new build target 5128 not used. If you use recent kernel source, a new build target
5129 "uImage" will exist which automatically builds an image usable by 5129 "uImage" will exist which automatically builds an image usable by
5130 U-Boot. Most older kernels also have support for a "pImage" target, 5130 U-Boot. Most older kernels also have support for a "pImage" target,
5131 which was introduced for our predecessor project PPCBoot and uses a 5131 which was introduced for our predecessor project PPCBoot and uses a
5132 100% compatible format. 5132 100% compatible format.
5133 5133
5134 Example: 5134 Example:
5135 5135
5136 make TQM850L_defconfig 5136 make TQM850L_defconfig
5137 make oldconfig 5137 make oldconfig
5138 make dep 5138 make dep
5139 make uImage 5139 make uImage
5140 5140
5141 The "uImage" build target uses a special tool (in 'tools/mkimage') to 5141 The "uImage" build target uses a special tool (in 'tools/mkimage') to
5142 encapsulate a compressed Linux kernel image with header information, 5142 encapsulate a compressed Linux kernel image with header information,
5143 CRC32 checksum etc. for use with U-Boot. This is what we are doing: 5143 CRC32 checksum etc. for use with U-Boot. This is what we are doing:
5144 5144
5145 * build a standard "vmlinux" kernel image (in ELF binary format): 5145 * build a standard "vmlinux" kernel image (in ELF binary format):
5146 5146
5147 * convert the kernel into a raw binary image: 5147 * convert the kernel into a raw binary image:
5148 5148
5149 ${CROSS_COMPILE}-objcopy -O binary \ 5149 ${CROSS_COMPILE}-objcopy -O binary \
5150 -R .note -R .comment \ 5150 -R .note -R .comment \
5151 -S vmlinux linux.bin 5151 -S vmlinux linux.bin
5152 5152
5153 * compress the binary image: 5153 * compress the binary image:
5154 5154
5155 gzip -9 linux.bin 5155 gzip -9 linux.bin
5156 5156
5157 * package compressed binary image for U-Boot: 5157 * package compressed binary image for U-Boot:
5158 5158
5159 mkimage -A ppc -O linux -T kernel -C gzip \ 5159 mkimage -A ppc -O linux -T kernel -C gzip \
5160 -a 0 -e 0 -n "Linux Kernel Image" \ 5160 -a 0 -e 0 -n "Linux Kernel Image" \
5161 -d linux.bin.gz uImage 5161 -d linux.bin.gz uImage
5162 5162
5163 5163
5164 The "mkimage" tool can also be used to create ramdisk images for use 5164 The "mkimage" tool can also be used to create ramdisk images for use
5165 with U-Boot, either separated from the Linux kernel image, or 5165 with U-Boot, either separated from the Linux kernel image, or
5166 combined into one file. "mkimage" encapsulates the images with a 64 5166 combined into one file. "mkimage" encapsulates the images with a 64
5167 byte header containing information about target architecture, 5167 byte header containing information about target architecture,
5168 operating system, image type, compression method, entry points, time 5168 operating system, image type, compression method, entry points, time
5169 stamp, CRC32 checksums, etc. 5169 stamp, CRC32 checksums, etc.
5170 5170
5171 "mkimage" can be called in two ways: to verify existing images and 5171 "mkimage" can be called in two ways: to verify existing images and
5172 print the header information, or to build new images. 5172 print the header information, or to build new images.
5173 5173
5174 In the first form (with "-l" option) mkimage lists the information 5174 In the first form (with "-l" option) mkimage lists the information
5175 contained in the header of an existing U-Boot image; this includes 5175 contained in the header of an existing U-Boot image; this includes
5176 checksum verification: 5176 checksum verification:
5177 5177
5178 tools/mkimage -l image 5178 tools/mkimage -l image
5179 -l ==> list image header information 5179 -l ==> list image header information
5180 5180
5181 The second form (with "-d" option) is used to build a U-Boot image 5181 The second form (with "-d" option) is used to build a U-Boot image
5182 from a "data file" which is used as image payload: 5182 from a "data file" which is used as image payload:
5183 5183
5184 tools/mkimage -A arch -O os -T type -C comp -a addr -e ep \ 5184 tools/mkimage -A arch -O os -T type -C comp -a addr -e ep \
5185 -n name -d data_file image 5185 -n name -d data_file image
5186 -A ==> set architecture to 'arch' 5186 -A ==> set architecture to 'arch'
5187 -O ==> set operating system to 'os' 5187 -O ==> set operating system to 'os'
5188 -T ==> set image type to 'type' 5188 -T ==> set image type to 'type'
5189 -C ==> set compression type 'comp' 5189 -C ==> set compression type 'comp'
5190 -a ==> set load address to 'addr' (hex) 5190 -a ==> set load address to 'addr' (hex)
5191 -e ==> set entry point to 'ep' (hex) 5191 -e ==> set entry point to 'ep' (hex)
5192 -n ==> set image name to 'name' 5192 -n ==> set image name to 'name'
5193 -d ==> use image data from 'datafile' 5193 -d ==> use image data from 'datafile'
5194 5194
5195 Right now, all Linux kernels for PowerPC systems use the same load 5195 Right now, all Linux kernels for PowerPC systems use the same load
5196 address (0x00000000), but the entry point address depends on the 5196 address (0x00000000), but the entry point address depends on the
5197 kernel version: 5197 kernel version:
5198 5198
5199 - 2.2.x kernels have the entry point at 0x0000000C, 5199 - 2.2.x kernels have the entry point at 0x0000000C,
5200 - 2.3.x and later kernels have the entry point at 0x00000000. 5200 - 2.3.x and later kernels have the entry point at 0x00000000.
5201 5201
5202 So a typical call to build a U-Boot image would read: 5202 So a typical call to build a U-Boot image would read:
5203 5203
5204 -> tools/mkimage -n '2.4.4 kernel for TQM850L' \ 5204 -> tools/mkimage -n '2.4.4 kernel for TQM850L' \
5205 > -A ppc -O linux -T kernel -C gzip -a 0 -e 0 \ 5205 > -A ppc -O linux -T kernel -C gzip -a 0 -e 0 \
5206 > -d /opt/elsk/ppc_8xx/usr/src/linux-2.4.4/arch/powerpc/coffboot/vmlinux.gz \ 5206 > -d /opt/elsk/ppc_8xx/usr/src/linux-2.4.4/arch/powerpc/coffboot/vmlinux.gz \
5207 > examples/uImage.TQM850L 5207 > examples/uImage.TQM850L
5208 Image Name: 2.4.4 kernel for TQM850L 5208 Image Name: 2.4.4 kernel for TQM850L
5209 Created: Wed Jul 19 02:34:59 2000 5209 Created: Wed Jul 19 02:34:59 2000
5210 Image Type: PowerPC Linux Kernel Image (gzip compressed) 5210 Image Type: PowerPC Linux Kernel Image (gzip compressed)
5211 Data Size: 335725 Bytes = 327.86 kB = 0.32 MB 5211 Data Size: 335725 Bytes = 327.86 kB = 0.32 MB
5212 Load Address: 0x00000000 5212 Load Address: 0x00000000
5213 Entry Point: 0x00000000 5213 Entry Point: 0x00000000
5214 5214
5215 To verify the contents of the image (or check for corruption): 5215 To verify the contents of the image (or check for corruption):
5216 5216
5217 -> tools/mkimage -l examples/uImage.TQM850L 5217 -> tools/mkimage -l examples/uImage.TQM850L
5218 Image Name: 2.4.4 kernel for TQM850L 5218 Image Name: 2.4.4 kernel for TQM850L
5219 Created: Wed Jul 19 02:34:59 2000 5219 Created: Wed Jul 19 02:34:59 2000
5220 Image Type: PowerPC Linux Kernel Image (gzip compressed) 5220 Image Type: PowerPC Linux Kernel Image (gzip compressed)
5221 Data Size: 335725 Bytes = 327.86 kB = 0.32 MB 5221 Data Size: 335725 Bytes = 327.86 kB = 0.32 MB
5222 Load Address: 0x00000000 5222 Load Address: 0x00000000
5223 Entry Point: 0x00000000 5223 Entry Point: 0x00000000
5224 5224
5225 NOTE: for embedded systems where boot time is critical you can trade 5225 NOTE: for embedded systems where boot time is critical you can trade
5226 speed for memory and install an UNCOMPRESSED image instead: this 5226 speed for memory and install an UNCOMPRESSED image instead: this
5227 needs more space in Flash, but boots much faster since it does not 5227 needs more space in Flash, but boots much faster since it does not
5228 need to be uncompressed: 5228 need to be uncompressed:
5229 5229
5230 -> gunzip /opt/elsk/ppc_8xx/usr/src/linux-2.4.4/arch/powerpc/coffboot/vmlinux.gz 5230 -> gunzip /opt/elsk/ppc_8xx/usr/src/linux-2.4.4/arch/powerpc/coffboot/vmlinux.gz
5231 -> tools/mkimage -n '2.4.4 kernel for TQM850L' \ 5231 -> tools/mkimage -n '2.4.4 kernel for TQM850L' \
5232 > -A ppc -O linux -T kernel -C none -a 0 -e 0 \ 5232 > -A ppc -O linux -T kernel -C none -a 0 -e 0 \
5233 > -d /opt/elsk/ppc_8xx/usr/src/linux-2.4.4/arch/powerpc/coffboot/vmlinux \ 5233 > -d /opt/elsk/ppc_8xx/usr/src/linux-2.4.4/arch/powerpc/coffboot/vmlinux \
5234 > examples/uImage.TQM850L-uncompressed 5234 > examples/uImage.TQM850L-uncompressed
5235 Image Name: 2.4.4 kernel for TQM850L 5235 Image Name: 2.4.4 kernel for TQM850L
5236 Created: Wed Jul 19 02:34:59 2000 5236 Created: Wed Jul 19 02:34:59 2000
5237 Image Type: PowerPC Linux Kernel Image (uncompressed) 5237 Image Type: PowerPC Linux Kernel Image (uncompressed)
5238 Data Size: 792160 Bytes = 773.59 kB = 0.76 MB 5238 Data Size: 792160 Bytes = 773.59 kB = 0.76 MB
5239 Load Address: 0x00000000 5239 Load Address: 0x00000000
5240 Entry Point: 0x00000000 5240 Entry Point: 0x00000000
5241 5241
5242 5242
5243 Similar you can build U-Boot images from a 'ramdisk.image.gz' file 5243 Similar you can build U-Boot images from a 'ramdisk.image.gz' file
5244 when your kernel is intended to use an initial ramdisk: 5244 when your kernel is intended to use an initial ramdisk:
5245 5245
5246 -> tools/mkimage -n 'Simple Ramdisk Image' \ 5246 -> tools/mkimage -n 'Simple Ramdisk Image' \
5247 > -A ppc -O linux -T ramdisk -C gzip \ 5247 > -A ppc -O linux -T ramdisk -C gzip \
5248 > -d /LinuxPPC/images/SIMPLE-ramdisk.image.gz examples/simple-initrd 5248 > -d /LinuxPPC/images/SIMPLE-ramdisk.image.gz examples/simple-initrd
5249 Image Name: Simple Ramdisk Image 5249 Image Name: Simple Ramdisk Image
5250 Created: Wed Jan 12 14:01:50 2000 5250 Created: Wed Jan 12 14:01:50 2000
5251 Image Type: PowerPC Linux RAMDisk Image (gzip compressed) 5251 Image Type: PowerPC Linux RAMDisk Image (gzip compressed)
5252 Data Size: 566530 Bytes = 553.25 kB = 0.54 MB 5252 Data Size: 566530 Bytes = 553.25 kB = 0.54 MB
5253 Load Address: 0x00000000 5253 Load Address: 0x00000000
5254 Entry Point: 0x00000000 5254 Entry Point: 0x00000000
5255 5255
5256 The "dumpimage" is a tool to disassemble images built by mkimage. Its "-i" 5256 The "dumpimage" is a tool to disassemble images built by mkimage. Its "-i"
5257 option performs the converse operation of the mkimage's second form (the "-d" 5257 option performs the converse operation of the mkimage's second form (the "-d"
5258 option). Given an image built by mkimage, the dumpimage extracts a "data file" 5258 option). Given an image built by mkimage, the dumpimage extracts a "data file"
5259 from the image: 5259 from the image:
5260 5260
5261 tools/dumpimage -i image -T type -p position data_file 5261 tools/dumpimage -i image -T type -p position data_file
5262 -i ==> extract from the 'image' a specific 'data_file' 5262 -i ==> extract from the 'image' a specific 'data_file'
5263 -T ==> set image type to 'type' 5263 -T ==> set image type to 'type'
5264 -p ==> 'position' (starting at 0) of the 'data_file' inside the 'image' 5264 -p ==> 'position' (starting at 0) of the 'data_file' inside the 'image'
5265 5265
5266 5266
5267 Installing a Linux Image: 5267 Installing a Linux Image:
5268 ------------------------- 5268 -------------------------
5269 5269
5270 To downloading a U-Boot image over the serial (console) interface, 5270 To downloading a U-Boot image over the serial (console) interface,
5271 you must convert the image to S-Record format: 5271 you must convert the image to S-Record format:
5272 5272
5273 objcopy -I binary -O srec examples/image examples/image.srec 5273 objcopy -I binary -O srec examples/image examples/image.srec
5274 5274
5275 The 'objcopy' does not understand the information in the U-Boot 5275 The 'objcopy' does not understand the information in the U-Boot
5276 image header, so the resulting S-Record file will be relative to 5276 image header, so the resulting S-Record file will be relative to
5277 address 0x00000000. To load it to a given address, you need to 5277 address 0x00000000. To load it to a given address, you need to
5278 specify the target address as 'offset' parameter with the 'loads' 5278 specify the target address as 'offset' parameter with the 'loads'
5279 command. 5279 command.
5280 5280
5281 Example: install the image to address 0x40100000 (which on the 5281 Example: install the image to address 0x40100000 (which on the
5282 TQM8xxL is in the first Flash bank): 5282 TQM8xxL is in the first Flash bank):
5283 5283
5284 => erase 40100000 401FFFFF 5284 => erase 40100000 401FFFFF
5285 5285
5286 .......... done 5286 .......... done
5287 Erased 8 sectors 5287 Erased 8 sectors
5288 5288
5289 => loads 40100000 5289 => loads 40100000
5290 ## Ready for S-Record download ... 5290 ## Ready for S-Record download ...
5291 ~>examples/image.srec 5291 ~>examples/image.srec
5292 1 2 3 4 5 6 7 8 9 10 11 12 13 ... 5292 1 2 3 4 5 6 7 8 9 10 11 12 13 ...
5293 ... 5293 ...
5294 15989 15990 15991 15992 5294 15989 15990 15991 15992
5295 [file transfer complete] 5295 [file transfer complete]
5296 [connected] 5296 [connected]
5297 ## Start Addr = 0x00000000 5297 ## Start Addr = 0x00000000
5298 5298
5299 5299
5300 You can check the success of the download using the 'iminfo' command; 5300 You can check the success of the download using the 'iminfo' command;
5301 this includes a checksum verification so you can be sure no data 5301 this includes a checksum verification so you can be sure no data
5302 corruption happened: 5302 corruption happened:
5303 5303
5304 => imi 40100000 5304 => imi 40100000
5305 5305
5306 ## Checking Image at 40100000 ... 5306 ## Checking Image at 40100000 ...
5307 Image Name: 2.2.13 for initrd on TQM850L 5307 Image Name: 2.2.13 for initrd on TQM850L
5308 Image Type: PowerPC Linux Kernel Image (gzip compressed) 5308 Image Type: PowerPC Linux Kernel Image (gzip compressed)
5309 Data Size: 335725 Bytes = 327 kB = 0 MB 5309 Data Size: 335725 Bytes = 327 kB = 0 MB
5310 Load Address: 00000000 5310 Load Address: 00000000
5311 Entry Point: 0000000c 5311 Entry Point: 0000000c
5312 Verifying Checksum ... OK 5312 Verifying Checksum ... OK
5313 5313
5314 5314
5315 Boot Linux: 5315 Boot Linux:
5316 ----------- 5316 -----------
5317 5317
5318 The "bootm" command is used to boot an application that is stored in 5318 The "bootm" command is used to boot an application that is stored in
5319 memory (RAM or Flash). In case of a Linux kernel image, the contents 5319 memory (RAM or Flash). In case of a Linux kernel image, the contents
5320 of the "bootargs" environment variable is passed to the kernel as 5320 of the "bootargs" environment variable is passed to the kernel as
5321 parameters. You can check and modify this variable using the 5321 parameters. You can check and modify this variable using the
5322 "printenv" and "setenv" commands: 5322 "printenv" and "setenv" commands:
5323 5323
5324 5324
5325 => printenv bootargs 5325 => printenv bootargs
5326 bootargs=root=/dev/ram 5326 bootargs=root=/dev/ram
5327 5327
5328 => setenv bootargs root=/dev/nfs rw nfsroot=10.0.0.2:/LinuxPPC nfsaddrs=10.0.0.99:10.0.0.2 5328 => setenv bootargs root=/dev/nfs rw nfsroot=10.0.0.2:/LinuxPPC nfsaddrs=10.0.0.99:10.0.0.2
5329 5329
5330 => printenv bootargs 5330 => printenv bootargs
5331 bootargs=root=/dev/nfs rw nfsroot=10.0.0.2:/LinuxPPC nfsaddrs=10.0.0.99:10.0.0.2 5331 bootargs=root=/dev/nfs rw nfsroot=10.0.0.2:/LinuxPPC nfsaddrs=10.0.0.99:10.0.0.2
5332 5332
5333 => bootm 40020000 5333 => bootm 40020000
5334 ## Booting Linux kernel at 40020000 ... 5334 ## Booting Linux kernel at 40020000 ...
5335 Image Name: 2.2.13 for NFS on TQM850L 5335 Image Name: 2.2.13 for NFS on TQM850L
5336 Image Type: PowerPC Linux Kernel Image (gzip compressed) 5336 Image Type: PowerPC Linux Kernel Image (gzip compressed)
5337 Data Size: 381681 Bytes = 372 kB = 0 MB 5337 Data Size: 381681 Bytes = 372 kB = 0 MB
5338 Load Address: 00000000 5338 Load Address: 00000000
5339 Entry Point: 0000000c 5339 Entry Point: 0000000c
5340 Verifying Checksum ... OK 5340 Verifying Checksum ... OK
5341 Uncompressing Kernel Image ... OK 5341 Uncompressing Kernel Image ... OK
5342 Linux version 2.2.13 (wd@denx.local.net) (gcc version 2.95.2 19991024 (release)) #1 Wed Jul 19 02:35:17 MEST 2000 5342 Linux version 2.2.13 (wd@denx.local.net) (gcc version 2.95.2 19991024 (release)) #1 Wed Jul 19 02:35:17 MEST 2000
5343 Boot arguments: root=/dev/nfs rw nfsroot=10.0.0.2:/LinuxPPC nfsaddrs=10.0.0.99:10.0.0.2 5343 Boot arguments: root=/dev/nfs rw nfsroot=10.0.0.2:/LinuxPPC nfsaddrs=10.0.0.99:10.0.0.2
5344 time_init: decrementer frequency = 187500000/60 5344 time_init: decrementer frequency = 187500000/60
5345 Calibrating delay loop... 49.77 BogoMIPS 5345 Calibrating delay loop... 49.77 BogoMIPS
5346 Memory: 15208k available (700k kernel code, 444k data, 32k init) [c0000000,c1000000] 5346 Memory: 15208k available (700k kernel code, 444k data, 32k init) [c0000000,c1000000]
5347 ... 5347 ...
5348 5348
5349 If you want to boot a Linux kernel with initial RAM disk, you pass 5349 If you want to boot a Linux kernel with initial RAM disk, you pass
5350 the memory addresses of both the kernel and the initrd image (PPBCOOT 5350 the memory addresses of both the kernel and the initrd image (PPBCOOT
5351 format!) to the "bootm" command: 5351 format!) to the "bootm" command:
5352 5352
5353 => imi 40100000 40200000 5353 => imi 40100000 40200000
5354 5354
5355 ## Checking Image at 40100000 ... 5355 ## Checking Image at 40100000 ...
5356 Image Name: 2.2.13 for initrd on TQM850L 5356 Image Name: 2.2.13 for initrd on TQM850L
5357 Image Type: PowerPC Linux Kernel Image (gzip compressed) 5357 Image Type: PowerPC Linux Kernel Image (gzip compressed)
5358 Data Size: 335725 Bytes = 327 kB = 0 MB 5358 Data Size: 335725 Bytes = 327 kB = 0 MB
5359 Load Address: 00000000 5359 Load Address: 00000000
5360 Entry Point: 0000000c 5360 Entry Point: 0000000c
5361 Verifying Checksum ... OK 5361 Verifying Checksum ... OK
5362 5362
5363 ## Checking Image at 40200000 ... 5363 ## Checking Image at 40200000 ...
5364 Image Name: Simple Ramdisk Image 5364 Image Name: Simple Ramdisk Image
5365 Image Type: PowerPC Linux RAMDisk Image (gzip compressed) 5365 Image Type: PowerPC Linux RAMDisk Image (gzip compressed)
5366 Data Size: 566530 Bytes = 553 kB = 0 MB 5366 Data Size: 566530 Bytes = 553 kB = 0 MB
5367 Load Address: 00000000 5367 Load Address: 00000000
5368 Entry Point: 00000000 5368 Entry Point: 00000000
5369 Verifying Checksum ... OK 5369 Verifying Checksum ... OK
5370 5370
5371 => bootm 40100000 40200000 5371 => bootm 40100000 40200000
5372 ## Booting Linux kernel at 40100000 ... 5372 ## Booting Linux kernel at 40100000 ...
5373 Image Name: 2.2.13 for initrd on TQM850L 5373 Image Name: 2.2.13 for initrd on TQM850L
5374 Image Type: PowerPC Linux Kernel Image (gzip compressed) 5374 Image Type: PowerPC Linux Kernel Image (gzip compressed)
5375 Data Size: 335725 Bytes = 327 kB = 0 MB 5375 Data Size: 335725 Bytes = 327 kB = 0 MB
5376 Load Address: 00000000 5376 Load Address: 00000000
5377 Entry Point: 0000000c 5377 Entry Point: 0000000c
5378 Verifying Checksum ... OK 5378 Verifying Checksum ... OK
5379 Uncompressing Kernel Image ... OK 5379 Uncompressing Kernel Image ... OK
5380 ## Loading RAMDisk Image at 40200000 ... 5380 ## Loading RAMDisk Image at 40200000 ...
5381 Image Name: Simple Ramdisk Image 5381 Image Name: Simple Ramdisk Image
5382 Image Type: PowerPC Linux RAMDisk Image (gzip compressed) 5382 Image Type: PowerPC Linux RAMDisk Image (gzip compressed)
5383 Data Size: 566530 Bytes = 553 kB = 0 MB 5383 Data Size: 566530 Bytes = 553 kB = 0 MB
5384 Load Address: 00000000 5384 Load Address: 00000000
5385 Entry Point: 00000000 5385 Entry Point: 00000000
5386 Verifying Checksum ... OK 5386 Verifying Checksum ... OK
5387 Loading Ramdisk ... OK 5387 Loading Ramdisk ... OK
5388 Linux version 2.2.13 (wd@denx.local.net) (gcc version 2.95.2 19991024 (release)) #1 Wed Jul 19 02:32:08 MEST 2000 5388 Linux version 2.2.13 (wd@denx.local.net) (gcc version 2.95.2 19991024 (release)) #1 Wed Jul 19 02:32:08 MEST 2000
5389 Boot arguments: root=/dev/ram 5389 Boot arguments: root=/dev/ram
5390 time_init: decrementer frequency = 187500000/60 5390 time_init: decrementer frequency = 187500000/60
5391 Calibrating delay loop... 49.77 BogoMIPS 5391 Calibrating delay loop... 49.77 BogoMIPS
5392 ... 5392 ...
5393 RAMDISK: Compressed image found at block 0 5393 RAMDISK: Compressed image found at block 0
5394 VFS: Mounted root (ext2 filesystem). 5394 VFS: Mounted root (ext2 filesystem).
5395 5395
5396 bash# 5396 bash#
5397 5397
5398 Boot Linux and pass a flat device tree: 5398 Boot Linux and pass a flat device tree:
5399 ----------- 5399 -----------
5400 5400
5401 First, U-Boot must be compiled with the appropriate defines. See the section 5401 First, U-Boot must be compiled with the appropriate defines. See the section
5402 titled "Linux Kernel Interface" above for a more in depth explanation. The 5402 titled "Linux Kernel Interface" above for a more in depth explanation. The
5403 following is an example of how to start a kernel and pass an updated 5403 following is an example of how to start a kernel and pass an updated
5404 flat device tree: 5404 flat device tree:
5405 5405
5406 => print oftaddr 5406 => print oftaddr
5407 oftaddr=0x300000 5407 oftaddr=0x300000
5408 => print oft 5408 => print oft
5409 oft=oftrees/mpc8540ads.dtb 5409 oft=oftrees/mpc8540ads.dtb
5410 => tftp $oftaddr $oft 5410 => tftp $oftaddr $oft
5411 Speed: 1000, full duplex 5411 Speed: 1000, full duplex
5412 Using TSEC0 device 5412 Using TSEC0 device
5413 TFTP from server 192.168.1.1; our IP address is 192.168.1.101 5413 TFTP from server 192.168.1.1; our IP address is 192.168.1.101
5414 Filename 'oftrees/mpc8540ads.dtb'. 5414 Filename 'oftrees/mpc8540ads.dtb'.
5415 Load address: 0x300000 5415 Load address: 0x300000
5416 Loading: # 5416 Loading: #
5417 done 5417 done
5418 Bytes transferred = 4106 (100a hex) 5418 Bytes transferred = 4106 (100a hex)
5419 => tftp $loadaddr $bootfile 5419 => tftp $loadaddr $bootfile
5420 Speed: 1000, full duplex 5420 Speed: 1000, full duplex
5421 Using TSEC0 device 5421 Using TSEC0 device
5422 TFTP from server 192.168.1.1; our IP address is 192.168.1.2 5422 TFTP from server 192.168.1.1; our IP address is 192.168.1.2
5423 Filename 'uImage'. 5423 Filename 'uImage'.
5424 Load address: 0x200000 5424 Load address: 0x200000
5425 Loading:############ 5425 Loading:############
5426 done 5426 done
5427 Bytes transferred = 1029407 (fb51f hex) 5427 Bytes transferred = 1029407 (fb51f hex)
5428 => print loadaddr 5428 => print loadaddr
5429 loadaddr=200000 5429 loadaddr=200000
5430 => print oftaddr 5430 => print oftaddr
5431 oftaddr=0x300000 5431 oftaddr=0x300000
5432 => bootm $loadaddr - $oftaddr 5432 => bootm $loadaddr - $oftaddr
5433 ## Booting image at 00200000 ... 5433 ## Booting image at 00200000 ...
5434 Image Name: Linux-2.6.17-dirty 5434 Image Name: Linux-2.6.17-dirty
5435 Image Type: PowerPC Linux Kernel Image (gzip compressed) 5435 Image Type: PowerPC Linux Kernel Image (gzip compressed)
5436 Data Size: 1029343 Bytes = 1005.2 kB 5436 Data Size: 1029343 Bytes = 1005.2 kB
5437 Load Address: 00000000 5437 Load Address: 00000000
5438 Entry Point: 00000000 5438 Entry Point: 00000000
5439 Verifying Checksum ... OK 5439 Verifying Checksum ... OK
5440 Uncompressing Kernel Image ... OK 5440 Uncompressing Kernel Image ... OK
5441 Booting using flat device tree at 0x300000 5441 Booting using flat device tree at 0x300000
5442 Using MPC85xx ADS machine description 5442 Using MPC85xx ADS machine description
5443 Memory CAM mapping: CAM0=256Mb, CAM1=256Mb, CAM2=0Mb residual: 0Mb 5443 Memory CAM mapping: CAM0=256Mb, CAM1=256Mb, CAM2=0Mb residual: 0Mb
5444 [snip] 5444 [snip]
5445 5445
5446 5446
5447 More About U-Boot Image Types: 5447 More About U-Boot Image Types:
5448 ------------------------------ 5448 ------------------------------
5449 5449
5450 U-Boot supports the following image types: 5450 U-Boot supports the following image types:
5451 5451
5452 "Standalone Programs" are directly runnable in the environment 5452 "Standalone Programs" are directly runnable in the environment
5453 provided by U-Boot; it is expected that (if they behave 5453 provided by U-Boot; it is expected that (if they behave
5454 well) you can continue to work in U-Boot after return from 5454 well) you can continue to work in U-Boot after return from
5455 the Standalone Program. 5455 the Standalone Program.
5456 "OS Kernel Images" are usually images of some Embedded OS which 5456 "OS Kernel Images" are usually images of some Embedded OS which
5457 will take over control completely. Usually these programs 5457 will take over control completely. Usually these programs
5458 will install their own set of exception handlers, device 5458 will install their own set of exception handlers, device
5459 drivers, set up the MMU, etc. - this means, that you cannot 5459 drivers, set up the MMU, etc. - this means, that you cannot
5460 expect to re-enter U-Boot except by resetting the CPU. 5460 expect to re-enter U-Boot except by resetting the CPU.
5461 "RAMDisk Images" are more or less just data blocks, and their 5461 "RAMDisk Images" are more or less just data blocks, and their
5462 parameters (address, size) are passed to an OS kernel that is 5462 parameters (address, size) are passed to an OS kernel that is
5463 being started. 5463 being started.
5464 "Multi-File Images" contain several images, typically an OS 5464 "Multi-File Images" contain several images, typically an OS
5465 (Linux) kernel image and one or more data images like 5465 (Linux) kernel image and one or more data images like
5466 RAMDisks. This construct is useful for instance when you want 5466 RAMDisks. This construct is useful for instance when you want
5467 to boot over the network using BOOTP etc., where the boot 5467 to boot over the network using BOOTP etc., where the boot
5468 server provides just a single image file, but you want to get 5468 server provides just a single image file, but you want to get
5469 for instance an OS kernel and a RAMDisk image. 5469 for instance an OS kernel and a RAMDisk image.
5470 5470
5471 "Multi-File Images" start with a list of image sizes, each 5471 "Multi-File Images" start with a list of image sizes, each
5472 image size (in bytes) specified by an "uint32_t" in network 5472 image size (in bytes) specified by an "uint32_t" in network
5473 byte order. This list is terminated by an "(uint32_t)0". 5473 byte order. This list is terminated by an "(uint32_t)0".
5474 Immediately after the terminating 0 follow the images, one by 5474 Immediately after the terminating 0 follow the images, one by
5475 one, all aligned on "uint32_t" boundaries (size rounded up to 5475 one, all aligned on "uint32_t" boundaries (size rounded up to
5476 a multiple of 4 bytes). 5476 a multiple of 4 bytes).
5477 5477
5478 "Firmware Images" are binary images containing firmware (like 5478 "Firmware Images" are binary images containing firmware (like
5479 U-Boot or FPGA images) which usually will be programmed to 5479 U-Boot or FPGA images) which usually will be programmed to
5480 flash memory. 5480 flash memory.
5481 5481
5482 "Script files" are command sequences that will be executed by 5482 "Script files" are command sequences that will be executed by
5483 U-Boot's command interpreter; this feature is especially 5483 U-Boot's command interpreter; this feature is especially
5484 useful when you configure U-Boot to use a real shell (hush) 5484 useful when you configure U-Boot to use a real shell (hush)
5485 as command interpreter. 5485 as command interpreter.
5486 5486
5487 Booting the Linux zImage: 5487 Booting the Linux zImage:
5488 ------------------------- 5488 -------------------------
5489 5489
5490 On some platforms, it's possible to boot Linux zImage. This is done 5490 On some platforms, it's possible to boot Linux zImage. This is done
5491 using the "bootz" command. The syntax of "bootz" command is the same 5491 using the "bootz" command. The syntax of "bootz" command is the same
5492 as the syntax of "bootm" command. 5492 as the syntax of "bootm" command.
5493 5493
5494 Note, defining the CONFIG_SUPPORT_RAW_INITRD allows user to supply 5494 Note, defining the CONFIG_SUPPORT_RAW_INITRD allows user to supply
5495 kernel with raw initrd images. The syntax is slightly different, the 5495 kernel with raw initrd images. The syntax is slightly different, the
5496 address of the initrd must be augmented by it's size, in the following 5496 address of the initrd must be augmented by it's size, in the following
5497 format: "<initrd addres>:<initrd size>". 5497 format: "<initrd addres>:<initrd size>".
5498 5498
5499 5499
5500 Standalone HOWTO: 5500 Standalone HOWTO:
5501 ================= 5501 =================
5502 5502
5503 One of the features of U-Boot is that you can dynamically load and 5503 One of the features of U-Boot is that you can dynamically load and
5504 run "standalone" applications, which can use some resources of 5504 run "standalone" applications, which can use some resources of
5505 U-Boot like console I/O functions or interrupt services. 5505 U-Boot like console I/O functions or interrupt services.
5506 5506
5507 Two simple examples are included with the sources: 5507 Two simple examples are included with the sources:
5508 5508
5509 "Hello World" Demo: 5509 "Hello World" Demo:
5510 ------------------- 5510 -------------------
5511 5511
5512 'examples/hello_world.c' contains a small "Hello World" Demo 5512 'examples/hello_world.c' contains a small "Hello World" Demo
5513 application; it is automatically compiled when you build U-Boot. 5513 application; it is automatically compiled when you build U-Boot.
5514 It's configured to run at address 0x00040004, so you can play with it 5514 It's configured to run at address 0x00040004, so you can play with it
5515 like that: 5515 like that:
5516 5516
5517 => loads 5517 => loads
5518 ## Ready for S-Record download ... 5518 ## Ready for S-Record download ...
5519 ~>examples/hello_world.srec 5519 ~>examples/hello_world.srec
5520 1 2 3 4 5 6 7 8 9 10 11 ... 5520 1 2 3 4 5 6 7 8 9 10 11 ...
5521 [file transfer complete] 5521 [file transfer complete]
5522 [connected] 5522 [connected]
5523 ## Start Addr = 0x00040004 5523 ## Start Addr = 0x00040004
5524 5524
5525 => go 40004 Hello World! This is a test. 5525 => go 40004 Hello World! This is a test.
5526 ## Starting application at 0x00040004 ... 5526 ## Starting application at 0x00040004 ...
5527 Hello World 5527 Hello World
5528 argc = 7 5528 argc = 7
5529 argv[0] = "40004" 5529 argv[0] = "40004"
5530 argv[1] = "Hello" 5530 argv[1] = "Hello"
5531 argv[2] = "World!" 5531 argv[2] = "World!"
5532 argv[3] = "This" 5532 argv[3] = "This"
5533 argv[4] = "is" 5533 argv[4] = "is"
5534 argv[5] = "a" 5534 argv[5] = "a"
5535 argv[6] = "test." 5535 argv[6] = "test."
5536 argv[7] = "<NULL>" 5536 argv[7] = "<NULL>"
5537 Hit any key to exit ... 5537 Hit any key to exit ...
5538 5538
5539 ## Application terminated, rc = 0x0 5539 ## Application terminated, rc = 0x0
5540 5540
5541 Another example, which demonstrates how to register a CPM interrupt 5541 Another example, which demonstrates how to register a CPM interrupt
5542 handler with the U-Boot code, can be found in 'examples/timer.c'. 5542 handler with the U-Boot code, can be found in 'examples/timer.c'.
5543 Here, a CPM timer is set up to generate an interrupt every second. 5543 Here, a CPM timer is set up to generate an interrupt every second.
5544 The interrupt service routine is trivial, just printing a '.' 5544 The interrupt service routine is trivial, just printing a '.'
5545 character, but this is just a demo program. The application can be 5545 character, but this is just a demo program. The application can be
5546 controlled by the following keys: 5546 controlled by the following keys:
5547 5547
5548 ? - print current values og the CPM Timer registers 5548 ? - print current values og the CPM Timer registers
5549 b - enable interrupts and start timer 5549 b - enable interrupts and start timer
5550 e - stop timer and disable interrupts 5550 e - stop timer and disable interrupts
5551 q - quit application 5551 q - quit application
5552 5552
5553 => loads 5553 => loads
5554 ## Ready for S-Record download ... 5554 ## Ready for S-Record download ...
5555 ~>examples/timer.srec 5555 ~>examples/timer.srec
5556 1 2 3 4 5 6 7 8 9 10 11 ... 5556 1 2 3 4 5 6 7 8 9 10 11 ...
5557 [file transfer complete] 5557 [file transfer complete]
5558 [connected] 5558 [connected]
5559 ## Start Addr = 0x00040004 5559 ## Start Addr = 0x00040004
5560 5560
5561 => go 40004 5561 => go 40004
5562 ## Starting application at 0x00040004 ... 5562 ## Starting application at 0x00040004 ...
5563 TIMERS=0xfff00980 5563 TIMERS=0xfff00980
5564 Using timer 1 5564 Using timer 1
5565 tgcr @ 0xfff00980, tmr @ 0xfff00990, trr @ 0xfff00994, tcr @ 0xfff00998, tcn @ 0xfff0099c, ter @ 0xfff009b0 5565 tgcr @ 0xfff00980, tmr @ 0xfff00990, trr @ 0xfff00994, tcr @ 0xfff00998, tcn @ 0xfff0099c, ter @ 0xfff009b0
5566 5566
5567 Hit 'b': 5567 Hit 'b':
5568 [q, b, e, ?] Set interval 1000000 us 5568 [q, b, e, ?] Set interval 1000000 us
5569 Enabling timer 5569 Enabling timer
5570 Hit '?': 5570 Hit '?':
5571 [q, b, e, ?] ........ 5571 [q, b, e, ?] ........
5572 tgcr=0x1, tmr=0xff1c, trr=0x3d09, tcr=0x0, tcn=0xef6, ter=0x0 5572 tgcr=0x1, tmr=0xff1c, trr=0x3d09, tcr=0x0, tcn=0xef6, ter=0x0
5573 Hit '?': 5573 Hit '?':
5574 [q, b, e, ?] . 5574 [q, b, e, ?] .
5575 tgcr=0x1, tmr=0xff1c, trr=0x3d09, tcr=0x0, tcn=0x2ad4, ter=0x0 5575 tgcr=0x1, tmr=0xff1c, trr=0x3d09, tcr=0x0, tcn=0x2ad4, ter=0x0
5576 Hit '?': 5576 Hit '?':
5577 [q, b, e, ?] . 5577 [q, b, e, ?] .
5578 tgcr=0x1, tmr=0xff1c, trr=0x3d09, tcr=0x0, tcn=0x1efc, ter=0x0 5578 tgcr=0x1, tmr=0xff1c, trr=0x3d09, tcr=0x0, tcn=0x1efc, ter=0x0
5579 Hit '?': 5579 Hit '?':
5580 [q, b, e, ?] . 5580 [q, b, e, ?] .
5581 tgcr=0x1, tmr=0xff1c, trr=0x3d09, tcr=0x0, tcn=0x169d, ter=0x0 5581 tgcr=0x1, tmr=0xff1c, trr=0x3d09, tcr=0x0, tcn=0x169d, ter=0x0
5582 Hit 'e': 5582 Hit 'e':
5583 [q, b, e, ?] ...Stopping timer 5583 [q, b, e, ?] ...Stopping timer
5584 Hit 'q': 5584 Hit 'q':
5585 [q, b, e, ?] ## Application terminated, rc = 0x0 5585 [q, b, e, ?] ## Application terminated, rc = 0x0
5586 5586
5587 5587
5588 Minicom warning: 5588 Minicom warning:
5589 ================ 5589 ================
5590 5590
5591 Over time, many people have reported problems when trying to use the 5591 Over time, many people have reported problems when trying to use the
5592 "minicom" terminal emulation program for serial download. I (wd) 5592 "minicom" terminal emulation program for serial download. I (wd)
5593 consider minicom to be broken, and recommend not to use it. Under 5593 consider minicom to be broken, and recommend not to use it. Under
5594 Unix, I recommend to use C-Kermit for general purpose use (and 5594 Unix, I recommend to use C-Kermit for general purpose use (and
5595 especially for kermit binary protocol download ("loadb" command), and 5595 especially for kermit binary protocol download ("loadb" command), and
5596 use "cu" for S-Record download ("loads" command). See 5596 use "cu" for S-Record download ("loads" command). See
5597 http://www.denx.de/wiki/view/DULG/SystemSetup#Section_4.3. 5597 http://www.denx.de/wiki/view/DULG/SystemSetup#Section_4.3.
5598 for help with kermit. 5598 for help with kermit.
5599 5599
5600 5600
5601 Nevertheless, if you absolutely want to use it try adding this 5601 Nevertheless, if you absolutely want to use it try adding this
5602 configuration to your "File transfer protocols" section: 5602 configuration to your "File transfer protocols" section:
5603 5603
5604 Name Program Name U/D FullScr IO-Red. Multi 5604 Name Program Name U/D FullScr IO-Red. Multi
5605 X kermit /usr/bin/kermit -i -l %l -s Y U Y N N 5605 X kermit /usr/bin/kermit -i -l %l -s Y U Y N N
5606 Y kermit /usr/bin/kermit -i -l %l -r N D Y N N 5606 Y kermit /usr/bin/kermit -i -l %l -r N D Y N N
5607 5607
5608 5608
5609 NetBSD Notes: 5609 NetBSD Notes:
5610 ============= 5610 =============
5611 5611
5612 Starting at version 0.9.2, U-Boot supports NetBSD both as host 5612 Starting at version 0.9.2, U-Boot supports NetBSD both as host
5613 (build U-Boot) and target system (boots NetBSD/mpc8xx). 5613 (build U-Boot) and target system (boots NetBSD/mpc8xx).
5614 5614
5615 Building requires a cross environment; it is known to work on 5615 Building requires a cross environment; it is known to work on
5616 NetBSD/i386 with the cross-powerpc-netbsd-1.3 package (you will also 5616 NetBSD/i386 with the cross-powerpc-netbsd-1.3 package (you will also
5617 need gmake since the Makefiles are not compatible with BSD make). 5617 need gmake since the Makefiles are not compatible with BSD make).
5618 Note that the cross-powerpc package does not install include files; 5618 Note that the cross-powerpc package does not install include files;
5619 attempting to build U-Boot will fail because <machine/ansi.h> is 5619 attempting to build U-Boot will fail because <machine/ansi.h> is
5620 missing. This file has to be installed and patched manually: 5620 missing. This file has to be installed and patched manually:
5621 5621
5622 # cd /usr/pkg/cross/powerpc-netbsd/include 5622 # cd /usr/pkg/cross/powerpc-netbsd/include
5623 # mkdir powerpc 5623 # mkdir powerpc
5624 # ln -s powerpc machine 5624 # ln -s powerpc machine
5625 # cp /usr/src/sys/arch/powerpc/include/ansi.h powerpc/ansi.h 5625 # cp /usr/src/sys/arch/powerpc/include/ansi.h powerpc/ansi.h
5626 # ${EDIT} powerpc/ansi.h ## must remove __va_list, _BSD_VA_LIST 5626 # ${EDIT} powerpc/ansi.h ## must remove __va_list, _BSD_VA_LIST
5627 5627
5628 Native builds *don't* work due to incompatibilities between native 5628 Native builds *don't* work due to incompatibilities between native
5629 and U-Boot include files. 5629 and U-Boot include files.
5630 5630
5631 Booting assumes that (the first part of) the image booted is a 5631 Booting assumes that (the first part of) the image booted is a
5632 stage-2 loader which in turn loads and then invokes the kernel 5632 stage-2 loader which in turn loads and then invokes the kernel
5633 proper. Loader sources will eventually appear in the NetBSD source 5633 proper. Loader sources will eventually appear in the NetBSD source
5634 tree (probably in sys/arc/mpc8xx/stand/u-boot_stage2/); in the 5634 tree (probably in sys/arc/mpc8xx/stand/u-boot_stage2/); in the
5635 meantime, see ftp://ftp.denx.de/pub/u-boot/ppcboot_stage2.tar.gz 5635 meantime, see ftp://ftp.denx.de/pub/u-boot/ppcboot_stage2.tar.gz
5636 5636
5637 5637
5638 Implementation Internals: 5638 Implementation Internals:
5639 ========================= 5639 =========================
5640 5640
5641 The following is not intended to be a complete description of every 5641 The following is not intended to be a complete description of every
5642 implementation detail. However, it should help to understand the 5642 implementation detail. However, it should help to understand the
5643 inner workings of U-Boot and make it easier to port it to custom 5643 inner workings of U-Boot and make it easier to port it to custom
5644 hardware. 5644 hardware.
5645 5645
5646 5646
5647 Initial Stack, Global Data: 5647 Initial Stack, Global Data:
5648 --------------------------- 5648 ---------------------------
5649 5649
5650 The implementation of U-Boot is complicated by the fact that U-Boot 5650 The implementation of U-Boot is complicated by the fact that U-Boot
5651 starts running out of ROM (flash memory), usually without access to 5651 starts running out of ROM (flash memory), usually without access to
5652 system RAM (because the memory controller is not initialized yet). 5652 system RAM (because the memory controller is not initialized yet).
5653 This means that we don't have writable Data or BSS segments, and BSS 5653 This means that we don't have writable Data or BSS segments, and BSS
5654 is not initialized as zero. To be able to get a C environment working 5654 is not initialized as zero. To be able to get a C environment working
5655 at all, we have to allocate at least a minimal stack. Implementation 5655 at all, we have to allocate at least a minimal stack. Implementation
5656 options for this are defined and restricted by the CPU used: Some CPU 5656 options for this are defined and restricted by the CPU used: Some CPU
5657 models provide on-chip memory (like the IMMR area on MPC8xx and 5657 models provide on-chip memory (like the IMMR area on MPC8xx and
5658 MPC826x processors), on others (parts of) the data cache can be 5658 MPC826x processors), on others (parts of) the data cache can be
5659 locked as (mis-) used as memory, etc. 5659 locked as (mis-) used as memory, etc.
5660 5660
5661 Chris Hallinan posted a good summary of these issues to the 5661 Chris Hallinan posted a good summary of these issues to the
5662 U-Boot mailing list: 5662 U-Boot mailing list:
5663 5663
5664 Subject: RE: [U-Boot-Users] RE: More On Memory Bank x (nothingness)? 5664 Subject: RE: [U-Boot-Users] RE: More On Memory Bank x (nothingness)?
5665 From: "Chris Hallinan" <clh@net1plus.com> 5665 From: "Chris Hallinan" <clh@net1plus.com>
5666 Date: Mon, 10 Feb 2003 16:43:46 -0500 (22:43 MET) 5666 Date: Mon, 10 Feb 2003 16:43:46 -0500 (22:43 MET)
5667 ... 5667 ...
5668 5668
5669 Correct me if I'm wrong, folks, but the way I understand it 5669 Correct me if I'm wrong, folks, but the way I understand it
5670 is this: Using DCACHE as initial RAM for Stack, etc, does not 5670 is this: Using DCACHE as initial RAM for Stack, etc, does not
5671 require any physical RAM backing up the cache. The cleverness 5671 require any physical RAM backing up the cache. The cleverness
5672 is that the cache is being used as a temporary supply of 5672 is that the cache is being used as a temporary supply of
5673 necessary storage before the SDRAM controller is setup. It's 5673 necessary storage before the SDRAM controller is setup. It's
5674 beyond the scope of this list to explain the details, but you 5674 beyond the scope of this list to explain the details, but you
5675 can see how this works by studying the cache architecture and 5675 can see how this works by studying the cache architecture and
5676 operation in the architecture and processor-specific manuals. 5676 operation in the architecture and processor-specific manuals.
5677 5677
5678 OCM is On Chip Memory, which I believe the 405GP has 4K. It 5678 OCM is On Chip Memory, which I believe the 405GP has 4K. It
5679 is another option for the system designer to use as an 5679 is another option for the system designer to use as an
5680 initial stack/RAM area prior to SDRAM being available. Either 5680 initial stack/RAM area prior to SDRAM being available. Either
5681 option should work for you. Using CS 4 should be fine if your 5681 option should work for you. Using CS 4 should be fine if your
5682 board designers haven't used it for something that would 5682 board designers haven't used it for something that would
5683 cause you grief during the initial boot! It is frequently not 5683 cause you grief during the initial boot! It is frequently not
5684 used. 5684 used.
5685 5685
5686 CONFIG_SYS_INIT_RAM_ADDR should be somewhere that won't interfere 5686 CONFIG_SYS_INIT_RAM_ADDR should be somewhere that won't interfere
5687 with your processor/board/system design. The default value 5687 with your processor/board/system design. The default value
5688 you will find in any recent u-boot distribution in 5688 you will find in any recent u-boot distribution in
5689 walnut.h should work for you. I'd set it to a value larger 5689 walnut.h should work for you. I'd set it to a value larger
5690 than your SDRAM module. If you have a 64MB SDRAM module, set 5690 than your SDRAM module. If you have a 64MB SDRAM module, set
5691 it above 400_0000. Just make sure your board has no resources 5691 it above 400_0000. Just make sure your board has no resources
5692 that are supposed to respond to that address! That code in 5692 that are supposed to respond to that address! That code in
5693 start.S has been around a while and should work as is when 5693 start.S has been around a while and should work as is when
5694 you get the config right. 5694 you get the config right.
5695 5695
5696 -Chris Hallinan 5696 -Chris Hallinan
5697 DS4.COM, Inc. 5697 DS4.COM, Inc.
5698 5698
5699 It is essential to remember this, since it has some impact on the C 5699 It is essential to remember this, since it has some impact on the C
5700 code for the initialization procedures: 5700 code for the initialization procedures:
5701 5701
5702 * Initialized global data (data segment) is read-only. Do not attempt 5702 * Initialized global data (data segment) is read-only. Do not attempt
5703 to write it. 5703 to write it.
5704 5704
5705 * Do not use any uninitialized global data (or implicitly initialized 5705 * Do not use any uninitialized global data (or implicitly initialized
5706 as zero data - BSS segment) at all - this is undefined, initiali- 5706 as zero data - BSS segment) at all - this is undefined, initiali-
5707 zation is performed later (when relocating to RAM). 5707 zation is performed later (when relocating to RAM).
5708 5708
5709 * Stack space is very limited. Avoid big data buffers or things like 5709 * Stack space is very limited. Avoid big data buffers or things like
5710 that. 5710 that.
5711 5711
5712 Having only the stack as writable memory limits means we cannot use 5712 Having only the stack as writable memory limits means we cannot use
5713 normal global data to share information between the code. But it 5713 normal global data to share information between the code. But it
5714 turned out that the implementation of U-Boot can be greatly 5714 turned out that the implementation of U-Boot can be greatly
5715 simplified by making a global data structure (gd_t) available to all 5715 simplified by making a global data structure (gd_t) available to all
5716 functions. We could pass a pointer to this data as argument to _all_ 5716 functions. We could pass a pointer to this data as argument to _all_
5717 functions, but this would bloat the code. Instead we use a feature of 5717 functions, but this would bloat the code. Instead we use a feature of
5718 the GCC compiler (Global Register Variables) to share the data: we 5718 the GCC compiler (Global Register Variables) to share the data: we
5719 place a pointer (gd) to the global data into a register which we 5719 place a pointer (gd) to the global data into a register which we
5720 reserve for this purpose. 5720 reserve for this purpose.
5721 5721
5722 When choosing a register for such a purpose we are restricted by the 5722 When choosing a register for such a purpose we are restricted by the
5723 relevant (E)ABI specifications for the current architecture, and by 5723 relevant (E)ABI specifications for the current architecture, and by
5724 GCC's implementation. 5724 GCC's implementation.
5725 5725
5726 For PowerPC, the following registers have specific use: 5726 For PowerPC, the following registers have specific use:
5727 R1: stack pointer 5727 R1: stack pointer
5728 R2: reserved for system use 5728 R2: reserved for system use
5729 R3-R4: parameter passing and return values 5729 R3-R4: parameter passing and return values
5730 R5-R10: parameter passing 5730 R5-R10: parameter passing
5731 R13: small data area pointer 5731 R13: small data area pointer
5732 R30: GOT pointer 5732 R30: GOT pointer
5733 R31: frame pointer 5733 R31: frame pointer
5734 5734
5735 (U-Boot also uses R12 as internal GOT pointer. r12 5735 (U-Boot also uses R12 as internal GOT pointer. r12
5736 is a volatile register so r12 needs to be reset when 5736 is a volatile register so r12 needs to be reset when
5737 going back and forth between asm and C) 5737 going back and forth between asm and C)
5738 5738
5739 ==> U-Boot will use R2 to hold a pointer to the global data 5739 ==> U-Boot will use R2 to hold a pointer to the global data
5740 5740
5741 Note: on PPC, we could use a static initializer (since the 5741 Note: on PPC, we could use a static initializer (since the
5742 address of the global data structure is known at compile time), 5742 address of the global data structure is known at compile time),
5743 but it turned out that reserving a register results in somewhat 5743 but it turned out that reserving a register results in somewhat
5744 smaller code - although the code savings are not that big (on 5744 smaller code - although the code savings are not that big (on
5745 average for all boards 752 bytes for the whole U-Boot image, 5745 average for all boards 752 bytes for the whole U-Boot image,
5746 624 text + 127 data). 5746 624 text + 127 data).
5747 5747
5748 On ARM, the following registers are used: 5748 On ARM, the following registers are used:
5749 5749
5750 R0: function argument word/integer result 5750 R0: function argument word/integer result
5751 R1-R3: function argument word 5751 R1-R3: function argument word
5752 R9: platform specific 5752 R9: platform specific
5753 R10: stack limit (used only if stack checking is enabled) 5753 R10: stack limit (used only if stack checking is enabled)
5754 R11: argument (frame) pointer 5754 R11: argument (frame) pointer
5755 R12: temporary workspace 5755 R12: temporary workspace
5756 R13: stack pointer 5756 R13: stack pointer
5757 R14: link register 5757 R14: link register
5758 R15: program counter 5758 R15: program counter
5759 5759
5760 ==> U-Boot will use R9 to hold a pointer to the global data 5760 ==> U-Boot will use R9 to hold a pointer to the global data
5761 5761
5762 Note: on ARM, only R_ARM_RELATIVE relocations are supported. 5762 Note: on ARM, only R_ARM_RELATIVE relocations are supported.
5763 5763
5764 On Nios II, the ABI is documented here: 5764 On Nios II, the ABI is documented here:
5765 http://www.altera.com/literature/hb/nios2/n2cpu_nii51016.pdf 5765 http://www.altera.com/literature/hb/nios2/n2cpu_nii51016.pdf
5766 5766
5767 ==> U-Boot will use gp to hold a pointer to the global data 5767 ==> U-Boot will use gp to hold a pointer to the global data
5768 5768
5769 Note: on Nios II, we give "-G0" option to gcc and don't use gp 5769 Note: on Nios II, we give "-G0" option to gcc and don't use gp
5770 to access small data sections, so gp is free. 5770 to access small data sections, so gp is free.
5771 5771
5772 On NDS32, the following registers are used: 5772 On NDS32, the following registers are used:
5773 5773
5774 R0-R1: argument/return 5774 R0-R1: argument/return
5775 R2-R5: argument 5775 R2-R5: argument
5776 R15: temporary register for assembler 5776 R15: temporary register for assembler
5777 R16: trampoline register 5777 R16: trampoline register
5778 R28: frame pointer (FP) 5778 R28: frame pointer (FP)
5779 R29: global pointer (GP) 5779 R29: global pointer (GP)
5780 R30: link register (LP) 5780 R30: link register (LP)
5781 R31: stack pointer (SP) 5781 R31: stack pointer (SP)
5782 PC: program counter (PC) 5782 PC: program counter (PC)
5783 5783
5784 ==> U-Boot will use R10 to hold a pointer to the global data 5784 ==> U-Boot will use R10 to hold a pointer to the global data
5785 5785
5786 NOTE: DECLARE_GLOBAL_DATA_PTR must be used with file-global scope, 5786 NOTE: DECLARE_GLOBAL_DATA_PTR must be used with file-global scope,
5787 or current versions of GCC may "optimize" the code too much. 5787 or current versions of GCC may "optimize" the code too much.
5788 5788
5789 Memory Management: 5789 Memory Management:
5790 ------------------ 5790 ------------------
5791 5791
5792 U-Boot runs in system state and uses physical addresses, i.e. the 5792 U-Boot runs in system state and uses physical addresses, i.e. the
5793 MMU is not used either for address mapping nor for memory protection. 5793 MMU is not used either for address mapping nor for memory protection.
5794 5794
5795 The available memory is mapped to fixed addresses using the memory 5795 The available memory is mapped to fixed addresses using the memory
5796 controller. In this process, a contiguous block is formed for each 5796 controller. In this process, a contiguous block is formed for each
5797 memory type (Flash, SDRAM, SRAM), even when it consists of several 5797 memory type (Flash, SDRAM, SRAM), even when it consists of several
5798 physical memory banks. 5798 physical memory banks.
5799 5799
5800 U-Boot is installed in the first 128 kB of the first Flash bank (on 5800 U-Boot is installed in the first 128 kB of the first Flash bank (on
5801 TQM8xxL modules this is the range 0x40000000 ... 0x4001FFFF). After 5801 TQM8xxL modules this is the range 0x40000000 ... 0x4001FFFF). After
5802 booting and sizing and initializing DRAM, the code relocates itself 5802 booting and sizing and initializing DRAM, the code relocates itself
5803 to the upper end of DRAM. Immediately below the U-Boot code some 5803 to the upper end of DRAM. Immediately below the U-Boot code some
5804 memory is reserved for use by malloc() [see CONFIG_SYS_MALLOC_LEN 5804 memory is reserved for use by malloc() [see CONFIG_SYS_MALLOC_LEN
5805 configuration setting]. Below that, a structure with global Board 5805 configuration setting]. Below that, a structure with global Board
5806 Info data is placed, followed by the stack (growing downward). 5806 Info data is placed, followed by the stack (growing downward).
5807 5807
5808 Additionally, some exception handler code is copied to the low 8 kB 5808 Additionally, some exception handler code is copied to the low 8 kB
5809 of DRAM (0x00000000 ... 0x00001FFF). 5809 of DRAM (0x00000000 ... 0x00001FFF).
5810 5810
5811 So a typical memory configuration with 16 MB of DRAM could look like 5811 So a typical memory configuration with 16 MB of DRAM could look like
5812 this: 5812 this:
5813 5813
5814 0x0000 0000 Exception Vector code 5814 0x0000 0000 Exception Vector code
5815 : 5815 :
5816 0x0000 1FFF 5816 0x0000 1FFF
5817 0x0000 2000 Free for Application Use 5817 0x0000 2000 Free for Application Use
5818 : 5818 :
5819 : 5819 :
5820 5820
5821 : 5821 :
5822 : 5822 :
5823 0x00FB FF20 Monitor Stack (Growing downward) 5823 0x00FB FF20 Monitor Stack (Growing downward)
5824 0x00FB FFAC Board Info Data and permanent copy of global data 5824 0x00FB FFAC Board Info Data and permanent copy of global data
5825 0x00FC 0000 Malloc Arena 5825 0x00FC 0000 Malloc Arena
5826 : 5826 :
5827 0x00FD FFFF 5827 0x00FD FFFF
5828 0x00FE 0000 RAM Copy of Monitor Code 5828 0x00FE 0000 RAM Copy of Monitor Code
5829 ... eventually: LCD or video framebuffer 5829 ... eventually: LCD or video framebuffer
5830 ... eventually: pRAM (Protected RAM - unchanged by reset) 5830 ... eventually: pRAM (Protected RAM - unchanged by reset)
5831 0x00FF FFFF [End of RAM] 5831 0x00FF FFFF [End of RAM]
5832 5832
5833 5833
5834 System Initialization: 5834 System Initialization:
5835 ---------------------- 5835 ----------------------
5836 5836
5837 In the reset configuration, U-Boot starts at the reset entry point 5837 In the reset configuration, U-Boot starts at the reset entry point
5838 (on most PowerPC systems at address 0x00000100). Because of the reset 5838 (on most PowerPC systems at address 0x00000100). Because of the reset
5839 configuration for CS0# this is a mirror of the on board Flash memory. 5839 configuration for CS0# this is a mirror of the on board Flash memory.
5840 To be able to re-map memory U-Boot then jumps to its link address. 5840 To be able to re-map memory U-Boot then jumps to its link address.
5841 To be able to implement the initialization code in C, a (small!) 5841 To be able to implement the initialization code in C, a (small!)
5842 initial stack is set up in the internal Dual Ported RAM (in case CPUs 5842 initial stack is set up in the internal Dual Ported RAM (in case CPUs
5843 which provide such a feature like MPC8xx or MPC8260), or in a locked 5843 which provide such a feature like MPC8xx or MPC8260), or in a locked
5844 part of the data cache. After that, U-Boot initializes the CPU core, 5844 part of the data cache. After that, U-Boot initializes the CPU core,
5845 the caches and the SIU. 5845 the caches and the SIU.
5846 5846
5847 Next, all (potentially) available memory banks are mapped using a 5847 Next, all (potentially) available memory banks are mapped using a
5848 preliminary mapping. For example, we put them on 512 MB boundaries 5848 preliminary mapping. For example, we put them on 512 MB boundaries
5849 (multiples of 0x20000000: SDRAM on 0x00000000 and 0x20000000, Flash 5849 (multiples of 0x20000000: SDRAM on 0x00000000 and 0x20000000, Flash
5850 on 0x40000000 and 0x60000000, SRAM on 0x80000000). Then UPM A is 5850 on 0x40000000 and 0x60000000, SRAM on 0x80000000). Then UPM A is
5851 programmed for SDRAM access. Using the temporary configuration, a 5851 programmed for SDRAM access. Using the temporary configuration, a
5852 simple memory test is run that determines the size of the SDRAM 5852 simple memory test is run that determines the size of the SDRAM
5853 banks. 5853 banks.
5854 5854
5855 When there is more than one SDRAM bank, and the banks are of 5855 When there is more than one SDRAM bank, and the banks are of
5856 different size, the largest is mapped first. For equal size, the first 5856 different size, the largest is mapped first. For equal size, the first
5857 bank (CS2#) is mapped first. The first mapping is always for address 5857 bank (CS2#) is mapped first. The first mapping is always for address
5858 0x00000000, with any additional banks following immediately to create 5858 0x00000000, with any additional banks following immediately to create
5859 contiguous memory starting from 0. 5859 contiguous memory starting from 0.
5860 5860
5861 Then, the monitor installs itself at the upper end of the SDRAM area 5861 Then, the monitor installs itself at the upper end of the SDRAM area
5862 and allocates memory for use by malloc() and for the global Board 5862 and allocates memory for use by malloc() and for the global Board
5863 Info data; also, the exception vector code is copied to the low RAM 5863 Info data; also, the exception vector code is copied to the low RAM
5864 pages, and the final stack is set up. 5864 pages, and the final stack is set up.
5865 5865
5866 Only after this relocation will you have a "normal" C environment; 5866 Only after this relocation will you have a "normal" C environment;
5867 until that you are restricted in several ways, mostly because you are 5867 until that you are restricted in several ways, mostly because you are
5868 running from ROM, and because the code will have to be relocated to a 5868 running from ROM, and because the code will have to be relocated to a
5869 new address in RAM. 5869 new address in RAM.
5870 5870
5871 5871
5872 U-Boot Porting Guide: 5872 U-Boot Porting Guide:
5873 ---------------------- 5873 ----------------------
5874 5874
5875 [Based on messages by Jerry Van Baren in the U-Boot-Users mailing 5875 [Based on messages by Jerry Van Baren in the U-Boot-Users mailing
5876 list, October 2002] 5876 list, October 2002]
5877 5877
5878 5878
5879 int main(int argc, char *argv[]) 5879 int main(int argc, char *argv[])
5880 { 5880 {
5881 sighandler_t no_more_time; 5881 sighandler_t no_more_time;
5882 5882
5883 signal(SIGALRM, no_more_time); 5883 signal(SIGALRM, no_more_time);
5884 alarm(PROJECT_DEADLINE - toSec (3 * WEEK)); 5884 alarm(PROJECT_DEADLINE - toSec (3 * WEEK));
5885 5885
5886 if (available_money > available_manpower) { 5886 if (available_money > available_manpower) {
5887 Pay consultant to port U-Boot; 5887 Pay consultant to port U-Boot;
5888 return 0; 5888 return 0;
5889 } 5889 }
5890 5890
5891 Download latest U-Boot source; 5891 Download latest U-Boot source;
5892 5892
5893 Subscribe to u-boot mailing list; 5893 Subscribe to u-boot mailing list;
5894 5894
5895 if (clueless) 5895 if (clueless)
5896 email("Hi, I am new to U-Boot, how do I get started?"); 5896 email("Hi, I am new to U-Boot, how do I get started?");
5897 5897
5898 while (learning) { 5898 while (learning) {
5899 Read the README file in the top level directory; 5899 Read the README file in the top level directory;
5900 Read http://www.denx.de/twiki/bin/view/DULG/Manual; 5900 Read http://www.denx.de/twiki/bin/view/DULG/Manual;
5901 Read applicable doc/*.README; 5901 Read applicable doc/*.README;
5902 Read the source, Luke; 5902 Read the source, Luke;
5903 /* find . -name "*.[chS]" | xargs grep -i <keyword> */ 5903 /* find . -name "*.[chS]" | xargs grep -i <keyword> */
5904 } 5904 }
5905 5905
5906 if (available_money > toLocalCurrency ($2500)) 5906 if (available_money > toLocalCurrency ($2500))
5907 Buy a BDI3000; 5907 Buy a BDI3000;
5908 else 5908 else
5909 Add a lot of aggravation and time; 5909 Add a lot of aggravation and time;
5910 5910
5911 if (a similar board exists) { /* hopefully... */ 5911 if (a similar board exists) { /* hopefully... */
5912 cp -a board/<similar> board/<myboard> 5912 cp -a board/<similar> board/<myboard>
5913 cp include/configs/<similar>.h include/configs/<myboard>.h 5913 cp include/configs/<similar>.h include/configs/<myboard>.h
5914 } else { 5914 } else {
5915 Create your own board support subdirectory; 5915 Create your own board support subdirectory;
5916 Create your own board include/configs/<myboard>.h file; 5916 Create your own board include/configs/<myboard>.h file;
5917 } 5917 }
5918 Edit new board/<myboard> files 5918 Edit new board/<myboard> files
5919 Edit new include/configs/<myboard>.h 5919 Edit new include/configs/<myboard>.h
5920 5920
5921 while (!accepted) { 5921 while (!accepted) {
5922 while (!running) { 5922 while (!running) {
5923 do { 5923 do {
5924 Add / modify source code; 5924 Add / modify source code;
5925 } until (compiles); 5925 } until (compiles);
5926 Debug; 5926 Debug;
5927 if (clueless) 5927 if (clueless)
5928 email("Hi, I am having problems..."); 5928 email("Hi, I am having problems...");
5929 } 5929 }
5930 Send patch file to the U-Boot email list; 5930 Send patch file to the U-Boot email list;
5931 if (reasonable critiques) 5931 if (reasonable critiques)
5932 Incorporate improvements from email list code review; 5932 Incorporate improvements from email list code review;
5933 else 5933 else
5934 Defend code as written; 5934 Defend code as written;
5935 } 5935 }
5936 5936
5937 return 0; 5937 return 0;
5938 } 5938 }
5939 5939
5940 void no_more_time (int sig) 5940 void no_more_time (int sig)
5941 { 5941 {
5942 hire_a_guru(); 5942 hire_a_guru();
5943 } 5943 }
5944 5944
5945 5945
5946 Coding Standards: 5946 Coding Standards:
5947 ----------------- 5947 -----------------
5948 5948
5949 All contributions to U-Boot should conform to the Linux kernel 5949 All contributions to U-Boot should conform to the Linux kernel
5950 coding style; see the file "Documentation/CodingStyle" and the script 5950 coding style; see the file "Documentation/CodingStyle" and the script
5951 "scripts/Lindent" in your Linux kernel source directory. 5951 "scripts/Lindent" in your Linux kernel source directory.
5952 5952
5953 Source files originating from a different project (for example the 5953 Source files originating from a different project (for example the
5954 MTD subsystem) are generally exempt from these guidelines and are not 5954 MTD subsystem) are generally exempt from these guidelines and are not
5955 reformatted to ease subsequent migration to newer versions of those 5955 reformatted to ease subsequent migration to newer versions of those
5956 sources. 5956 sources.
5957 5957
5958 Please note that U-Boot is implemented in C (and to some small parts in 5958 Please note that U-Boot is implemented in C (and to some small parts in
5959 Assembler); no C++ is used, so please do not use C++ style comments (//) 5959 Assembler); no C++ is used, so please do not use C++ style comments (//)
5960 in your code. 5960 in your code.
5961 5961
5962 Please also stick to the following formatting rules: 5962 Please also stick to the following formatting rules:
5963 - remove any trailing white space 5963 - remove any trailing white space
5964 - use TAB characters for indentation and vertical alignment, not spaces 5964 - use TAB characters for indentation and vertical alignment, not spaces
5965 - make sure NOT to use DOS '\r\n' line feeds 5965 - make sure NOT to use DOS '\r\n' line feeds
5966 - do not add more than 2 consecutive empty lines to source files 5966 - do not add more than 2 consecutive empty lines to source files
5967 - do not add trailing empty lines to source files 5967 - do not add trailing empty lines to source files
5968 5968
5969 Submissions which do not conform to the standards may be returned 5969 Submissions which do not conform to the standards may be returned
5970 with a request to reformat the changes. 5970 with a request to reformat the changes.
5971 5971
5972 5972
5973 Submitting Patches: 5973 Submitting Patches:
5974 ------------------- 5974 -------------------
5975 5975
5976 Since the number of patches for U-Boot is growing, we need to 5976 Since the number of patches for U-Boot is growing, we need to
5977 establish some rules. Submissions which do not conform to these rules 5977 establish some rules. Submissions which do not conform to these rules
5978 may be rejected, even when they contain important and valuable stuff. 5978 may be rejected, even when they contain important and valuable stuff.
5979 5979
5980 Please see http://www.denx.de/wiki/U-Boot/Patches for details. 5980 Please see http://www.denx.de/wiki/U-Boot/Patches for details.
5981 5981
5982 Patches shall be sent to the u-boot mailing list <u-boot@lists.denx.de>; 5982 Patches shall be sent to the u-boot mailing list <u-boot@lists.denx.de>;
5983 see http://lists.denx.de/mailman/listinfo/u-boot 5983 see http://lists.denx.de/mailman/listinfo/u-boot
5984 5984
5985 When you send a patch, please include the following information with 5985 When you send a patch, please include the following information with
5986 it: 5986 it:
5987 5987
5988 * For bug fixes: a description of the bug and how your patch fixes 5988 * For bug fixes: a description of the bug and how your patch fixes
5989 this bug. Please try to include a way of demonstrating that the 5989 this bug. Please try to include a way of demonstrating that the
5990 patch actually fixes something. 5990 patch actually fixes something.
5991 5991
5992 * For new features: a description of the feature and your 5992 * For new features: a description of the feature and your
5993 implementation. 5993 implementation.
5994 5994
5995 * A CHANGELOG entry as plaintext (separate from the patch) 5995 * A CHANGELOG entry as plaintext (separate from the patch)
5996 5996
5997 * For major contributions, add a MAINTAINERS file with your 5997 * For major contributions, add a MAINTAINERS file with your
5998 information and associated file and directory references. 5998 information and associated file and directory references.
5999 5999
6000 * When you add support for a new board, don't forget to add a 6000 * When you add support for a new board, don't forget to add a
6001 maintainer e-mail address to the boards.cfg file, too. 6001 maintainer e-mail address to the boards.cfg file, too.
6002 6002
6003 * If your patch adds new configuration options, don't forget to 6003 * If your patch adds new configuration options, don't forget to
6004 document these in the README file. 6004 document these in the README file.
6005 6005
6006 * The patch itself. If you are using git (which is *strongly* 6006 * The patch itself. If you are using git (which is *strongly*
6007 recommended) you can easily generate the patch using the 6007 recommended) you can easily generate the patch using the
6008 "git format-patch". If you then use "git send-email" to send it to 6008 "git format-patch". If you then use "git send-email" to send it to
6009 the U-Boot mailing list, you will avoid most of the common problems 6009 the U-Boot mailing list, you will avoid most of the common problems
6010 with some other mail clients. 6010 with some other mail clients.
6011 6011
6012 If you cannot use git, use "diff -purN OLD NEW". If your version of 6012 If you cannot use git, use "diff -purN OLD NEW". If your version of
6013 diff does not support these options, then get the latest version of 6013 diff does not support these options, then get the latest version of
6014 GNU diff. 6014 GNU diff.
6015 6015
6016 The current directory when running this command shall be the parent 6016 The current directory when running this command shall be the parent
6017 directory of the U-Boot source tree (i. e. please make sure that 6017 directory of the U-Boot source tree (i. e. please make sure that
6018 your patch includes sufficient directory information for the 6018 your patch includes sufficient directory information for the
6019 affected files). 6019 affected files).
6020 6020
6021 We prefer patches as plain text. MIME attachments are discouraged, 6021 We prefer patches as plain text. MIME attachments are discouraged,
6022 and compressed attachments must not be used. 6022 and compressed attachments must not be used.
6023 6023
6024 * If one logical set of modifications affects or creates several 6024 * If one logical set of modifications affects or creates several
6025 files, all these changes shall be submitted in a SINGLE patch file. 6025 files, all these changes shall be submitted in a SINGLE patch file.
6026 6026
6027 * Changesets that contain different, unrelated modifications shall be 6027 * Changesets that contain different, unrelated modifications shall be
6028 submitted as SEPARATE patches, one patch per changeset. 6028 submitted as SEPARATE patches, one patch per changeset.
6029 6029
6030 6030
6031 Notes: 6031 Notes:
6032 6032
6033 * Before sending the patch, run the buildman script on your patched 6033 * Before sending the patch, run the buildman script on your patched
6034 source tree and make sure that no errors or warnings are reported 6034 source tree and make sure that no errors or warnings are reported
6035 for any of the boards. 6035 for any of the boards.
6036 6036
6037 * Keep your modifications to the necessary minimum: A patch 6037 * Keep your modifications to the necessary minimum: A patch
6038 containing several unrelated changes or arbitrary reformats will be 6038 containing several unrelated changes or arbitrary reformats will be
6039 returned with a request to re-formatting / split it. 6039 returned with a request to re-formatting / split it.
6040 6040
6041 * If you modify existing code, make sure that your new code does not 6041 * If you modify existing code, make sure that your new code does not
6042 add to the memory footprint of the code ;-) Small is beautiful! 6042 add to the memory footprint of the code ;-) Small is beautiful!
6043 When adding new features, these should compile conditionally only 6043 When adding new features, these should compile conditionally only
6044 (using #ifdef), and the resulting code with the new feature 6044 (using #ifdef), and the resulting code with the new feature
6045 disabled must not need more memory than the old code without your 6045 disabled must not need more memory than the old code without your
6046 modification. 6046 modification.
6047 6047
6048 * Remember that there is a size limit of 100 kB per message on the 6048 * Remember that there is a size limit of 100 kB per message on the
6049 u-boot mailing list. Bigger patches will be moderated. If they are 6049 u-boot mailing list. Bigger patches will be moderated. If they are
6050 reasonable and not too big, they will be acknowledged. But patches 6050 reasonable and not too big, they will be acknowledged. But patches
6051 bigger than the size limit should be avoided. 6051 bigger than the size limit should be avoided.
6052 6052
1 /* 1 /*
2 * (C) Copyright 2007-2008 Semihalf 2 * (C) Copyright 2007-2008 Semihalf
3 * 3 *
4 * Written by: Rafal Jaworowski <raj@semihalf.com> 4 * Written by: Rafal Jaworowski <raj@semihalf.com>
5 * 5 *
6 * SPDX-License-Identifier: GPL-2.0+ 6 * SPDX-License-Identifier: GPL-2.0+
7 */ 7 */
8 8
9 #include <config.h> 9 #include <config.h>
10 #include <common.h> 10 #include <common.h>
11 #include <api_public.h> 11 #include <api_public.h>
12 12
13 #if defined(CONFIG_CMD_USB) && defined(CONFIG_USB_STORAGE) 13 #if defined(CONFIG_CMD_USB) && defined(CONFIG_USB_STORAGE)
14 #include <usb.h> 14 #include <usb.h>
15 #endif 15 #endif
16 16
17 #define DEBUG 17 #define DEBUG
18 #undef DEBUG 18 #undef DEBUG
19 19
20 #ifdef DEBUG 20 #ifdef DEBUG
21 #define debugf(fmt, args...) do { printf("%s(): ", __func__); printf(fmt, ##args); } while (0) 21 #define debugf(fmt, args...) do { printf("%s(): ", __func__); printf(fmt, ##args); } while (0)
22 #else 22 #else
23 #define debugf(fmt, args...) 23 #define debugf(fmt, args...)
24 #endif 24 #endif
25 25
26 #define errf(fmt, args...) do { printf("ERROR @ %s(): ", __func__); printf(fmt, ##args); } while (0) 26 #define errf(fmt, args...) do { printf("ERROR @ %s(): ", __func__); printf(fmt, ##args); } while (0)
27 27
28 28
29 #define ENUM_IDE 0 29 #define ENUM_IDE 0
30 #define ENUM_USB 1 30 #define ENUM_USB 1
31 #define ENUM_SCSI 2 31 #define ENUM_SCSI 2
32 #define ENUM_MMC 3 32 #define ENUM_MMC 3
33 #define ENUM_SATA 4 33 #define ENUM_SATA 4
34 #define ENUM_MAX 5 34 #define ENUM_MAX 5
35 35
36 struct stor_spec { 36 struct stor_spec {
37 int max_dev; 37 int max_dev;
38 int enum_started; 38 int enum_started;
39 int enum_ended; 39 int enum_ended;
40 int type; /* "external" type: DT_STOR_{IDE,USB,etc} */ 40 int type; /* "external" type: DT_STOR_{IDE,USB,etc} */
41 char *name; 41 char *name;
42 }; 42 };
43 43
44 static struct stor_spec specs[ENUM_MAX] = { { 0, 0, 0, 0, NULL }, }; 44 static struct stor_spec specs[ENUM_MAX] = { { 0, 0, 0, 0, NULL }, };
45 45
46 46
47 void dev_stor_init(void) 47 void dev_stor_init(void)
48 { 48 {
49 #if defined(CONFIG_CMD_IDE) 49 #if defined(CONFIG_IDE)
50 specs[ENUM_IDE].max_dev = CONFIG_SYS_IDE_MAXDEVICE; 50 specs[ENUM_IDE].max_dev = CONFIG_SYS_IDE_MAXDEVICE;
51 specs[ENUM_IDE].enum_started = 0; 51 specs[ENUM_IDE].enum_started = 0;
52 specs[ENUM_IDE].enum_ended = 0; 52 specs[ENUM_IDE].enum_ended = 0;
53 specs[ENUM_IDE].type = DEV_TYP_STOR | DT_STOR_IDE; 53 specs[ENUM_IDE].type = DEV_TYP_STOR | DT_STOR_IDE;
54 specs[ENUM_IDE].name = "ide"; 54 specs[ENUM_IDE].name = "ide";
55 #endif 55 #endif
56 #if defined(CONFIG_CMD_MMC) 56 #if defined(CONFIG_CMD_MMC)
57 specs[ENUM_MMC].max_dev = CONFIG_SYS_MMC_MAX_DEVICE; 57 specs[ENUM_MMC].max_dev = CONFIG_SYS_MMC_MAX_DEVICE;
58 specs[ENUM_MMC].enum_started = 0; 58 specs[ENUM_MMC].enum_started = 0;
59 specs[ENUM_MMC].enum_ended = 0; 59 specs[ENUM_MMC].enum_ended = 0;
60 specs[ENUM_MMC].type = DEV_TYP_STOR | DT_STOR_MMC; 60 specs[ENUM_MMC].type = DEV_TYP_STOR | DT_STOR_MMC;
61 specs[ENUM_MMC].name = "mmc"; 61 specs[ENUM_MMC].name = "mmc";
62 #endif 62 #endif
63 #if defined(CONFIG_CMD_SATA) 63 #if defined(CONFIG_CMD_SATA)
64 specs[ENUM_SATA].max_dev = CONFIG_SYS_SATA_MAX_DEVICE; 64 specs[ENUM_SATA].max_dev = CONFIG_SYS_SATA_MAX_DEVICE;
65 specs[ENUM_SATA].enum_started = 0; 65 specs[ENUM_SATA].enum_started = 0;
66 specs[ENUM_SATA].enum_ended = 0; 66 specs[ENUM_SATA].enum_ended = 0;
67 specs[ENUM_SATA].type = DEV_TYP_STOR | DT_STOR_SATA; 67 specs[ENUM_SATA].type = DEV_TYP_STOR | DT_STOR_SATA;
68 specs[ENUM_SATA].name = "sata"; 68 specs[ENUM_SATA].name = "sata";
69 #endif 69 #endif
70 #if defined(CONFIG_SCSI) 70 #if defined(CONFIG_SCSI)
71 specs[ENUM_SCSI].max_dev = CONFIG_SYS_SCSI_MAX_DEVICE; 71 specs[ENUM_SCSI].max_dev = CONFIG_SYS_SCSI_MAX_DEVICE;
72 specs[ENUM_SCSI].enum_started = 0; 72 specs[ENUM_SCSI].enum_started = 0;
73 specs[ENUM_SCSI].enum_ended = 0; 73 specs[ENUM_SCSI].enum_ended = 0;
74 specs[ENUM_SCSI].type = DEV_TYP_STOR | DT_STOR_SCSI; 74 specs[ENUM_SCSI].type = DEV_TYP_STOR | DT_STOR_SCSI;
75 specs[ENUM_SCSI].name = "scsi"; 75 specs[ENUM_SCSI].name = "scsi";
76 #endif 76 #endif
77 #if defined(CONFIG_CMD_USB) && defined(CONFIG_USB_STORAGE) 77 #if defined(CONFIG_CMD_USB) && defined(CONFIG_USB_STORAGE)
78 specs[ENUM_USB].max_dev = USB_MAX_STOR_DEV; 78 specs[ENUM_USB].max_dev = USB_MAX_STOR_DEV;
79 specs[ENUM_USB].enum_started = 0; 79 specs[ENUM_USB].enum_started = 0;
80 specs[ENUM_USB].enum_ended = 0; 80 specs[ENUM_USB].enum_ended = 0;
81 specs[ENUM_USB].type = DEV_TYP_STOR | DT_STOR_USB; 81 specs[ENUM_USB].type = DEV_TYP_STOR | DT_STOR_USB;
82 specs[ENUM_USB].name = "usb"; 82 specs[ENUM_USB].name = "usb";
83 #endif 83 #endif
84 } 84 }
85 85
86 /* 86 /*
87 * Finds next available device in the storage group 87 * Finds next available device in the storage group
88 * 88 *
89 * type: storage group type - ENUM_IDE, ENUM_SCSI etc. 89 * type: storage group type - ENUM_IDE, ENUM_SCSI etc.
90 * 90 *
91 * more: returns 0/1 depending if there are more devices in this group 91 * more: returns 0/1 depending if there are more devices in this group
92 * available (for future iterations) 92 * available (for future iterations)
93 * 93 *
94 * returns: 0/1 depending if device found in this iteration 94 * returns: 0/1 depending if device found in this iteration
95 */ 95 */
96 static int dev_stor_get(int type, int *more, struct device_info *di) 96 static int dev_stor_get(int type, int *more, struct device_info *di)
97 { 97 {
98 struct blk_desc *dd; 98 struct blk_desc *dd;
99 int found = 0; 99 int found = 0;
100 int i = 0; 100 int i = 0;
101 101
102 /* Wasn't configured for this type, return 0 directly */ 102 /* Wasn't configured for this type, return 0 directly */
103 if (specs[type].name == NULL) 103 if (specs[type].name == NULL)
104 return 0; 104 return 0;
105 105
106 if (di->cookie != NULL) { 106 if (di->cookie != NULL) {
107 /* Find the last device we've returned */ 107 /* Find the last device we've returned */
108 for (i = 0; i < specs[type].max_dev; i++) { 108 for (i = 0; i < specs[type].max_dev; i++) {
109 if (di->cookie == 109 if (di->cookie ==
110 (void *)blk_get_dev(specs[type].name, i)) { 110 (void *)blk_get_dev(specs[type].name, i)) {
111 i += 1; 111 i += 1;
112 break; 112 break;
113 } 113 }
114 } 114 }
115 } 115 }
116 116
117 for (; i < specs[type].max_dev; i++) { 117 for (; i < specs[type].max_dev; i++) {
118 di->cookie = (void *)blk_get_dev(specs[type].name, i); 118 di->cookie = (void *)blk_get_dev(specs[type].name, i);
119 119
120 if (di->cookie != NULL) { 120 if (di->cookie != NULL) {
121 found = 1; 121 found = 1;
122 break; 122 break;
123 } 123 }
124 } 124 }
125 125
126 if (i == specs[type].max_dev) 126 if (i == specs[type].max_dev)
127 *more = 0; 127 *more = 0;
128 else 128 else
129 *more = 1; 129 *more = 1;
130 130
131 if (found) { 131 if (found) {
132 di->type = specs[type].type; 132 di->type = specs[type].type;
133 133
134 dd = (struct blk_desc *)di->cookie; 134 dd = (struct blk_desc *)di->cookie;
135 if (dd->type == DEV_TYPE_UNKNOWN) { 135 if (dd->type == DEV_TYPE_UNKNOWN) {
136 debugf("device instance exists, but is not active.."); 136 debugf("device instance exists, but is not active..");
137 found = 0; 137 found = 0;
138 } else { 138 } else {
139 di->di_stor.block_count = dd->lba; 139 di->di_stor.block_count = dd->lba;
140 di->di_stor.block_size = dd->blksz; 140 di->di_stor.block_size = dd->blksz;
141 } 141 }
142 } else { 142 } else {
143 di->cookie = NULL; 143 di->cookie = NULL;
144 } 144 }
145 145
146 return found; 146 return found;
147 } 147 }
148 148
149 149
150 /* returns: ENUM_IDE, ENUM_USB etc. based on struct blk_desc */ 150 /* returns: ENUM_IDE, ENUM_USB etc. based on struct blk_desc */
151 151
152 static int dev_stor_type(struct blk_desc *dd) 152 static int dev_stor_type(struct blk_desc *dd)
153 { 153 {
154 int i, j; 154 int i, j;
155 155
156 for (i = ENUM_IDE; i < ENUM_MAX; i++) 156 for (i = ENUM_IDE; i < ENUM_MAX; i++)
157 for (j = 0; j < specs[i].max_dev; j++) 157 for (j = 0; j < specs[i].max_dev; j++)
158 if (dd == blk_get_dev(specs[i].name, j)) 158 if (dd == blk_get_dev(specs[i].name, j))
159 return i; 159 return i;
160 160
161 return ENUM_MAX; 161 return ENUM_MAX;
162 } 162 }
163 163
164 164
165 /* returns: 0/1 whether cookie points to some device in this group */ 165 /* returns: 0/1 whether cookie points to some device in this group */
166 166
167 static int dev_is_stor(int type, struct device_info *di) 167 static int dev_is_stor(int type, struct device_info *di)
168 { 168 {
169 return (dev_stor_type(di->cookie) == type) ? 1 : 0; 169 return (dev_stor_type(di->cookie) == type) ? 1 : 0;
170 } 170 }
171 171
172 172
173 static int dev_enum_stor(int type, struct device_info *di) 173 static int dev_enum_stor(int type, struct device_info *di)
174 { 174 {
175 int found = 0, more = 0; 175 int found = 0, more = 0;
176 176
177 debugf("called, type %d\n", type); 177 debugf("called, type %d\n", type);
178 178
179 /* 179 /*
180 * Formulae for enumerating storage devices: 180 * Formulae for enumerating storage devices:
181 * 1. if cookie (hint from previous enum call) is NULL we start again 181 * 1. if cookie (hint from previous enum call) is NULL we start again
182 * with enumeration, so return the first available device, done. 182 * with enumeration, so return the first available device, done.
183 * 183 *
184 * 2. if cookie is not NULL, check if it identifies some device in 184 * 2. if cookie is not NULL, check if it identifies some device in
185 * this group: 185 * this group:
186 * 186 *
187 * 2a. if cookie is a storage device from our group (IDE, USB etc.), 187 * 2a. if cookie is a storage device from our group (IDE, USB etc.),
188 * return next available (if exists) in this group 188 * return next available (if exists) in this group
189 * 189 *
190 * 2b. if it isn't device from our group, check if such devices were 190 * 2b. if it isn't device from our group, check if such devices were
191 * ever enumerated before: 191 * ever enumerated before:
192 * - if not, return the first available device from this group 192 * - if not, return the first available device from this group
193 * - else return 0 193 * - else return 0
194 */ 194 */
195 195
196 if (di->cookie == NULL) { 196 if (di->cookie == NULL) {
197 debugf("group%d - enum restart\n", type); 197 debugf("group%d - enum restart\n", type);
198 198
199 /* 199 /*
200 * 1. Enumeration (re-)started: take the first available 200 * 1. Enumeration (re-)started: take the first available
201 * device, if exists 201 * device, if exists
202 */ 202 */
203 found = dev_stor_get(type, &more, di); 203 found = dev_stor_get(type, &more, di);
204 specs[type].enum_started = 1; 204 specs[type].enum_started = 1;
205 205
206 } else if (dev_is_stor(type, di)) { 206 } else if (dev_is_stor(type, di)) {
207 debugf("group%d - enum continued for the next device\n", type); 207 debugf("group%d - enum continued for the next device\n", type);
208 208
209 if (specs[type].enum_ended) { 209 if (specs[type].enum_ended) {
210 debugf("group%d - nothing more to enum!\n", type); 210 debugf("group%d - nothing more to enum!\n", type);
211 return 0; 211 return 0;
212 } 212 }
213 213
214 /* 2a. Attempt to take a next available device in the group */ 214 /* 2a. Attempt to take a next available device in the group */
215 found = dev_stor_get(type, &more, di); 215 found = dev_stor_get(type, &more, di);
216 216
217 } else { 217 } else {
218 if (specs[type].enum_ended) { 218 if (specs[type].enum_ended) {
219 debugf("group %d - already enumerated, skipping\n", type); 219 debugf("group %d - already enumerated, skipping\n", type);
220 return 0; 220 return 0;
221 } 221 }
222 222
223 debugf("group%d - first time enum\n", type); 223 debugf("group%d - first time enum\n", type);
224 224
225 if (specs[type].enum_started == 0) { 225 if (specs[type].enum_started == 0) {
226 /* 226 /*
227 * 2b. If enumerating devices in this group did not 227 * 2b. If enumerating devices in this group did not
228 * happen before, it means the cookie pointed to a 228 * happen before, it means the cookie pointed to a
229 * device from some other group (another storage 229 * device from some other group (another storage
230 * group, or network); in this case try to take the 230 * group, or network); in this case try to take the
231 * first available device from our group 231 * first available device from our group
232 */ 232 */
233 specs[type].enum_started = 1; 233 specs[type].enum_started = 1;
234 234
235 /* 235 /*
236 * Attempt to take the first device in this group: 236 * Attempt to take the first device in this group:
237 *'first element' flag is set 237 *'first element' flag is set
238 */ 238 */
239 found = dev_stor_get(type, &more, di); 239 found = dev_stor_get(type, &more, di);
240 240
241 } else { 241 } else {
242 errf("group%d - out of order iteration\n", type); 242 errf("group%d - out of order iteration\n", type);
243 found = 0; 243 found = 0;
244 more = 0; 244 more = 0;
245 } 245 }
246 } 246 }
247 247
248 /* 248 /*
249 * If there are no more devices in this group, consider its 249 * If there are no more devices in this group, consider its
250 * enumeration finished 250 * enumeration finished
251 */ 251 */
252 specs[type].enum_ended = (!more) ? 1 : 0; 252 specs[type].enum_ended = (!more) ? 1 : 0;
253 253
254 if (found) 254 if (found)
255 debugf("device found, returning cookie 0x%08x\n", 255 debugf("device found, returning cookie 0x%08x\n",
256 (u_int32_t)di->cookie); 256 (u_int32_t)di->cookie);
257 else 257 else
258 debugf("no device found\n"); 258 debugf("no device found\n");
259 259
260 return found; 260 return found;
261 } 261 }
262 262
263 void dev_enum_reset(void) 263 void dev_enum_reset(void)
264 { 264 {
265 int i; 265 int i;
266 266
267 for (i = 0; i < ENUM_MAX; i ++) { 267 for (i = 0; i < ENUM_MAX; i ++) {
268 specs[i].enum_started = 0; 268 specs[i].enum_started = 0;
269 specs[i].enum_ended = 0; 269 specs[i].enum_ended = 0;
270 } 270 }
271 } 271 }
272 272
273 int dev_enum_storage(struct device_info *di) 273 int dev_enum_storage(struct device_info *di)
274 { 274 {
275 int i; 275 int i;
276 276
277 /* check: ide, usb, scsi, mmc */ 277 /* check: ide, usb, scsi, mmc */
278 for (i = ENUM_IDE; i < ENUM_MAX; i ++) { 278 for (i = ENUM_IDE; i < ENUM_MAX; i ++) {
279 if (dev_enum_stor(i, di)) 279 if (dev_enum_stor(i, di))
280 return 1; 280 return 1;
281 } 281 }
282 282
283 return 0; 283 return 0;
284 } 284 }
285 285
286 static int dev_stor_is_valid(int type, struct blk_desc *dd) 286 static int dev_stor_is_valid(int type, struct blk_desc *dd)
287 { 287 {
288 int i; 288 int i;
289 289
290 for (i = 0; i < specs[type].max_dev; i++) 290 for (i = 0; i < specs[type].max_dev; i++)
291 if (dd == blk_get_dev(specs[type].name, i)) 291 if (dd == blk_get_dev(specs[type].name, i))
292 if (dd->type != DEV_TYPE_UNKNOWN) 292 if (dd->type != DEV_TYPE_UNKNOWN)
293 return 1; 293 return 1;
294 294
295 return 0; 295 return 0;
296 } 296 }
297 297
298 298
299 int dev_open_stor(void *cookie) 299 int dev_open_stor(void *cookie)
300 { 300 {
301 int type = dev_stor_type(cookie); 301 int type = dev_stor_type(cookie);
302 302
303 if (type == ENUM_MAX) 303 if (type == ENUM_MAX)
304 return API_ENODEV; 304 return API_ENODEV;
305 305
306 if (dev_stor_is_valid(type, (struct blk_desc *)cookie)) 306 if (dev_stor_is_valid(type, (struct blk_desc *)cookie))
307 return 0; 307 return 0;
308 308
309 return API_ENODEV; 309 return API_ENODEV;
310 } 310 }
311 311
312 312
313 int dev_close_stor(void *cookie) 313 int dev_close_stor(void *cookie)
314 { 314 {
315 /* 315 /*
316 * Not much to do as we actually do not alter storage devices upon 316 * Not much to do as we actually do not alter storage devices upon
317 * close 317 * close
318 */ 318 */
319 return 0; 319 return 0;
320 } 320 }
321 321
322 322
323 lbasize_t dev_read_stor(void *cookie, void *buf, lbasize_t len, lbastart_t start) 323 lbasize_t dev_read_stor(void *cookie, void *buf, lbasize_t len, lbastart_t start)
324 { 324 {
325 int type; 325 int type;
326 struct blk_desc *dd = (struct blk_desc *)cookie; 326 struct blk_desc *dd = (struct blk_desc *)cookie;
327 327
328 if ((type = dev_stor_type(dd)) == ENUM_MAX) 328 if ((type = dev_stor_type(dd)) == ENUM_MAX)
329 return 0; 329 return 0;
330 330
331 if (!dev_stor_is_valid(type, dd)) 331 if (!dev_stor_is_valid(type, dd))
332 return 0; 332 return 0;
333 333
334 #ifdef CONFIG_BLK 334 #ifdef CONFIG_BLK
335 return blk_dread(dd, start, len, buf); 335 return blk_dread(dd, start, len, buf);
336 #else 336 #else
337 if ((dd->block_read) == NULL) { 337 if ((dd->block_read) == NULL) {
338 debugf("no block_read() for device 0x%08x\n", cookie); 338 debugf("no block_read() for device 0x%08x\n", cookie);
339 return 0; 339 return 0;
340 } 340 }
341 341
342 return dd->block_read(dd, start, len, buf); 342 return dd->block_read(dd, start, len, buf);
343 #endif /* defined(CONFIG_BLK) */ 343 #endif /* defined(CONFIG_BLK) */
344 } 344 }
345 345
arch/arm/mach-kirkwood/include/mach/config.h
1 /* 1 /*
2 * (C) Copyright 2011 2 * (C) Copyright 2011
3 * Marvell Semiconductor <www.marvell.com> 3 * Marvell Semiconductor <www.marvell.com>
4 * Written-by: Lei Wen <leiwen@marvell.com> 4 * Written-by: Lei Wen <leiwen@marvell.com>
5 * 5 *
6 * SPDX-License-Identifier: GPL-2.0+ 6 * SPDX-License-Identifier: GPL-2.0+
7 */ 7 */
8 8
9 /* 9 /*
10 * This file should be included in board config header file. 10 * This file should be included in board config header file.
11 * 11 *
12 * It supports common definitions for Kirkwood platform 12 * It supports common definitions for Kirkwood platform
13 */ 13 */
14 14
15 #ifndef _KW_CONFIG_H 15 #ifndef _KW_CONFIG_H
16 #define _KW_CONFIG_H 16 #define _KW_CONFIG_H
17 17
18 #if defined (CONFIG_KW88F6281) 18 #if defined (CONFIG_KW88F6281)
19 #include <asm/arch/kw88f6281.h> 19 #include <asm/arch/kw88f6281.h>
20 #elif defined (CONFIG_KW88F6192) 20 #elif defined (CONFIG_KW88F6192)
21 #include <asm/arch/kw88f6192.h> 21 #include <asm/arch/kw88f6192.h>
22 #else 22 #else
23 #error "SOC Name not defined" 23 #error "SOC Name not defined"
24 #endif /* CONFIG_KW88F6281 */ 24 #endif /* CONFIG_KW88F6281 */
25 25
26 #include <asm/arch/soc.h> 26 #include <asm/arch/soc.h>
27 #define CONFIG_KIRKWOOD_EGIGA_INIT /* Enable GbePort0/1 for kernel */ 27 #define CONFIG_KIRKWOOD_EGIGA_INIT /* Enable GbePort0/1 for kernel */
28 #define CONFIG_KIRKWOOD_RGMII_PAD_1V8 /* Set RGMII Pad voltage to 1.8V */ 28 #define CONFIG_KIRKWOOD_RGMII_PAD_1V8 /* Set RGMII Pad voltage to 1.8V */
29 #define CONFIG_KIRKWOOD_PCIE_INIT /* Enable PCIE Port0 for kernel */ 29 #define CONFIG_KIRKWOOD_PCIE_INIT /* Enable PCIE Port0 for kernel */
30 30
31 /* 31 /*
32 * By default kwbimage.cfg from board specific folder is used 32 * By default kwbimage.cfg from board specific folder is used
33 * If for some board, different configuration file need to be used, 33 * If for some board, different configuration file need to be used,
34 * CONFIG_SYS_KWD_CONFIG should be defined in board specific header file 34 * CONFIG_SYS_KWD_CONFIG should be defined in board specific header file
35 */ 35 */
36 #ifndef CONFIG_SYS_KWD_CONFIG 36 #ifndef CONFIG_SYS_KWD_CONFIG
37 #define CONFIG_SYS_KWD_CONFIG $(CONFIG_BOARDDIR)/kwbimage.cfg 37 #define CONFIG_SYS_KWD_CONFIG $(CONFIG_BOARDDIR)/kwbimage.cfg
38 #endif /* CONFIG_SYS_KWD_CONFIG */ 38 #endif /* CONFIG_SYS_KWD_CONFIG */
39 39
40 /* Kirkwood has 2k of Security SRAM, use it for SP */ 40 /* Kirkwood has 2k of Security SRAM, use it for SP */
41 #define CONFIG_SYS_INIT_SP_ADDR 0xC8012000 41 #define CONFIG_SYS_INIT_SP_ADDR 0xC8012000
42 #define CONFIG_NR_DRAM_BANKS_MAX 2 42 #define CONFIG_NR_DRAM_BANKS_MAX 2
43 43
44 #define CONFIG_I2C_MVTWSI_BASE0 KW_TWSI_BASE 44 #define CONFIG_I2C_MVTWSI_BASE0 KW_TWSI_BASE
45 #define MV_UART_CONSOLE_BASE KW_UART0_BASE 45 #define MV_UART_CONSOLE_BASE KW_UART0_BASE
46 #define MV_SATA_BASE KW_SATA_BASE 46 #define MV_SATA_BASE KW_SATA_BASE
47 #define MV_SATA_PORT0_OFFSET KW_SATA_PORT0_OFFSET 47 #define MV_SATA_PORT0_OFFSET KW_SATA_PORT0_OFFSET
48 #define MV_SATA_PORT1_OFFSET KW_SATA_PORT1_OFFSET 48 #define MV_SATA_PORT1_OFFSET KW_SATA_PORT1_OFFSET
49 49
50 /* 50 /*
51 * NAND configuration 51 * NAND configuration
52 */ 52 */
53 #ifdef CONFIG_CMD_NAND 53 #ifdef CONFIG_CMD_NAND
54 #define CONFIG_NAND_KIRKWOOD 54 #define CONFIG_NAND_KIRKWOOD
55 #define CONFIG_SYS_NAND_BASE 0xD8000000 /* MV_DEFADR_NANDF */ 55 #define CONFIG_SYS_NAND_BASE 0xD8000000 /* MV_DEFADR_NANDF */
56 #define NAND_ALLOW_ERASE_ALL 1 56 #define NAND_ALLOW_ERASE_ALL 1
57 #endif 57 #endif
58 58
59 /* 59 /*
60 * SPI Flash configuration 60 * SPI Flash configuration
61 */ 61 */
62 #ifdef CONFIG_CMD_SF 62 #ifdef CONFIG_CMD_SF
63 #define CONFIG_HARD_SPI 1 63 #define CONFIG_HARD_SPI 1
64 #define CONFIG_KIRKWOOD_SPI 1 64 #define CONFIG_KIRKWOOD_SPI 1
65 #ifndef CONFIG_ENV_SPI_BUS 65 #ifndef CONFIG_ENV_SPI_BUS
66 # define CONFIG_ENV_SPI_BUS 0 66 # define CONFIG_ENV_SPI_BUS 0
67 #endif 67 #endif
68 #ifndef CONFIG_ENV_SPI_CS 68 #ifndef CONFIG_ENV_SPI_CS
69 # define CONFIG_ENV_SPI_CS 0 69 # define CONFIG_ENV_SPI_CS 0
70 #endif 70 #endif
71 #ifndef CONFIG_ENV_SPI_MAX_HZ 71 #ifndef CONFIG_ENV_SPI_MAX_HZ
72 # define CONFIG_ENV_SPI_MAX_HZ 50000000 72 # define CONFIG_ENV_SPI_MAX_HZ 50000000
73 #endif 73 #endif
74 #endif 74 #endif
75 75
76 /* 76 /*
77 * Ethernet Driver configuration 77 * Ethernet Driver configuration
78 */ 78 */
79 #ifdef CONFIG_CMD_NET 79 #ifdef CONFIG_CMD_NET
80 #define CONFIG_NETCONSOLE /* include NetConsole support */ 80 #define CONFIG_NETCONSOLE /* include NetConsole support */
81 #define CONFIG_MII /* expose smi ove miiphy interface */ 81 #define CONFIG_MII /* expose smi ove miiphy interface */
82 #define CONFIG_MVGBE /* Enable Marvell Gbe Controller Driver */ 82 #define CONFIG_MVGBE /* Enable Marvell Gbe Controller Driver */
83 #define CONFIG_SYS_FAULT_ECHO_LINK_DOWN /* detect link using phy */ 83 #define CONFIG_SYS_FAULT_ECHO_LINK_DOWN /* detect link using phy */
84 #define CONFIG_ENV_OVERWRITE /* ethaddr can be reprogrammed */ 84 #define CONFIG_ENV_OVERWRITE /* ethaddr can be reprogrammed */
85 #define CONFIG_RESET_PHY_R /* use reset_phy() to init mv8831116 PHY */ 85 #define CONFIG_RESET_PHY_R /* use reset_phy() to init mv8831116 PHY */
86 #endif /* CONFIG_CMD_NET */ 86 #endif /* CONFIG_CMD_NET */
87 87
88 /* 88 /*
89 * USB/EHCI 89 * USB/EHCI
90 */ 90 */
91 #ifdef CONFIG_CMD_USB 91 #ifdef CONFIG_CMD_USB
92 #define CONFIG_EHCI_IS_TDI 92 #define CONFIG_EHCI_IS_TDI
93 #endif /* CONFIG_CMD_USB */ 93 #endif /* CONFIG_CMD_USB */
94 94
95 /* 95 /*
96 * IDE Support on SATA ports 96 * IDE Support on SATA ports
97 */ 97 */
98 #ifdef CONFIG_CMD_IDE 98 #ifdef CONFIG_IDE
99 #define __io 99 #define __io
100 #define CONFIG_MVSATA_IDE 100 #define CONFIG_MVSATA_IDE
101 #define CONFIG_IDE_PREINIT 101 #define CONFIG_IDE_PREINIT
102 #define CONFIG_MVSATA_IDE_USE_PORT1 102 #define CONFIG_MVSATA_IDE_USE_PORT1
103 /* Needs byte-swapping for ATA data register */ 103 /* Needs byte-swapping for ATA data register */
104 #define CONFIG_IDE_SWAP_IO 104 #define CONFIG_IDE_SWAP_IO
105 /* Data, registers and alternate blocks are at the same offset */ 105 /* Data, registers and alternate blocks are at the same offset */
106 #define CONFIG_SYS_ATA_DATA_OFFSET (0x0100) 106 #define CONFIG_SYS_ATA_DATA_OFFSET (0x0100)
107 #define CONFIG_SYS_ATA_REG_OFFSET (0x0100) 107 #define CONFIG_SYS_ATA_REG_OFFSET (0x0100)
108 #define CONFIG_SYS_ATA_ALT_OFFSET (0x0100) 108 #define CONFIG_SYS_ATA_ALT_OFFSET (0x0100)
109 /* Each 8-bit ATA register is aligned to a 4-bytes address */ 109 /* Each 8-bit ATA register is aligned to a 4-bytes address */
110 #define CONFIG_SYS_ATA_STRIDE 4 110 #define CONFIG_SYS_ATA_STRIDE 4
111 /* Controller supports 48-bits LBA addressing */ 111 /* Controller supports 48-bits LBA addressing */
112 #define CONFIG_LBA48 112 #define CONFIG_LBA48
113 /* CONFIG_CMD_IDE requires some #defines for ATA registers */ 113 /* CONFIG_IDE requires some #defines for ATA registers */
114 #define CONFIG_SYS_IDE_MAXBUS 2 114 #define CONFIG_SYS_IDE_MAXBUS 2
115 #define CONFIG_SYS_IDE_MAXDEVICE 2 115 #define CONFIG_SYS_IDE_MAXDEVICE 2
116 /* ATA registers base is at SATA controller base */ 116 /* ATA registers base is at SATA controller base */
117 #define CONFIG_SYS_ATA_BASE_ADDR MV_SATA_BASE 117 #define CONFIG_SYS_ATA_BASE_ADDR MV_SATA_BASE
118 #endif /* CONFIG_CMD_IDE */ 118 #endif /* CONFIG_IDE */
119 119
120 /* 120 /*
121 * I2C related stuff 121 * I2C related stuff
122 */ 122 */
123 #ifdef CONFIG_CMD_I2C 123 #ifdef CONFIG_CMD_I2C
124 #ifndef CONFIG_SYS_I2C_SOFT 124 #ifndef CONFIG_SYS_I2C_SOFT
125 #define CONFIG_SYS_I2C 125 #define CONFIG_SYS_I2C
126 #define CONFIG_SYS_I2C_MVTWSI 126 #define CONFIG_SYS_I2C_MVTWSI
127 #endif 127 #endif
128 #define CONFIG_SYS_I2C_SLAVE 0x0 128 #define CONFIG_SYS_I2C_SLAVE 0x0
129 #define CONFIG_SYS_I2C_SPEED 100000 129 #define CONFIG_SYS_I2C_SPEED 100000
130 #endif 130 #endif
131 131
132 /* Use common timer */ 132 /* Use common timer */
133 #define CONFIG_SYS_TIMER_COUNTS_DOWN 133 #define CONFIG_SYS_TIMER_COUNTS_DOWN
134 #define CONFIG_SYS_TIMER_COUNTER (MVEBU_TIMER_BASE + 0x14) 134 #define CONFIG_SYS_TIMER_COUNTER (MVEBU_TIMER_BASE + 0x14)
135 #define CONFIG_SYS_TIMER_RATE CONFIG_SYS_TCLK 135 #define CONFIG_SYS_TIMER_RATE CONFIG_SYS_TCLK
136 136
137 #endif /* _KW_CONFIG_H */ 137 #endif /* _KW_CONFIG_H */
138 138
arch/powerpc/cpu/mpc5xxx/ide.c
1 /* 1 /*
2 * (C) Copyright 2004 2 * (C) Copyright 2004
3 * Pierre AUBERT, Staubli Faverges, <p.aubert@staubli.com> 3 * Pierre AUBERT, Staubli Faverges, <p.aubert@staubli.com>
4 * 4 *
5 * SPDX-License-Identifier: GPL-2.0+ 5 * SPDX-License-Identifier: GPL-2.0+
6 * 6 *
7 * Init is derived from Linux code. 7 * Init is derived from Linux code.
8 */ 8 */
9 #include <common.h> 9 #include <common.h>
10 10
11 #if defined(CONFIG_CMD_IDE) 11 #if defined(CONFIG_IDE)
12 #include <mpc5xxx.h> 12 #include <mpc5xxx.h>
13 13
14 DECLARE_GLOBAL_DATA_PTR; 14 DECLARE_GLOBAL_DATA_PTR;
15 15
16 #define CALC_TIMING(t) (t + period - 1) / period 16 #define CALC_TIMING(t) (t + period - 1) / period
17 17
18 #ifdef CONFIG_IDE_RESET 18 #ifdef CONFIG_IDE_RESET
19 extern void init_ide_reset (void); 19 extern void init_ide_reset (void);
20 #endif 20 #endif
21 21
22 int ide_preinit (void) 22 int ide_preinit (void)
23 { 23 {
24 long period, t0, t1, t2_8, t2_16, t4, ta; 24 long period, t0, t1, t2_8, t2_16, t4, ta;
25 vu_long reg; 25 vu_long reg;
26 struct mpc5xxx_sdma *psdma = (struct mpc5xxx_sdma *) MPC5XXX_SDMA; 26 struct mpc5xxx_sdma *psdma = (struct mpc5xxx_sdma *) MPC5XXX_SDMA;
27 27
28 reg = *(vu_long *) MPC5XXX_GPS_PORT_CONFIG; 28 reg = *(vu_long *) MPC5XXX_GPS_PORT_CONFIG;
29 #if defined(CONFIG_SYS_ATA_CS_ON_I2C2) 29 #if defined(CONFIG_SYS_ATA_CS_ON_I2C2)
30 /* ATA cs0/1 on i2c2 clk/io */ 30 /* ATA cs0/1 on i2c2 clk/io */
31 reg = (reg & ~0x03000000ul) | 0x02000000ul; 31 reg = (reg & ~0x03000000ul) | 0x02000000ul;
32 #elif defined(CONFIG_SYS_ATA_CS_ON_TIMER01) 32 #elif defined(CONFIG_SYS_ATA_CS_ON_TIMER01)
33 /* ATA cs0/1 on Timer 0/1 */ 33 /* ATA cs0/1 on Timer 0/1 */
34 reg = (reg & ~0x03000000ul) | 0x03000000ul; 34 reg = (reg & ~0x03000000ul) | 0x03000000ul;
35 #else 35 #else
36 /* ATA cs0/1 on Local Plus cs4/5 */ 36 /* ATA cs0/1 on Local Plus cs4/5 */
37 reg = (reg & ~0x03000000ul) | 0x01000000ul; 37 reg = (reg & ~0x03000000ul) | 0x01000000ul;
38 #endif /* CONFIG_TOTAL5200 */ 38 #endif /* CONFIG_TOTAL5200 */
39 *(vu_long *) MPC5XXX_GPS_PORT_CONFIG = reg; 39 *(vu_long *) MPC5XXX_GPS_PORT_CONFIG = reg;
40 40
41 /* All sample codes do that... */ 41 /* All sample codes do that... */
42 *(vu_long *) MPC5XXX_ATA_SHARE_COUNT = 0; 42 *(vu_long *) MPC5XXX_ATA_SHARE_COUNT = 0;
43 43
44 /* Configure and reset host */ 44 /* Configure and reset host */
45 *(vu_long *) MPC5XXX_ATA_HOST_CONFIG = MPC5xxx_ATA_HOSTCONF_IORDY | 45 *(vu_long *) MPC5XXX_ATA_HOST_CONFIG = MPC5xxx_ATA_HOSTCONF_IORDY |
46 MPC5xxx_ATA_HOSTCONF_SMR | MPC5xxx_ATA_HOSTCONF_FR; 46 MPC5xxx_ATA_HOSTCONF_SMR | MPC5xxx_ATA_HOSTCONF_FR;
47 udelay (10); 47 udelay (10);
48 *(vu_long *) MPC5XXX_ATA_HOST_CONFIG = MPC5xxx_ATA_HOSTCONF_IORDY; 48 *(vu_long *) MPC5XXX_ATA_HOST_CONFIG = MPC5xxx_ATA_HOSTCONF_IORDY;
49 49
50 /* Disable prefetch on Commbus */ 50 /* Disable prefetch on Commbus */
51 psdma->PtdCntrl |= 1; 51 psdma->PtdCntrl |= 1;
52 52
53 /* Init timings : we use PIO mode 0 timings */ 53 /* Init timings : we use PIO mode 0 timings */
54 period = 1000000000 / gd->arch.ipb_clk; /* period in ns */ 54 period = 1000000000 / gd->arch.ipb_clk; /* period in ns */
55 55
56 t0 = CALC_TIMING (600); 56 t0 = CALC_TIMING (600);
57 t2_8 = CALC_TIMING (290); 57 t2_8 = CALC_TIMING (290);
58 t2_16 = CALC_TIMING (165); 58 t2_16 = CALC_TIMING (165);
59 reg = (t0 << 24) | (t2_8 << 16) | (t2_16 << 8); 59 reg = (t0 << 24) | (t2_8 << 16) | (t2_16 << 8);
60 *(vu_long *) MPC5XXX_ATA_PIO1 = reg; 60 *(vu_long *) MPC5XXX_ATA_PIO1 = reg;
61 61
62 t4 = CALC_TIMING (30); 62 t4 = CALC_TIMING (30);
63 t1 = CALC_TIMING (70); 63 t1 = CALC_TIMING (70);
64 ta = CALC_TIMING (35); 64 ta = CALC_TIMING (35);
65 reg = (t4 << 24) | (t1 << 16) | (ta << 8); 65 reg = (t4 << 24) | (t1 << 16) | (ta << 8);
66 66
67 *(vu_long *) MPC5XXX_ATA_PIO2 = reg; 67 *(vu_long *) MPC5XXX_ATA_PIO2 = reg;
68 68
69 #ifdef CONFIG_IDE_RESET 69 #ifdef CONFIG_IDE_RESET
70 init_ide_reset (); 70 init_ide_reset ();
71 #endif /* CONFIG_IDE_RESET */ 71 #endif /* CONFIG_IDE_RESET */
72 72
73 return (0); 73 return (0);
74 } 74 }
75 #endif 75 #endif
76 76
arch/powerpc/lib/Makefile
1 # 1 #
2 # (C) Copyright 2000-2006 2 # (C) Copyright 2000-2006
3 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. 3 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 # 4 #
5 # SPDX-License-Identifier: GPL-2.0+ 5 # SPDX-License-Identifier: GPL-2.0+
6 # 6 #
7 7
8 ## Build a couple of necessary functions into a private libgcc 8 ## Build a couple of necessary functions into a private libgcc
9 ## if the user asked for it 9 ## if the user asked for it
10 lib-$(CONFIG_USE_PRIVATE_LIBGCC) += _ashldi3.o _ashrdi3.o _lshrdi3.o 10 lib-$(CONFIG_USE_PRIVATE_LIBGCC) += _ashldi3.o _ashrdi3.o _lshrdi3.o
11 11
12 MINIMAL= 12 MINIMAL=
13 13
14 ifdef CONFIG_SPL_BUILD 14 ifdef CONFIG_SPL_BUILD
15 ifdef CONFIG_SPL_INIT_MINIMAL 15 ifdef CONFIG_SPL_INIT_MINIMAL
16 MINIMAL=y 16 MINIMAL=y
17 endif 17 endif
18 endif 18 endif
19 19
20 obj-$(CONFIG_SYS_EXTBDINFO) += setup.o 20 obj-$(CONFIG_SYS_EXTBDINFO) += setup.o
21 ifdef MINIMAL 21 ifdef MINIMAL
22 obj-y += cache.o time.o 22 obj-y += cache.o time.o
23 obj-y += ticks.o 23 obj-y += ticks.o
24 else 24 else
25 25
26 obj-y += ppcstring.o 26 obj-y += ppcstring.o
27 27
28 obj-y += ppccache.o 28 obj-y += ppccache.o
29 obj-y += ticks.o 29 obj-y += ticks.o
30 obj-y += reloc.o 30 obj-y += reloc.o
31 31
32 obj-$(CONFIG_BAT_RW) += bat_rw.o 32 obj-$(CONFIG_BAT_RW) += bat_rw.o
33 obj-$(CONFIG_CMD_BOOTM) += bootm.o 33 obj-$(CONFIG_CMD_BOOTM) += bootm.o
34 obj-y += cache.o 34 obj-y += cache.o
35 obj-y += extable.o 35 obj-y += extable.o
36 obj-y += interrupts.o 36 obj-y += interrupts.o
37 obj-$(CONFIG_CMD_KGDB) += kgdb.o 37 obj-$(CONFIG_CMD_KGDB) += kgdb.o
38 obj-$(CONFIG_CMD_IDE) += ide.o 38 obj-$(CONFIG_IDE) += ide.o
39 obj-y += stack.o 39 obj-y += stack.o
40 obj-y += time.o 40 obj-y += time.o
41 41
42 # Don't include the MPC5xxx special memcpy into the 42 # Don't include the MPC5xxx special memcpy into the
43 # SPL U-Boot image. memcpy is used in the SPL NOR 43 # SPL U-Boot image. memcpy is used in the SPL NOR
44 # flash driver. And we need the real, fast memcpy 44 # flash driver. And we need the real, fast memcpy
45 # here. We have no problems with unaligned access. 45 # here. We have no problems with unaligned access.
46 ifndef CONFIG_SPL_BUILD 46 ifndef CONFIG_SPL_BUILD
47 # Workaround for local bus unaligned access problems 47 # Workaround for local bus unaligned access problems
48 # on MPC512x and MPC5200 48 # on MPC512x and MPC5200
49 ifdef CONFIG_MPC512X 49 ifdef CONFIG_MPC512X
50 AFLAGS_ppcstring.o += -Dmemcpy=__memcpy 50 AFLAGS_ppcstring.o += -Dmemcpy=__memcpy
51 obj-y += memcpy_mpc5200.o 51 obj-y += memcpy_mpc5200.o
52 endif 52 endif
53 ifdef CONFIG_MPC5200 53 ifdef CONFIG_MPC5200
54 AFLAGS_ppcstring.o += -Dmemcpy=__memcpy 54 AFLAGS_ppcstring.o += -Dmemcpy=__memcpy
55 obj-y += memcpy_mpc5200.o 55 obj-y += memcpy_mpc5200.o
56 endif 56 endif
57 endif 57 endif
58 58
59 endif # not minimal 59 endif # not minimal
60 60
61 ifdef CONFIG_SPL_BUILD 61 ifdef CONFIG_SPL_BUILD
62 obj-$(CONFIG_SPL_FRAMEWORK) += spl.o 62 obj-$(CONFIG_SPL_FRAMEWORK) += spl.o
63 endif 63 endif
64 64
board/freescale/m5253demo/m5253demo.c
1 /* 1 /*
2 * (C) Copyright 2000-2003 2 * (C) Copyright 2000-2003
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 * 4 *
5 * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc. 5 * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.
6 * Hayden Fraser (Hayden.Fraser@freescale.com) 6 * Hayden Fraser (Hayden.Fraser@freescale.com)
7 * 7 *
8 * SPDX-License-Identifier: GPL-2.0+ 8 * SPDX-License-Identifier: GPL-2.0+
9 */ 9 */
10 10
11 #include <common.h> 11 #include <common.h>
12 #include <asm/immap.h> 12 #include <asm/immap.h>
13 #include <netdev.h> 13 #include <netdev.h>
14 #include <asm/io.h> 14 #include <asm/io.h>
15 15
16 DECLARE_GLOBAL_DATA_PTR; 16 DECLARE_GLOBAL_DATA_PTR;
17 17
18 int checkboard(void) 18 int checkboard(void)
19 { 19 {
20 puts("Board: "); 20 puts("Board: ");
21 puts("Freescale MCF5253 DEMO\n"); 21 puts("Freescale MCF5253 DEMO\n");
22 return 0; 22 return 0;
23 }; 23 };
24 24
25 int dram_init(void) 25 int dram_init(void)
26 { 26 {
27 u32 dramsize = 0; 27 u32 dramsize = 0;
28 28
29 /* 29 /*
30 * Check to see if the SDRAM has already been initialized 30 * Check to see if the SDRAM has already been initialized
31 * by a run control tool 31 * by a run control tool
32 */ 32 */
33 if (!(mbar_readLong(MCFSIM_DCR) & 0x8000)) { 33 if (!(mbar_readLong(MCFSIM_DCR) & 0x8000)) {
34 u32 RC, temp; 34 u32 RC, temp;
35 35
36 RC = (CONFIG_SYS_CLK / 1000000) >> 1; 36 RC = (CONFIG_SYS_CLK / 1000000) >> 1;
37 RC = (RC * 15) >> 4; 37 RC = (RC * 15) >> 4;
38 38
39 /* Initialize DRAM Control Register: DCR */ 39 /* Initialize DRAM Control Register: DCR */
40 mbar_writeShort(MCFSIM_DCR, (0x8400 | RC)); 40 mbar_writeShort(MCFSIM_DCR, (0x8400 | RC));
41 __asm__("nop"); 41 __asm__("nop");
42 42
43 mbar_writeLong(MCFSIM_DACR0, 0x00003224); 43 mbar_writeLong(MCFSIM_DACR0, 0x00003224);
44 __asm__("nop"); 44 __asm__("nop");
45 45
46 /* Initialize DMR0 */ 46 /* Initialize DMR0 */
47 dramsize = (CONFIG_SYS_SDRAM_SIZE << 20); 47 dramsize = (CONFIG_SYS_SDRAM_SIZE << 20);
48 temp = (dramsize - 1) & 0xFFFC0000; 48 temp = (dramsize - 1) & 0xFFFC0000;
49 mbar_writeLong(MCFSIM_DMR0, temp | 1); 49 mbar_writeLong(MCFSIM_DMR0, temp | 1);
50 __asm__("nop"); 50 __asm__("nop");
51 51
52 mbar_writeLong(MCFSIM_DACR0, 0x0000322c); 52 mbar_writeLong(MCFSIM_DACR0, 0x0000322c);
53 mb(); 53 mb();
54 __asm__("nop"); 54 __asm__("nop");
55 55
56 /* Write to this block to initiate precharge */ 56 /* Write to this block to initiate precharge */
57 *(u32 *) (CONFIG_SYS_SDRAM_BASE) = 0xa5a5a5a5; 57 *(u32 *) (CONFIG_SYS_SDRAM_BASE) = 0xa5a5a5a5;
58 mb(); 58 mb();
59 __asm__("nop"); 59 __asm__("nop");
60 60
61 /* Set RE bit in DACR */ 61 /* Set RE bit in DACR */
62 mbar_writeLong(MCFSIM_DACR0, 62 mbar_writeLong(MCFSIM_DACR0,
63 mbar_readLong(MCFSIM_DACR0) | 0x8000); 63 mbar_readLong(MCFSIM_DACR0) | 0x8000);
64 __asm__("nop"); 64 __asm__("nop");
65 65
66 /* Wait for at least 8 auto refresh cycles to occur */ 66 /* Wait for at least 8 auto refresh cycles to occur */
67 udelay(500); 67 udelay(500);
68 68
69 /* Finish the configuration by issuing the MRS */ 69 /* Finish the configuration by issuing the MRS */
70 mbar_writeLong(MCFSIM_DACR0, 70 mbar_writeLong(MCFSIM_DACR0,
71 mbar_readLong(MCFSIM_DACR0) | 0x0040); 71 mbar_readLong(MCFSIM_DACR0) | 0x0040);
72 __asm__("nop"); 72 __asm__("nop");
73 73
74 *(u32 *) (CONFIG_SYS_SDRAM_BASE + 0x800) = 0xa5a5a5a5; 74 *(u32 *) (CONFIG_SYS_SDRAM_BASE + 0x800) = 0xa5a5a5a5;
75 mb(); 75 mb();
76 } 76 }
77 77
78 gd->ram_size = dramsize; 78 gd->ram_size = dramsize;
79 79
80 return 0; 80 return 0;
81 } 81 }
82 82
83 int testdram(void) 83 int testdram(void)
84 { 84 {
85 /* TODO: XXX XXX XXX */ 85 /* TODO: XXX XXX XXX */
86 printf("DRAM test not implemented!\n"); 86 printf("DRAM test not implemented!\n");
87 87
88 return (0); 88 return (0);
89 } 89 }
90 90
91 #ifdef CONFIG_CMD_IDE 91 #ifdef CONFIG_IDE
92 #include <ata.h> 92 #include <ata.h>
93 int ide_preinit(void) 93 int ide_preinit(void)
94 { 94 {
95 return (0); 95 return (0);
96 } 96 }
97 97
98 void ide_set_reset(int idereset) 98 void ide_set_reset(int idereset)
99 { 99 {
100 atac_t *ata = (atac_t *) CONFIG_SYS_ATA_BASE_ADDR; 100 atac_t *ata = (atac_t *) CONFIG_SYS_ATA_BASE_ADDR;
101 long period; 101 long period;
102 /* t1, t2, t3, t4, t5, t6, t9, tRD, tA */ 102 /* t1, t2, t3, t4, t5, t6, t9, tRD, tA */
103 int piotms[5][9] = { {70, 165, 60, 30, 50, 5, 20, 0, 35}, /* PIO 0 */ 103 int piotms[5][9] = { {70, 165, 60, 30, 50, 5, 20, 0, 35}, /* PIO 0 */
104 {50, 125, 45, 20, 35, 5, 15, 0, 35}, /* PIO 1 */ 104 {50, 125, 45, 20, 35, 5, 15, 0, 35}, /* PIO 1 */
105 {30, 100, 30, 15, 20, 5, 10, 0, 35}, /* PIO 2 */ 105 {30, 100, 30, 15, 20, 5, 10, 0, 35}, /* PIO 2 */
106 {30, 80, 30, 10, 20, 5, 10, 0, 35}, /* PIO 3 */ 106 {30, 80, 30, 10, 20, 5, 10, 0, 35}, /* PIO 3 */
107 {25, 70, 20, 10, 20, 5, 10, 0, 35} /* PIO 4 */ 107 {25, 70, 20, 10, 20, 5, 10, 0, 35} /* PIO 4 */
108 }; 108 };
109 109
110 if (idereset) { 110 if (idereset) {
111 /* control reset */ 111 /* control reset */
112 out_8(&ata->cr, 0); 112 out_8(&ata->cr, 0);
113 udelay(100); 113 udelay(100);
114 } else { 114 } else {
115 mbar2_writeLong(CIM_MISCCR, CIM_MISCCR_CPUEND); 115 mbar2_writeLong(CIM_MISCCR, CIM_MISCCR_CPUEND);
116 116
117 #define CALC_TIMING(t) (t + period - 1) / period 117 #define CALC_TIMING(t) (t + period - 1) / period
118 period = 1000000000 / (CONFIG_SYS_CLK / 2); /* period in ns */ 118 period = 1000000000 / (CONFIG_SYS_CLK / 2); /* period in ns */
119 119
120 /*ata->ton = CALC_TIMING (180); */ 120 /*ata->ton = CALC_TIMING (180); */
121 out_8(&ata->t1, CALC_TIMING(piotms[2][0])); 121 out_8(&ata->t1, CALC_TIMING(piotms[2][0]));
122 out_8(&ata->t2w, CALC_TIMING(piotms[2][1])); 122 out_8(&ata->t2w, CALC_TIMING(piotms[2][1]));
123 out_8(&ata->t2r, CALC_TIMING(piotms[2][1])); 123 out_8(&ata->t2r, CALC_TIMING(piotms[2][1]));
124 out_8(&ata->ta, CALC_TIMING(piotms[2][8])); 124 out_8(&ata->ta, CALC_TIMING(piotms[2][8]));
125 out_8(&ata->trd, CALC_TIMING(piotms[2][7])); 125 out_8(&ata->trd, CALC_TIMING(piotms[2][7]));
126 out_8(&ata->t4, CALC_TIMING(piotms[2][3])); 126 out_8(&ata->t4, CALC_TIMING(piotms[2][3]));
127 out_8(&ata->t9, CALC_TIMING(piotms[2][6])); 127 out_8(&ata->t9, CALC_TIMING(piotms[2][6]));
128 128
129 /* IORDY enable */ 129 /* IORDY enable */
130 out_8(&ata->cr, 0x40); 130 out_8(&ata->cr, 0x40);
131 udelay(2000); 131 udelay(2000);
132 /* IORDY enable */ 132 /* IORDY enable */
133 setbits_8(&ata->cr, 0x01); 133 setbits_8(&ata->cr, 0x01);
134 } 134 }
135 } 135 }
136 #endif /* CONFIG_CMD_IDE */ 136 #endif /* CONFIG_IDE */
137 137
138 138
139 #ifdef CONFIG_DRIVER_DM9000 139 #ifdef CONFIG_DRIVER_DM9000
140 int board_eth_init(bd_t *bis) 140 int board_eth_init(bd_t *bis)
141 { 141 {
142 return dm9000_initialize(bis); 142 return dm9000_initialize(bis);
143 } 143 }
144 #endif 144 #endif
145 145
board/freescale/m5253evbe/m5253evbe.c
1 /* 1 /*
2 * (C) Copyright 2000-2003 2 * (C) Copyright 2000-2003
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 * 4 *
5 * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc. 5 * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.
6 * Hayden Fraser (Hayden.Fraser@freescale.com) 6 * Hayden Fraser (Hayden.Fraser@freescale.com)
7 * 7 *
8 * SPDX-License-Identifier: GPL-2.0+ 8 * SPDX-License-Identifier: GPL-2.0+
9 */ 9 */
10 10
11 #include <common.h> 11 #include <common.h>
12 #include <asm/immap.h> 12 #include <asm/immap.h>
13 #include <asm/io.h> 13 #include <asm/io.h>
14 14
15 DECLARE_GLOBAL_DATA_PTR; 15 DECLARE_GLOBAL_DATA_PTR;
16 16
17 int checkboard(void) 17 int checkboard(void)
18 { 18 {
19 puts("Board: "); 19 puts("Board: ");
20 puts("Freescale MCF5253 EVBE\n"); 20 puts("Freescale MCF5253 EVBE\n");
21 return 0; 21 return 0;
22 }; 22 };
23 23
24 int dram_init(void) 24 int dram_init(void)
25 { 25 {
26 /* 26 /*
27 * Check to see if the SDRAM has already been initialized 27 * Check to see if the SDRAM has already been initialized
28 * by a run control tool 28 * by a run control tool
29 */ 29 */
30 if (!(mbar_readLong(MCFSIM_DCR) & 0x8000)) { 30 if (!(mbar_readLong(MCFSIM_DCR) & 0x8000)) {
31 u32 RC, dramsize; 31 u32 RC, dramsize;
32 32
33 RC = (CONFIG_SYS_CLK / 1000000) >> 1; 33 RC = (CONFIG_SYS_CLK / 1000000) >> 1;
34 RC = (RC * 15) >> 4; 34 RC = (RC * 15) >> 4;
35 35
36 /* Initialize DRAM Control Register: DCR */ 36 /* Initialize DRAM Control Register: DCR */
37 mbar_writeShort(MCFSIM_DCR, (0x8400 | RC)); 37 mbar_writeShort(MCFSIM_DCR, (0x8400 | RC));
38 asm("nop"); 38 asm("nop");
39 39
40 mbar_writeLong(MCFSIM_DACR0, 0x00002320); 40 mbar_writeLong(MCFSIM_DACR0, 0x00002320);
41 asm("nop"); 41 asm("nop");
42 42
43 /* Initialize DMR0 */ 43 /* Initialize DMR0 */
44 dramsize = ((CONFIG_SYS_SDRAM_SIZE << 20) - 1) & 0xFFFC0000; 44 dramsize = ((CONFIG_SYS_SDRAM_SIZE << 20) - 1) & 0xFFFC0000;
45 mbar_writeLong(MCFSIM_DMR0, dramsize | 1); 45 mbar_writeLong(MCFSIM_DMR0, dramsize | 1);
46 asm("nop"); 46 asm("nop");
47 47
48 mbar_writeLong(MCFSIM_DACR0, 0x00002328); 48 mbar_writeLong(MCFSIM_DACR0, 0x00002328);
49 asm("nop"); 49 asm("nop");
50 50
51 /* Write to this block to initiate precharge */ 51 /* Write to this block to initiate precharge */
52 *(u32 *) (CONFIG_SYS_SDRAM_BASE) = 0xa5a5a5a5; 52 *(u32 *) (CONFIG_SYS_SDRAM_BASE) = 0xa5a5a5a5;
53 asm("nop"); 53 asm("nop");
54 54
55 /* Set RE bit in DACR */ 55 /* Set RE bit in DACR */
56 mbar_writeLong(MCFSIM_DACR0, 56 mbar_writeLong(MCFSIM_DACR0,
57 mbar_readLong(MCFSIM_DACR0) | 0x8000); 57 mbar_readLong(MCFSIM_DACR0) | 0x8000);
58 asm("nop"); 58 asm("nop");
59 59
60 /* Wait for at least 8 auto refresh cycles to occur */ 60 /* Wait for at least 8 auto refresh cycles to occur */
61 udelay(500); 61 udelay(500);
62 62
63 /* Finish the configuration by issuing the MRS */ 63 /* Finish the configuration by issuing the MRS */
64 mbar_writeLong(MCFSIM_DACR0, 64 mbar_writeLong(MCFSIM_DACR0,
65 mbar_readLong(MCFSIM_DACR0) | 0x0040); 65 mbar_readLong(MCFSIM_DACR0) | 0x0040);
66 asm("nop"); 66 asm("nop");
67 67
68 *(u32 *) (CONFIG_SYS_SDRAM_BASE + 0x800) = 0xa5a5a5a5; 68 *(u32 *) (CONFIG_SYS_SDRAM_BASE + 0x800) = 0xa5a5a5a5;
69 } 69 }
70 70
71 gd->ram_size = CONFIG_SYS_SDRAM_SIZE * 1024 * 1024; 71 gd->ram_size = CONFIG_SYS_SDRAM_SIZE * 1024 * 1024;
72 72
73 return 0; 73 return 0;
74 } 74 }
75 75
76 int testdram(void) 76 int testdram(void)
77 { 77 {
78 /* TODO: XXX XXX XXX */ 78 /* TODO: XXX XXX XXX */
79 printf("DRAM test not implemented!\n"); 79 printf("DRAM test not implemented!\n");
80 80
81 return (0); 81 return (0);
82 } 82 }
83 83
84 #ifdef CONFIG_CMD_IDE 84 #ifdef CONFIG_IDE
85 #include <ata.h> 85 #include <ata.h>
86 int ide_preinit(void) 86 int ide_preinit(void)
87 { 87 {
88 return (0); 88 return (0);
89 } 89 }
90 90
91 void ide_set_reset(int idereset) 91 void ide_set_reset(int idereset)
92 { 92 {
93 atac_t *ata = (atac_t *) CONFIG_SYS_ATA_BASE_ADDR; 93 atac_t *ata = (atac_t *) CONFIG_SYS_ATA_BASE_ADDR;
94 long period; 94 long period;
95 /* t1, t2, t3, t4, t5, t6, t9, tRD, tA */ 95 /* t1, t2, t3, t4, t5, t6, t9, tRD, tA */
96 int piotms[5][9] = { {70, 165, 60, 30, 50, 5, 20, 0, 35}, /* PIO 0 */ 96 int piotms[5][9] = { {70, 165, 60, 30, 50, 5, 20, 0, 35}, /* PIO 0 */
97 {50, 125, 45, 20, 35, 5, 15, 0, 35}, /* PIO 1 */ 97 {50, 125, 45, 20, 35, 5, 15, 0, 35}, /* PIO 1 */
98 {30, 100, 30, 15, 20, 5, 10, 0, 35}, /* PIO 2 */ 98 {30, 100, 30, 15, 20, 5, 10, 0, 35}, /* PIO 2 */
99 {30, 80, 30, 10, 20, 5, 10, 0, 35}, /* PIO 3 */ 99 {30, 80, 30, 10, 20, 5, 10, 0, 35}, /* PIO 3 */
100 {25, 70, 20, 10, 20, 5, 10, 0, 35} /* PIO 4 */ 100 {25, 70, 20, 10, 20, 5, 10, 0, 35} /* PIO 4 */
101 }; 101 };
102 102
103 if (idereset) { 103 if (idereset) {
104 /* control reset */ 104 /* control reset */
105 out_8(&ata->cr, 0); 105 out_8(&ata->cr, 0);
106 udelay(100); 106 udelay(100);
107 } else { 107 } else {
108 mbar2_writeLong(CIM_MISCCR, CIM_MISCCR_CPUEND); 108 mbar2_writeLong(CIM_MISCCR, CIM_MISCCR_CPUEND);
109 109
110 #define CALC_TIMING(t) (t + period - 1) / period 110 #define CALC_TIMING(t) (t + period - 1) / period
111 period = 1000000000 / (CONFIG_SYS_CLK / 2); /* period in ns */ 111 period = 1000000000 / (CONFIG_SYS_CLK / 2); /* period in ns */
112 112
113 /*ata->ton = CALC_TIMING (180); */ 113 /*ata->ton = CALC_TIMING (180); */
114 out_8(&ata->t1, CALC_TIMING(piotms[2][0])); 114 out_8(&ata->t1, CALC_TIMING(piotms[2][0]));
115 out_8(&ata->t2w, CALC_TIMING(piotms[2][1])); 115 out_8(&ata->t2w, CALC_TIMING(piotms[2][1]));
116 out_8(&ata->t2r, CALC_TIMING(piotms[2][1])); 116 out_8(&ata->t2r, CALC_TIMING(piotms[2][1]));
117 out_8(&ata->ta, CALC_TIMING(piotms[2][8])); 117 out_8(&ata->ta, CALC_TIMING(piotms[2][8]));
118 out_8(&ata->trd, CALC_TIMING(piotms[2][7])); 118 out_8(&ata->trd, CALC_TIMING(piotms[2][7]));
119 out_8(&ata->t4, CALC_TIMING(piotms[2][3])); 119 out_8(&ata->t4, CALC_TIMING(piotms[2][3]));
120 out_8(&ata->t9, CALC_TIMING(piotms[2][6])); 120 out_8(&ata->t9, CALC_TIMING(piotms[2][6]));
121 121
122 /* IORDY enable */ 122 /* IORDY enable */
123 out_8(&ata->cr, 0x40); 123 out_8(&ata->cr, 0x40);
124 udelay(2000); 124 udelay(2000);
125 /* IORDY enable */ 125 /* IORDY enable */
126 setbits_8(&ata->cr, 0x01); 126 setbits_8(&ata->cr, 0x01);
127 } 127 }
128 } 128 }
129 #endif /* CONFIG_CMD_IDE */ 129 #endif /* CONFIG_IDE */
130 130
board/freescale/m54455evb/m54455evb.c
1 /* 1 /*
2 * (C) Copyright 2000-2003 2 * (C) Copyright 2000-2003
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 * 4 *
5 * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc. 5 * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.
6 * TsiChung Liew (Tsi-Chung.Liew@freescale.com) 6 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
7 * 7 *
8 * SPDX-License-Identifier: GPL-2.0+ 8 * SPDX-License-Identifier: GPL-2.0+
9 */ 9 */
10 10
11 #include <common.h> 11 #include <common.h>
12 #include <pci.h> 12 #include <pci.h>
13 #include <asm/immap.h> 13 #include <asm/immap.h>
14 #include <asm/io.h> 14 #include <asm/io.h>
15 15
16 DECLARE_GLOBAL_DATA_PTR; 16 DECLARE_GLOBAL_DATA_PTR;
17 17
18 int checkboard(void) 18 int checkboard(void)
19 { 19 {
20 puts("Board: "); 20 puts("Board: ");
21 puts("Freescale M54455 EVB\n"); 21 puts("Freescale M54455 EVB\n");
22 return 0; 22 return 0;
23 }; 23 };
24 24
25 int dram_init(void) 25 int dram_init(void)
26 { 26 {
27 u32 dramsize; 27 u32 dramsize;
28 #ifdef CONFIG_CF_SBF 28 #ifdef CONFIG_CF_SBF
29 /* 29 /*
30 * Serial Boot: The dram is already initialized in start.S 30 * Serial Boot: The dram is already initialized in start.S
31 * only require to return DRAM size 31 * only require to return DRAM size
32 */ 32 */
33 dramsize = CONFIG_SYS_SDRAM_SIZE * 0x100000 >> 1; 33 dramsize = CONFIG_SYS_SDRAM_SIZE * 0x100000 >> 1;
34 #else 34 #else
35 sdramc_t *sdram = (sdramc_t *)(MMAP_SDRAM); 35 sdramc_t *sdram = (sdramc_t *)(MMAP_SDRAM);
36 gpio_t *gpio = (gpio_t *)(MMAP_GPIO); 36 gpio_t *gpio = (gpio_t *)(MMAP_GPIO);
37 u32 i; 37 u32 i;
38 38
39 dramsize = CONFIG_SYS_SDRAM_SIZE * 0x100000 >> 1; 39 dramsize = CONFIG_SYS_SDRAM_SIZE * 0x100000 >> 1;
40 40
41 for (i = 0x13; i < 0x20; i++) { 41 for (i = 0x13; i < 0x20; i++) {
42 if (dramsize == (1 << i)) 42 if (dramsize == (1 << i))
43 break; 43 break;
44 } 44 }
45 i--; 45 i--;
46 46
47 out_8(&gpio->mscr_sdram, CONFIG_SYS_SDRAM_DRV_STRENGTH); 47 out_8(&gpio->mscr_sdram, CONFIG_SYS_SDRAM_DRV_STRENGTH);
48 48
49 out_be32(&sdram->sdcs0, CONFIG_SYS_SDRAM_BASE | i); 49 out_be32(&sdram->sdcs0, CONFIG_SYS_SDRAM_BASE | i);
50 out_be32(&sdram->sdcs1, CONFIG_SYS_SDRAM_BASE1 | i); 50 out_be32(&sdram->sdcs1, CONFIG_SYS_SDRAM_BASE1 | i);
51 51
52 out_be32(&sdram->sdcfg1, CONFIG_SYS_SDRAM_CFG1); 52 out_be32(&sdram->sdcfg1, CONFIG_SYS_SDRAM_CFG1);
53 out_be32(&sdram->sdcfg2, CONFIG_SYS_SDRAM_CFG2); 53 out_be32(&sdram->sdcfg2, CONFIG_SYS_SDRAM_CFG2);
54 54
55 /* Issue PALL */ 55 /* Issue PALL */
56 out_be32(&sdram->sdcr, CONFIG_SYS_SDRAM_CTRL | 2); 56 out_be32(&sdram->sdcr, CONFIG_SYS_SDRAM_CTRL | 2);
57 57
58 /* Issue LEMR */ 58 /* Issue LEMR */
59 out_be32(&sdram->sdmr, CONFIG_SYS_SDRAM_EMOD | 0x408); 59 out_be32(&sdram->sdmr, CONFIG_SYS_SDRAM_EMOD | 0x408);
60 out_be32(&sdram->sdmr, CONFIG_SYS_SDRAM_MODE | 0x300); 60 out_be32(&sdram->sdmr, CONFIG_SYS_SDRAM_MODE | 0x300);
61 61
62 udelay(500); 62 udelay(500);
63 63
64 /* Issue PALL */ 64 /* Issue PALL */
65 out_be32(&sdram->sdcr, CONFIG_SYS_SDRAM_CTRL | 2); 65 out_be32(&sdram->sdcr, CONFIG_SYS_SDRAM_CTRL | 2);
66 66
67 /* Perform two refresh cycles */ 67 /* Perform two refresh cycles */
68 out_be32(&sdram->sdcr, CONFIG_SYS_SDRAM_CTRL | 4); 68 out_be32(&sdram->sdcr, CONFIG_SYS_SDRAM_CTRL | 4);
69 out_be32(&sdram->sdcr, CONFIG_SYS_SDRAM_CTRL | 4); 69 out_be32(&sdram->sdcr, CONFIG_SYS_SDRAM_CTRL | 4);
70 70
71 out_be32(&sdram->sdmr, CONFIG_SYS_SDRAM_MODE | 0x200); 71 out_be32(&sdram->sdmr, CONFIG_SYS_SDRAM_MODE | 0x200);
72 72
73 out_be32(&sdram->sdcr, 73 out_be32(&sdram->sdcr,
74 (CONFIG_SYS_SDRAM_CTRL & ~0x80000000) | 0x10000c00); 74 (CONFIG_SYS_SDRAM_CTRL & ~0x80000000) | 0x10000c00);
75 75
76 udelay(100); 76 udelay(100);
77 #endif 77 #endif
78 gd->ram_size = dramsize << 1; 78 gd->ram_size = dramsize << 1;
79 79
80 return 0; 80 return 0;
81 }; 81 };
82 82
83 int testdram(void) 83 int testdram(void)
84 { 84 {
85 /* TODO: XXX XXX XXX */ 85 /* TODO: XXX XXX XXX */
86 printf("DRAM test not implemented!\n"); 86 printf("DRAM test not implemented!\n");
87 87
88 return (0); 88 return (0);
89 } 89 }
90 90
91 #if defined(CONFIG_CMD_IDE) 91 #if defined(CONFIG_IDE)
92 #include <ata.h> 92 #include <ata.h>
93 93
94 int ide_preinit(void) 94 int ide_preinit(void)
95 { 95 {
96 gpio_t *gpio = (gpio_t *) MMAP_GPIO; 96 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
97 u32 tmp; 97 u32 tmp;
98 98
99 tmp = (in_8(&gpio->par_fec) & GPIO_PAR_FEC_FEC1_UNMASK) | 0x10; 99 tmp = (in_8(&gpio->par_fec) & GPIO_PAR_FEC_FEC1_UNMASK) | 0x10;
100 setbits_8(&gpio->par_fec, tmp); 100 setbits_8(&gpio->par_fec, tmp);
101 tmp = ((in_be16(&gpio->par_feci2c) & 0xf0ff) | 101 tmp = ((in_be16(&gpio->par_feci2c) & 0xf0ff) |
102 (GPIO_PAR_FECI2C_MDC1_ATA_DIOR | GPIO_PAR_FECI2C_MDIO1_ATA_DIOW)); 102 (GPIO_PAR_FECI2C_MDC1_ATA_DIOR | GPIO_PAR_FECI2C_MDIO1_ATA_DIOW));
103 setbits_be16(&gpio->par_feci2c, tmp); 103 setbits_be16(&gpio->par_feci2c, tmp);
104 104
105 setbits_be16(&gpio->par_ata, 105 setbits_be16(&gpio->par_ata,
106 GPIO_PAR_ATA_BUFEN | GPIO_PAR_ATA_CS1 | GPIO_PAR_ATA_CS0 | 106 GPIO_PAR_ATA_BUFEN | GPIO_PAR_ATA_CS1 | GPIO_PAR_ATA_CS0 |
107 GPIO_PAR_ATA_DA2 | GPIO_PAR_ATA_DA1 | GPIO_PAR_ATA_DA0 | 107 GPIO_PAR_ATA_DA2 | GPIO_PAR_ATA_DA1 | GPIO_PAR_ATA_DA0 |
108 GPIO_PAR_ATA_RESET_RESET | GPIO_PAR_ATA_DMARQ_DMARQ | 108 GPIO_PAR_ATA_RESET_RESET | GPIO_PAR_ATA_DMARQ_DMARQ |
109 GPIO_PAR_ATA_IORDY_IORDY); 109 GPIO_PAR_ATA_IORDY_IORDY);
110 setbits_be16(&gpio->par_pci, 110 setbits_be16(&gpio->par_pci,
111 GPIO_PAR_PCI_GNT3_ATA_DMACK | GPIO_PAR_PCI_REQ3_ATA_INTRQ); 111 GPIO_PAR_PCI_GNT3_ATA_DMACK | GPIO_PAR_PCI_REQ3_ATA_INTRQ);
112 112
113 return (0); 113 return (0);
114 } 114 }
115 115
116 void ide_set_reset(int idereset) 116 void ide_set_reset(int idereset)
117 { 117 {
118 atac_t *ata = (atac_t *) MMAP_ATA; 118 atac_t *ata = (atac_t *) MMAP_ATA;
119 long period; 119 long period;
120 /* t1, t2, t3, t4, t5, t6, t9, tRD, tA */ 120 /* t1, t2, t3, t4, t5, t6, t9, tRD, tA */
121 int piotms[5][9] = { 121 int piotms[5][9] = {
122 {70, 165, 60, 30, 50, 5, 20, 0, 35}, /* PIO 0 */ 122 {70, 165, 60, 30, 50, 5, 20, 0, 35}, /* PIO 0 */
123 {50, 125, 45, 20, 35, 5, 15, 0, 35}, /* PIO 1 */ 123 {50, 125, 45, 20, 35, 5, 15, 0, 35}, /* PIO 1 */
124 {30, 100, 30, 15, 20, 5, 10, 0, 35}, /* PIO 2 */ 124 {30, 100, 30, 15, 20, 5, 10, 0, 35}, /* PIO 2 */
125 {30, 80, 30, 10, 20, 5, 10, 0, 35}, /* PIO 3 */ 125 {30, 80, 30, 10, 20, 5, 10, 0, 35}, /* PIO 3 */
126 {25, 70, 20, 10, 20, 5, 10, 0, 35} 126 {25, 70, 20, 10, 20, 5, 10, 0, 35}
127 }; /* PIO 4 */ 127 }; /* PIO 4 */
128 128
129 if (idereset) { 129 if (idereset) {
130 /* control reset */ 130 /* control reset */
131 out_8(&ata->cr, 0); 131 out_8(&ata->cr, 0);
132 udelay(10000); 132 udelay(10000);
133 } else { 133 } else {
134 #define CALC_TIMING(t) (t + period - 1) / period 134 #define CALC_TIMING(t) (t + period - 1) / period
135 period = 1000000000 / gd->bus_clk; /* period in ns */ 135 period = 1000000000 / gd->bus_clk; /* period in ns */
136 136
137 /*ata->ton = CALC_TIMING (180); */ 137 /*ata->ton = CALC_TIMING (180); */
138 out_8(&ata->t1, CALC_TIMING(piotms[2][0])); 138 out_8(&ata->t1, CALC_TIMING(piotms[2][0]));
139 out_8(&ata->t2w, CALC_TIMING(piotms[2][1])); 139 out_8(&ata->t2w, CALC_TIMING(piotms[2][1]));
140 out_8(&ata->t2r, CALC_TIMING(piotms[2][1])); 140 out_8(&ata->t2r, CALC_TIMING(piotms[2][1]));
141 out_8(&ata->ta, CALC_TIMING(piotms[2][8])); 141 out_8(&ata->ta, CALC_TIMING(piotms[2][8]));
142 out_8(&ata->trd, CALC_TIMING(piotms[2][7])); 142 out_8(&ata->trd, CALC_TIMING(piotms[2][7]));
143 out_8(&ata->t4, CALC_TIMING(piotms[2][3])); 143 out_8(&ata->t4, CALC_TIMING(piotms[2][3]));
144 out_8(&ata->t9, CALC_TIMING(piotms[2][6])); 144 out_8(&ata->t9, CALC_TIMING(piotms[2][6]));
145 145
146 /* IORDY enable */ 146 /* IORDY enable */
147 out_8(&ata->cr, 0x40); 147 out_8(&ata->cr, 0x40);
148 udelay(200000); 148 udelay(200000);
149 /* IORDY enable */ 149 /* IORDY enable */
150 setbits_8(&ata->cr, 0x01); 150 setbits_8(&ata->cr, 0x01);
151 } 151 }
152 } 152 }
153 #endif 153 #endif
154 154
155 #if defined(CONFIG_PCI) 155 #if defined(CONFIG_PCI)
156 /* 156 /*
157 * Initialize PCI devices, report devices found. 157 * Initialize PCI devices, report devices found.
158 */ 158 */
159 static struct pci_controller hose; 159 static struct pci_controller hose;
160 extern void pci_mcf5445x_init(struct pci_controller *hose); 160 extern void pci_mcf5445x_init(struct pci_controller *hose);
161 161
162 void pci_init_board(void) 162 void pci_init_board(void)
163 { 163 {
164 pci_mcf5445x_init(&hose); 164 pci_mcf5445x_init(&hose);
165 } 165 }
166 #endif /* CONFIG_PCI */ 166 #endif /* CONFIG_PCI */
167 167
168 #if defined(CONFIG_FLASH_CFI_LEGACY) 168 #if defined(CONFIG_FLASH_CFI_LEGACY)
169 #include <flash.h> 169 #include <flash.h>
170 ulong board_flash_get_legacy (ulong base, int banknum, flash_info_t * info) 170 ulong board_flash_get_legacy (ulong base, int banknum, flash_info_t * info)
171 { 171 {
172 int sect[] = CONFIG_SYS_ATMEL_SECT; 172 int sect[] = CONFIG_SYS_ATMEL_SECT;
173 int sectsz[] = CONFIG_SYS_ATMEL_SECTSZ; 173 int sectsz[] = CONFIG_SYS_ATMEL_SECTSZ;
174 int i, j, k; 174 int i, j, k;
175 175
176 if (base != CONFIG_SYS_ATMEL_BASE) 176 if (base != CONFIG_SYS_ATMEL_BASE)
177 return 0; 177 return 0;
178 178
179 info->flash_id = 0x01000000; 179 info->flash_id = 0x01000000;
180 info->portwidth = 1; 180 info->portwidth = 1;
181 info->chipwidth = 1; 181 info->chipwidth = 1;
182 info->buffer_size = 1; 182 info->buffer_size = 1;
183 info->erase_blk_tout = 16384; 183 info->erase_blk_tout = 16384;
184 info->write_tout = 2; 184 info->write_tout = 2;
185 info->buffer_write_tout = 5; 185 info->buffer_write_tout = 5;
186 info->vendor = 0xFFF0; /* CFI_CMDSET_AMD_LEGACY */ 186 info->vendor = 0xFFF0; /* CFI_CMDSET_AMD_LEGACY */
187 info->cmd_reset = 0x00F0; 187 info->cmd_reset = 0x00F0;
188 info->interface = FLASH_CFI_X8; 188 info->interface = FLASH_CFI_X8;
189 info->legacy_unlock = 0; 189 info->legacy_unlock = 0;
190 info->manufacturer_id = (u16) ATM_MANUFACT; 190 info->manufacturer_id = (u16) ATM_MANUFACT;
191 info->device_id = ATM_ID_LV040; 191 info->device_id = ATM_ID_LV040;
192 info->device_id2 = 0; 192 info->device_id2 = 0;
193 193
194 info->ext_addr = 0; 194 info->ext_addr = 0;
195 info->cfi_version = 0x3133; 195 info->cfi_version = 0x3133;
196 info->cfi_offset = 0x0000; 196 info->cfi_offset = 0x0000;
197 info->addr_unlock1 = 0x00000555; 197 info->addr_unlock1 = 0x00000555;
198 info->addr_unlock2 = 0x000002AA; 198 info->addr_unlock2 = 0x000002AA;
199 info->name = "CFI conformant"; 199 info->name = "CFI conformant";
200 200
201 info->size = 0; 201 info->size = 0;
202 info->sector_count = CONFIG_SYS_ATMEL_TOTALSECT; 202 info->sector_count = CONFIG_SYS_ATMEL_TOTALSECT;
203 info->start[0] = base; 203 info->start[0] = base;
204 for (k = 0, i = 0; i < CONFIG_SYS_ATMEL_REGION; i++) { 204 for (k = 0, i = 0; i < CONFIG_SYS_ATMEL_REGION; i++) {
205 info->size += sect[i] * sectsz[i]; 205 info->size += sect[i] * sectsz[i];
206 206
207 for (j = 0; j < sect[i]; j++, k++) { 207 for (j = 0; j < sect[i]; j++, k++) {
208 info->start[k + 1] = info->start[k] + sectsz[i]; 208 info->start[k + 1] = info->start[k] + sectsz[i];
209 info->protect[k] = 0; 209 info->protect[k] = 0;
210 } 210 }
211 } 211 }
212 212
213 return 1; 213 return 1;
214 } 214 }
215 #endif /* CONFIG_SYS_FLASH_CFI */ 215 #endif /* CONFIG_SYS_FLASH_CFI */
216 216
board/intercontrol/digsy_mtc/digsy_mtc.c
1 /* 1 /*
2 * (C) Copyright 2003 2 * (C) Copyright 2003
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 * 4 *
5 * (C) Copyright 2004 5 * (C) Copyright 2004
6 * Mark Jonas, Freescale Semiconductor, mark.jonas@motorola.com. 6 * Mark Jonas, Freescale Semiconductor, mark.jonas@motorola.com.
7 * 7 *
8 * (C) Copyright 2005-2009 8 * (C) Copyright 2005-2009
9 * Modified for InterControl digsyMTC MPC5200 board by 9 * Modified for InterControl digsyMTC MPC5200 board by
10 * Frank Bodammer, GCD Hard- & Software GmbH, 10 * Frank Bodammer, GCD Hard- & Software GmbH,
11 * frank.bodammer@gcd-solutions.de 11 * frank.bodammer@gcd-solutions.de
12 * 12 *
13 * (C) Copyright 2009 13 * (C) Copyright 2009
14 * Grzegorz Bernacki, Semihalf, gjb@semihalf.com 14 * Grzegorz Bernacki, Semihalf, gjb@semihalf.com
15 * 15 *
16 * SPDX-License-Identifier: GPL-2.0+ 16 * SPDX-License-Identifier: GPL-2.0+
17 */ 17 */
18 18
19 #include <common.h> 19 #include <common.h>
20 #include <mpc5xxx.h> 20 #include <mpc5xxx.h>
21 #include <net.h> 21 #include <net.h>
22 #include <pci.h> 22 #include <pci.h>
23 #include <asm/processor.h> 23 #include <asm/processor.h>
24 #include <asm/io.h> 24 #include <asm/io.h>
25 #include "eeprom.h" 25 #include "eeprom.h"
26 #if defined(CONFIG_DIGSY_REV5) 26 #if defined(CONFIG_DIGSY_REV5)
27 #include "is45s16800a2.h" 27 #include "is45s16800a2.h"
28 #include <mtd/cfi_flash.h> 28 #include <mtd/cfi_flash.h>
29 #include <flash.h> 29 #include <flash.h>
30 #else 30 #else
31 #include "is42s16800a-7t.h" 31 #include "is42s16800a-7t.h"
32 #endif 32 #endif
33 #include <libfdt.h> 33 #include <libfdt.h>
34 #include <fdt_support.h> 34 #include <fdt_support.h>
35 #include <i2c.h> 35 #include <i2c.h>
36 #include <mb862xx.h> 36 #include <mb862xx.h>
37 37
38 DECLARE_GLOBAL_DATA_PTR; 38 DECLARE_GLOBAL_DATA_PTR;
39 39
40 extern int usb_cpu_init(void); 40 extern int usb_cpu_init(void);
41 41
42 #if defined(CONFIG_DIGSY_REV5) 42 #if defined(CONFIG_DIGSY_REV5)
43 /* 43 /*
44 * The M29W128GH needs a special reset command function, 44 * The M29W128GH needs a special reset command function,
45 * details see the doc/README.cfi file 45 * details see the doc/README.cfi file
46 */ 46 */
47 void flash_cmd_reset(flash_info_t *info) 47 void flash_cmd_reset(flash_info_t *info)
48 { 48 {
49 flash_write_cmd(info, 0, 0, AMD_CMD_RESET); 49 flash_write_cmd(info, 0, 0, AMD_CMD_RESET);
50 } 50 }
51 #endif 51 #endif
52 52
53 #ifndef CONFIG_SYS_RAMBOOT 53 #ifndef CONFIG_SYS_RAMBOOT
54 static void sdram_start(int hi_addr) 54 static void sdram_start(int hi_addr)
55 { 55 {
56 long hi_addr_bit = hi_addr ? 0x01000000 : 0; 56 long hi_addr_bit = hi_addr ? 0x01000000 : 0;
57 long control = SDRAM_CONTROL | hi_addr_bit; 57 long control = SDRAM_CONTROL | hi_addr_bit;
58 58
59 /* unlock mode register */ 59 /* unlock mode register */
60 out_be32((void *)MPC5XXX_SDRAM_CTRL, control | 0x80000000); 60 out_be32((void *)MPC5XXX_SDRAM_CTRL, control | 0x80000000);
61 61
62 /* precharge all banks */ 62 /* precharge all banks */
63 out_be32((void *)MPC5XXX_SDRAM_CTRL, control | 0x80000002); 63 out_be32((void *)MPC5XXX_SDRAM_CTRL, control | 0x80000002);
64 64
65 /* auto refresh */ 65 /* auto refresh */
66 out_be32((void *)MPC5XXX_SDRAM_CTRL, control | 0x80000004); 66 out_be32((void *)MPC5XXX_SDRAM_CTRL, control | 0x80000004);
67 67
68 /* set mode register */ 68 /* set mode register */
69 out_be32((void *)MPC5XXX_SDRAM_MODE, SDRAM_MODE); 69 out_be32((void *)MPC5XXX_SDRAM_MODE, SDRAM_MODE);
70 70
71 /* normal operation */ 71 /* normal operation */
72 out_be32((void *)MPC5XXX_SDRAM_CTRL, control); 72 out_be32((void *)MPC5XXX_SDRAM_CTRL, control);
73 } 73 }
74 #endif 74 #endif
75 75
76 /* 76 /*
77 * ATTENTION: Although partially referenced dram_init does NOT make real use 77 * ATTENTION: Although partially referenced dram_init does NOT make real use
78 * use of CONFIG_SYS_SDRAM_BASE. The code does not work if 78 * use of CONFIG_SYS_SDRAM_BASE. The code does not work if
79 * CONFIG_SYS_SDRAM_BASE is something other than 0x00000000. 79 * CONFIG_SYS_SDRAM_BASE is something other than 0x00000000.
80 */ 80 */
81 81
82 int dram_init(void) 82 int dram_init(void)
83 { 83 {
84 ulong dramsize = 0; 84 ulong dramsize = 0;
85 ulong dramsize2 = 0; 85 ulong dramsize2 = 0;
86 uint svr, pvr; 86 uint svr, pvr;
87 #ifndef CONFIG_SYS_RAMBOOT 87 #ifndef CONFIG_SYS_RAMBOOT
88 ulong test1, test2; 88 ulong test1, test2;
89 89
90 /* setup SDRAM chip selects */ 90 /* setup SDRAM chip selects */
91 out_be32((void *)MPC5XXX_SDRAM_CS0CFG, 0x0000001C); /* 512MB at 0x0 */ 91 out_be32((void *)MPC5XXX_SDRAM_CS0CFG, 0x0000001C); /* 512MB at 0x0 */
92 out_be32((void *)MPC5XXX_SDRAM_CS1CFG, 0x80000000); /* disabled */ 92 out_be32((void *)MPC5XXX_SDRAM_CS1CFG, 0x80000000); /* disabled */
93 93
94 /* setup config registers */ 94 /* setup config registers */
95 out_be32((void *)MPC5XXX_SDRAM_CONFIG1, SDRAM_CONFIG1); 95 out_be32((void *)MPC5XXX_SDRAM_CONFIG1, SDRAM_CONFIG1);
96 out_be32((void *)MPC5XXX_SDRAM_CONFIG2, SDRAM_CONFIG2); 96 out_be32((void *)MPC5XXX_SDRAM_CONFIG2, SDRAM_CONFIG2);
97 97
98 /* find RAM size using SDRAM CS0 only */ 98 /* find RAM size using SDRAM CS0 only */
99 sdram_start(0); 99 sdram_start(0);
100 test1 = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, 0x08000000); 100 test1 = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, 0x08000000);
101 sdram_start(1); 101 sdram_start(1);
102 test2 = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, 0x08000000); 102 test2 = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, 0x08000000);
103 if (test1 > test2) { 103 if (test1 > test2) {
104 sdram_start(0); 104 sdram_start(0);
105 dramsize = test1; 105 dramsize = test1;
106 } else { 106 } else {
107 dramsize = test2; 107 dramsize = test2;
108 } 108 }
109 109
110 /* memory smaller than 1MB is impossible */ 110 /* memory smaller than 1MB is impossible */
111 if (dramsize < (1 << 20)) 111 if (dramsize < (1 << 20))
112 dramsize = 0; 112 dramsize = 0;
113 113
114 /* set SDRAM CS0 size according to the amount of RAM found */ 114 /* set SDRAM CS0 size according to the amount of RAM found */
115 if (dramsize > 0) { 115 if (dramsize > 0) {
116 out_be32((void *)MPC5XXX_SDRAM_CS0CFG, 116 out_be32((void *)MPC5XXX_SDRAM_CS0CFG,
117 (0x13 + __builtin_ffs(dramsize >> 20) - 1)); 117 (0x13 + __builtin_ffs(dramsize >> 20) - 1));
118 } else { 118 } else {
119 out_be32((void *)MPC5XXX_SDRAM_CS0CFG, 0); /* disabled */ 119 out_be32((void *)MPC5XXX_SDRAM_CS0CFG, 0); /* disabled */
120 } 120 }
121 121
122 /* let SDRAM CS1 start right after CS0 */ 122 /* let SDRAM CS1 start right after CS0 */
123 out_be32((void *)MPC5XXX_SDRAM_CS1CFG, dramsize + 0x0000001C); 123 out_be32((void *)MPC5XXX_SDRAM_CS1CFG, dramsize + 0x0000001C);
124 124
125 /* find RAM size using SDRAM CS1 only */ 125 /* find RAM size using SDRAM CS1 only */
126 test1 = get_ram_size((long *)(CONFIG_SYS_SDRAM_BASE + dramsize), 126 test1 = get_ram_size((long *)(CONFIG_SYS_SDRAM_BASE + dramsize),
127 0x08000000); 127 0x08000000);
128 dramsize2 = test1; 128 dramsize2 = test1;
129 129
130 /* memory smaller than 1MB is impossible */ 130 /* memory smaller than 1MB is impossible */
131 if (dramsize2 < (1 << 20)) 131 if (dramsize2 < (1 << 20))
132 dramsize2 = 0; 132 dramsize2 = 0;
133 133
134 /* set SDRAM CS1 size according to the amount of RAM found */ 134 /* set SDRAM CS1 size according to the amount of RAM found */
135 if (dramsize2 > 0) { 135 if (dramsize2 > 0) {
136 out_be32((void *)MPC5XXX_SDRAM_CS1CFG, (dramsize | 136 out_be32((void *)MPC5XXX_SDRAM_CS1CFG, (dramsize |
137 (0x13 + __builtin_ffs(dramsize2 >> 20) - 1))); 137 (0x13 + __builtin_ffs(dramsize2 >> 20) - 1)));
138 } else { 138 } else {
139 out_be32((void *)MPC5XXX_SDRAM_CS1CFG, dramsize); /* disabled */ 139 out_be32((void *)MPC5XXX_SDRAM_CS1CFG, dramsize); /* disabled */
140 } 140 }
141 141
142 #else /* CONFIG_SYS_RAMBOOT */ 142 #else /* CONFIG_SYS_RAMBOOT */
143 143
144 /* retrieve size of memory connected to SDRAM CS0 */ 144 /* retrieve size of memory connected to SDRAM CS0 */
145 dramsize = in_be32((void *)MPC5XXX_SDRAM_CS0CFG) & 0xFF; 145 dramsize = in_be32((void *)MPC5XXX_SDRAM_CS0CFG) & 0xFF;
146 if (dramsize >= 0x13) 146 if (dramsize >= 0x13)
147 dramsize = (1 << (dramsize - 0x13)) << 20; 147 dramsize = (1 << (dramsize - 0x13)) << 20;
148 else 148 else
149 dramsize = 0; 149 dramsize = 0;
150 150
151 /* retrieve size of memory connected to SDRAM CS1 */ 151 /* retrieve size of memory connected to SDRAM CS1 */
152 dramsize2 = in_be32((void *)MPC5XXX_SDRAM_CS1CFG) & 0xFF; 152 dramsize2 = in_be32((void *)MPC5XXX_SDRAM_CS1CFG) & 0xFF;
153 if (dramsize2 >= 0x13) 153 if (dramsize2 >= 0x13)
154 dramsize2 = (1 << (dramsize2 - 0x13)) << 20; 154 dramsize2 = (1 << (dramsize2 - 0x13)) << 20;
155 else 155 else
156 dramsize2 = 0; 156 dramsize2 = 0;
157 157
158 #endif /* CONFIG_SYS_RAMBOOT */ 158 #endif /* CONFIG_SYS_RAMBOOT */
159 159
160 /* 160 /*
161 * On MPC5200B we need to set the special configuration delay in the 161 * On MPC5200B we need to set the special configuration delay in the
162 * DDR controller. Please refer to Freescale's AN3221 "MPC5200B SDRAM 162 * DDR controller. Please refer to Freescale's AN3221 "MPC5200B SDRAM
163 * Initialization and Configuration", 3.3.1 SDelay--MBAR + 0x0190: 163 * Initialization and Configuration", 3.3.1 SDelay--MBAR + 0x0190:
164 * 164 *
165 * "The SDelay should be written to a value of 0x00000004. It is 165 * "The SDelay should be written to a value of 0x00000004. It is
166 * required to account for changes caused by normal wafer processing 166 * required to account for changes caused by normal wafer processing
167 * parameters." 167 * parameters."
168 */ 168 */
169 svr = get_svr(); 169 svr = get_svr();
170 pvr = get_pvr(); 170 pvr = get_pvr();
171 if ((SVR_MJREV(svr) >= 2) && 171 if ((SVR_MJREV(svr) >= 2) &&
172 (PVR_MAJ(pvr) == 1) && (PVR_MIN(pvr) == 4)) 172 (PVR_MAJ(pvr) == 1) && (PVR_MIN(pvr) == 4))
173 out_be32((void *)MPC5XXX_SDRAM_SDELAY, 0x04); 173 out_be32((void *)MPC5XXX_SDRAM_SDELAY, 0x04);
174 174
175 gd->ram_size = dramsize + dramsize2; 175 gd->ram_size = dramsize + dramsize2;
176 176
177 return 0; 177 return 0;
178 } 178 }
179 179
180 int checkboard(void) 180 int checkboard(void)
181 { 181 {
182 char buf[64]; 182 char buf[64];
183 int i = getenv_f("serial#", buf, sizeof(buf)); 183 int i = getenv_f("serial#", buf, sizeof(buf));
184 184
185 puts ("Board: InterControl digsyMTC"); 185 puts ("Board: InterControl digsyMTC");
186 #if defined(CONFIG_DIGSY_REV5) 186 #if defined(CONFIG_DIGSY_REV5)
187 puts (" rev5"); 187 puts (" rev5");
188 #endif 188 #endif
189 if (i > 0) { 189 if (i > 0) {
190 puts(", "); 190 puts(", ");
191 puts(buf); 191 puts(buf);
192 } 192 }
193 putc('\n'); 193 putc('\n');
194 194
195 return 0; 195 return 0;
196 } 196 }
197 197
198 #if defined(CONFIG_VIDEO) 198 #if defined(CONFIG_VIDEO)
199 199
200 #define GPIO_USB1_0 0x00010000 /* Power-On pin */ 200 #define GPIO_USB1_0 0x00010000 /* Power-On pin */
201 #define GPIO_USB1_9 0x08 /* PX_~EN pin */ 201 #define GPIO_USB1_9 0x08 /* PX_~EN pin */
202 202
203 #define GPIO_EE_DO 0x10 /* PSC6_0 (DO) pin */ 203 #define GPIO_EE_DO 0x10 /* PSC6_0 (DO) pin */
204 #define GPIO_EE_CTS 0x20 /* PSC6_1 (CTS) pin */ 204 #define GPIO_EE_CTS 0x20 /* PSC6_1 (CTS) pin */
205 #define GPIO_EE_DI 0x10000000 /* PSC6_2 (DI) pin */ 205 #define GPIO_EE_DI 0x10000000 /* PSC6_2 (DI) pin */
206 #define GPIO_EE_CLK 0x20000000 /* PSC6_3 (CLK) pin */ 206 #define GPIO_EE_CLK 0x20000000 /* PSC6_3 (CLK) pin */
207 207
208 #define GPT_GPIO_ON 0x00000034 /* GPT as simple GPIO, high */ 208 #define GPT_GPIO_ON 0x00000034 /* GPT as simple GPIO, high */
209 209
210 static void exbo_hw_init(void) 210 static void exbo_hw_init(void)
211 { 211 {
212 struct mpc5xxx_gpt *gpt = (struct mpc5xxx_gpt *)MPC5XXX_GPT; 212 struct mpc5xxx_gpt *gpt = (struct mpc5xxx_gpt *)MPC5XXX_GPT;
213 struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio *)MPC5XXX_GPIO; 213 struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio *)MPC5XXX_GPIO;
214 struct mpc5xxx_wu_gpio *wu_gpio = 214 struct mpc5xxx_wu_gpio *wu_gpio =
215 (struct mpc5xxx_wu_gpio *)MPC5XXX_WU_GPIO; 215 (struct mpc5xxx_wu_gpio *)MPC5XXX_WU_GPIO;
216 216
217 /* configure IrDA pins (PSC6 port) as gpios */ 217 /* configure IrDA pins (PSC6 port) as gpios */
218 gpio->port_config &= 0xFF8FFFFF; 218 gpio->port_config &= 0xFF8FFFFF;
219 219
220 /* Init for USB1_0, EE_CLK and EE_DI - Low */ 220 /* Init for USB1_0, EE_CLK and EE_DI - Low */
221 setbits_be32(&gpio->simple_ddr, 221 setbits_be32(&gpio->simple_ddr,
222 GPIO_USB1_0 | GPIO_EE_CLK | GPIO_EE_DI); 222 GPIO_USB1_0 | GPIO_EE_CLK | GPIO_EE_DI);
223 clrbits_be32(&gpio->simple_ode, 223 clrbits_be32(&gpio->simple_ode,
224 GPIO_USB1_0 | GPIO_EE_CLK | GPIO_EE_DI); 224 GPIO_USB1_0 | GPIO_EE_CLK | GPIO_EE_DI);
225 clrbits_be32(&gpio->simple_dvo, 225 clrbits_be32(&gpio->simple_dvo,
226 GPIO_USB1_0 | GPIO_EE_CLK | GPIO_EE_DI); 226 GPIO_USB1_0 | GPIO_EE_CLK | GPIO_EE_DI);
227 setbits_be32(&gpio->simple_gpioe, 227 setbits_be32(&gpio->simple_gpioe,
228 GPIO_USB1_0 | GPIO_EE_CLK | GPIO_EE_DI); 228 GPIO_USB1_0 | GPIO_EE_CLK | GPIO_EE_DI);
229 229
230 /* Init for EE_DO, EE_CTS - Input */ 230 /* Init for EE_DO, EE_CTS - Input */
231 clrbits_8(&wu_gpio->ddr, GPIO_EE_DO | GPIO_EE_CTS); 231 clrbits_8(&wu_gpio->ddr, GPIO_EE_DO | GPIO_EE_CTS);
232 setbits_8(&wu_gpio->enable, GPIO_EE_DO | GPIO_EE_CTS); 232 setbits_8(&wu_gpio->enable, GPIO_EE_DO | GPIO_EE_CTS);
233 233
234 /* Init for PX_~EN (USB1_9) - High */ 234 /* Init for PX_~EN (USB1_9) - High */
235 clrbits_8(&gpio->sint_ode, GPIO_USB1_9); 235 clrbits_8(&gpio->sint_ode, GPIO_USB1_9);
236 setbits_8(&gpio->sint_ddr, GPIO_USB1_9); 236 setbits_8(&gpio->sint_ddr, GPIO_USB1_9);
237 clrbits_8(&gpio->sint_inten, GPIO_USB1_9); 237 clrbits_8(&gpio->sint_inten, GPIO_USB1_9);
238 setbits_8(&gpio->sint_dvo, GPIO_USB1_9); 238 setbits_8(&gpio->sint_dvo, GPIO_USB1_9);
239 setbits_8(&gpio->sint_gpioe, GPIO_USB1_9); 239 setbits_8(&gpio->sint_gpioe, GPIO_USB1_9);
240 240
241 /* Init for ~OE Switch (GPIO3) - Timer_0 GPIO High */ 241 /* Init for ~OE Switch (GPIO3) - Timer_0 GPIO High */
242 out_be32(&gpt[0].emsr, GPT_GPIO_ON); 242 out_be32(&gpt[0].emsr, GPT_GPIO_ON);
243 /* Init for S Switch (GPIO4) - Timer_1 GPIO High */ 243 /* Init for S Switch (GPIO4) - Timer_1 GPIO High */
244 out_be32(&gpt[1].emsr, GPT_GPIO_ON); 244 out_be32(&gpt[1].emsr, GPT_GPIO_ON);
245 245
246 /* Power-On camera supply */ 246 /* Power-On camera supply */
247 setbits_be32(&gpio->simple_dvo, GPIO_USB1_0); 247 setbits_be32(&gpio->simple_dvo, GPIO_USB1_0);
248 } 248 }
249 #else 249 #else
250 static inline void exbo_hw_init(void) {} 250 static inline void exbo_hw_init(void) {}
251 #endif /* CONFIG_VIDEO */ 251 #endif /* CONFIG_VIDEO */
252 252
253 int board_early_init_r(void) 253 int board_early_init_r(void)
254 { 254 {
255 /* 255 /*
256 * Now, when we are in RAM, enable flash write access for detection 256 * Now, when we are in RAM, enable flash write access for detection
257 * process. Note that CS_BOOT cannot be cleared when executing in 257 * process. Note that CS_BOOT cannot be cleared when executing in
258 * flash. 258 * flash.
259 */ 259 */
260 /* disable CS_BOOT */ 260 /* disable CS_BOOT */
261 clrbits_be32((void *)MPC5XXX_ADDECR, (1 << 25)); 261 clrbits_be32((void *)MPC5XXX_ADDECR, (1 << 25));
262 /* enable CS1 */ 262 /* enable CS1 */
263 setbits_be32((void *)MPC5XXX_ADDECR, (1 << 17)); 263 setbits_be32((void *)MPC5XXX_ADDECR, (1 << 17));
264 /* enable CS0 */ 264 /* enable CS0 */
265 setbits_be32((void *)MPC5XXX_ADDECR, (1 << 16)); 265 setbits_be32((void *)MPC5XXX_ADDECR, (1 << 16));
266 266
267 #if defined(CONFIG_USB_OHCI_NEW) && defined(CONFIG_SYS_USB_OHCI_CPU_INIT) 267 #if defined(CONFIG_USB_OHCI_NEW) && defined(CONFIG_SYS_USB_OHCI_CPU_INIT)
268 /* Low level USB init, required for proper kernel operation */ 268 /* Low level USB init, required for proper kernel operation */
269 usb_cpu_init(); 269 usb_cpu_init();
270 #endif 270 #endif
271 271
272 return (0); 272 return (0);
273 } 273 }
274 274
275 void board_get_enetaddr (uchar * enet) 275 void board_get_enetaddr (uchar * enet)
276 { 276 {
277 ushort read = 0; 277 ushort read = 0;
278 ushort addr_of_eth_addr = 0; 278 ushort addr_of_eth_addr = 0;
279 ushort len_sys = 0; 279 ushort len_sys = 0;
280 ushort len_sys_cfg = 0; 280 ushort len_sys_cfg = 0;
281 281
282 /* check identification word */ 282 /* check identification word */
283 eeprom_read(EEPROM_ADDR, EEPROM_ADDR_IDENT, (uchar *)&read, 2); 283 eeprom_read(EEPROM_ADDR, EEPROM_ADDR_IDENT, (uchar *)&read, 2);
284 if (read != EEPROM_IDENT) 284 if (read != EEPROM_IDENT)
285 return; 285 return;
286 286
287 /* calculate offset of config area */ 287 /* calculate offset of config area */
288 eeprom_read(EEPROM_ADDR, EEPROM_ADDR_LEN_SYS, (uchar *)&len_sys, 2); 288 eeprom_read(EEPROM_ADDR, EEPROM_ADDR_LEN_SYS, (uchar *)&len_sys, 2);
289 eeprom_read(EEPROM_ADDR, EEPROM_ADDR_LEN_SYSCFG, 289 eeprom_read(EEPROM_ADDR, EEPROM_ADDR_LEN_SYSCFG,
290 (uchar *)&len_sys_cfg, 2); 290 (uchar *)&len_sys_cfg, 2);
291 addr_of_eth_addr = (len_sys + len_sys_cfg + EEPROM_ADDR_ETHADDR) << 1; 291 addr_of_eth_addr = (len_sys + len_sys_cfg + EEPROM_ADDR_ETHADDR) << 1;
292 if (addr_of_eth_addr >= EEPROM_LEN) 292 if (addr_of_eth_addr >= EEPROM_LEN)
293 return; 293 return;
294 294
295 eeprom_read(EEPROM_ADDR, addr_of_eth_addr, enet, 6); 295 eeprom_read(EEPROM_ADDR, addr_of_eth_addr, enet, 6);
296 } 296 }
297 297
298 int misc_init_r(void) 298 int misc_init_r(void)
299 { 299 {
300 pci_dev_t devbusfn; 300 pci_dev_t devbusfn;
301 uchar enetaddr[6]; 301 uchar enetaddr[6];
302 302
303 /* check if graphic extension board is present */ 303 /* check if graphic extension board is present */
304 devbusfn = pci_find_device(PCI_VENDOR_ID_FUJITSU, 304 devbusfn = pci_find_device(PCI_VENDOR_ID_FUJITSU,
305 PCI_DEVICE_ID_CORAL_PA, 0); 305 PCI_DEVICE_ID_CORAL_PA, 0);
306 if (devbusfn != -1) 306 if (devbusfn != -1)
307 exbo_hw_init(); 307 exbo_hw_init();
308 308
309 if (!eth_getenv_enetaddr("ethaddr", enetaddr)) { 309 if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
310 board_get_enetaddr(enetaddr); 310 board_get_enetaddr(enetaddr);
311 eth_setenv_enetaddr("ethaddr", enetaddr); 311 eth_setenv_enetaddr("ethaddr", enetaddr);
312 } 312 }
313 313
314 return 0; 314 return 0;
315 } 315 }
316 316
317 #ifdef CONFIG_PCI 317 #ifdef CONFIG_PCI
318 static struct pci_controller hose; 318 static struct pci_controller hose;
319 319
320 extern void pci_mpc5xxx_init(struct pci_controller *); 320 extern void pci_mpc5xxx_init(struct pci_controller *);
321 321
322 void pci_init_board(void) 322 void pci_init_board(void)
323 { 323 {
324 pci_mpc5xxx_init(&hose); 324 pci_mpc5xxx_init(&hose);
325 } 325 }
326 #endif 326 #endif
327 327
328 #ifdef CONFIG_CMD_IDE 328 #ifdef CONFIG_IDE
329 329
330 #ifdef CONFIG_IDE_RESET 330 #ifdef CONFIG_IDE_RESET
331 331
332 void init_ide_reset(void) 332 void init_ide_reset(void)
333 { 333 {
334 debug ("init_ide_reset\n"); 334 debug ("init_ide_reset\n");
335 335
336 /* set gpio output value to 1 */ 336 /* set gpio output value to 1 */
337 setbits_be32((void *)MPC5XXX_WU_GPIO_DATA_O, (1 << 25)); 337 setbits_be32((void *)MPC5XXX_WU_GPIO_DATA_O, (1 << 25));
338 /* open drain output */ 338 /* open drain output */
339 setbits_be32((void *)MPC5XXX_WU_GPIO_ODE, (1 << 25)); 339 setbits_be32((void *)MPC5XXX_WU_GPIO_ODE, (1 << 25));
340 /* direction output */ 340 /* direction output */
341 setbits_be32((void *)MPC5XXX_WU_GPIO_DIR, (1 << 25)); 341 setbits_be32((void *)MPC5XXX_WU_GPIO_DIR, (1 << 25));
342 /* enable gpio */ 342 /* enable gpio */
343 setbits_be32((void *)MPC5XXX_WU_GPIO_ENABLE, (1 << 25)); 343 setbits_be32((void *)MPC5XXX_WU_GPIO_ENABLE, (1 << 25));
344 344
345 } 345 }
346 346
347 void ide_set_reset(int idereset) 347 void ide_set_reset(int idereset)
348 { 348 {
349 debug ("ide_reset(%d)\n", idereset); 349 debug ("ide_reset(%d)\n", idereset);
350 350
351 /* set gpio output value to 0 */ 351 /* set gpio output value to 0 */
352 clrbits_be32((void *)MPC5XXX_WU_GPIO_DATA_O, (1 << 25)); 352 clrbits_be32((void *)MPC5XXX_WU_GPIO_DATA_O, (1 << 25));
353 /* open drain output */ 353 /* open drain output */
354 setbits_be32((void *)MPC5XXX_WU_GPIO_ODE, (1 << 25)); 354 setbits_be32((void *)MPC5XXX_WU_GPIO_ODE, (1 << 25));
355 /* direction output */ 355 /* direction output */
356 setbits_be32((void *)MPC5XXX_WU_GPIO_DIR, (1 << 25)); 356 setbits_be32((void *)MPC5XXX_WU_GPIO_DIR, (1 << 25));
357 /* enable gpio */ 357 /* enable gpio */
358 setbits_be32((void *)MPC5XXX_WU_GPIO_ENABLE, (1 << 25)); 358 setbits_be32((void *)MPC5XXX_WU_GPIO_ENABLE, (1 << 25));
359 359
360 udelay(10000); 360 udelay(10000);
361 361
362 /* set gpio output value to 1 */ 362 /* set gpio output value to 1 */
363 setbits_be32((void *)MPC5XXX_WU_GPIO_DATA_O, (1 << 25)); 363 setbits_be32((void *)MPC5XXX_WU_GPIO_DATA_O, (1 << 25));
364 /* open drain output */ 364 /* open drain output */
365 setbits_be32((void *)MPC5XXX_WU_GPIO_ODE, (1 << 25)); 365 setbits_be32((void *)MPC5XXX_WU_GPIO_ODE, (1 << 25));
366 /* direction output */ 366 /* direction output */
367 setbits_be32((void *)MPC5XXX_WU_GPIO_DIR, (1 << 25)); 367 setbits_be32((void *)MPC5XXX_WU_GPIO_DIR, (1 << 25));
368 /* enable gpio */ 368 /* enable gpio */
369 setbits_be32((void *)MPC5XXX_WU_GPIO_ENABLE, (1 << 25)); 369 setbits_be32((void *)MPC5XXX_WU_GPIO_ENABLE, (1 << 25));
370 } 370 }
371 #endif /* CONFIG_IDE_RESET */ 371 #endif /* CONFIG_IDE_RESET */
372 #endif /* CONFIG_CMD_IDE */ 372 #endif /* CONFIG_IDE */
373 373
374 #ifdef CONFIG_OF_BOARD_SETUP 374 #ifdef CONFIG_OF_BOARD_SETUP
375 static void ft_delete_node(void *fdt, const char *compat) 375 static void ft_delete_node(void *fdt, const char *compat)
376 { 376 {
377 int off = -1; 377 int off = -1;
378 int ret; 378 int ret;
379 379
380 off = fdt_node_offset_by_compatible(fdt, -1, compat); 380 off = fdt_node_offset_by_compatible(fdt, -1, compat);
381 if (off < 0) { 381 if (off < 0) {
382 printf("Could not find %s node.\n", compat); 382 printf("Could not find %s node.\n", compat);
383 return; 383 return;
384 } 384 }
385 385
386 ret = fdt_del_node(fdt, off); 386 ret = fdt_del_node(fdt, off);
387 if (ret < 0) 387 if (ret < 0)
388 printf("Could not delete %s node.\n", compat); 388 printf("Could not delete %s node.\n", compat);
389 } 389 }
390 #if defined(CONFIG_SYS_UPDATE_FLASH_SIZE) 390 #if defined(CONFIG_SYS_UPDATE_FLASH_SIZE)
391 static void ft_adapt_flash_base(void *blob) 391 static void ft_adapt_flash_base(void *blob)
392 { 392 {
393 flash_info_t *dev = &flash_info[0]; 393 flash_info_t *dev = &flash_info[0];
394 int off; 394 int off;
395 struct fdt_property *prop; 395 struct fdt_property *prop;
396 int len; 396 int len;
397 u32 *reg, *reg2; 397 u32 *reg, *reg2;
398 398
399 off = fdt_node_offset_by_compatible(blob, -1, "fsl,mpc5200b-lpb"); 399 off = fdt_node_offset_by_compatible(blob, -1, "fsl,mpc5200b-lpb");
400 if (off < 0) { 400 if (off < 0) {
401 printf("Could not find fsl,mpc5200b-lpb node.\n"); 401 printf("Could not find fsl,mpc5200b-lpb node.\n");
402 return; 402 return;
403 } 403 }
404 404
405 /* found compatible property */ 405 /* found compatible property */
406 prop = fdt_get_property_w(blob, off, "ranges", &len); 406 prop = fdt_get_property_w(blob, off, "ranges", &len);
407 if (prop) { 407 if (prop) {
408 reg = reg2 = (u32 *)&prop->data[0]; 408 reg = reg2 = (u32 *)&prop->data[0];
409 409
410 reg[2] = dev->start[0]; 410 reg[2] = dev->start[0];
411 reg[3] = dev->size; 411 reg[3] = dev->size;
412 fdt_setprop(blob, off, "ranges", reg2, len); 412 fdt_setprop(blob, off, "ranges", reg2, len);
413 } else 413 } else
414 printf("Could not find ranges\n"); 414 printf("Could not find ranges\n");
415 } 415 }
416 416
417 extern ulong flash_get_size (phys_addr_t base, int banknum); 417 extern ulong flash_get_size (phys_addr_t base, int banknum);
418 418
419 /* Update the Flash Baseaddr settings */ 419 /* Update the Flash Baseaddr settings */
420 int update_flash_size (int flash_size) 420 int update_flash_size (int flash_size)
421 { 421 {
422 volatile struct mpc5xxx_mmap_ctl *mm = 422 volatile struct mpc5xxx_mmap_ctl *mm =
423 (struct mpc5xxx_mmap_ctl *) CONFIG_SYS_MBAR; 423 (struct mpc5xxx_mmap_ctl *) CONFIG_SYS_MBAR;
424 flash_info_t *dev; 424 flash_info_t *dev;
425 int i; 425 int i;
426 int size = 0; 426 int size = 0;
427 unsigned long base = 0x0; 427 unsigned long base = 0x0;
428 u32 *cs_reg = (u32 *)&mm->cs0_start; 428 u32 *cs_reg = (u32 *)&mm->cs0_start;
429 429
430 for (i = 0; i < 2; i++) { 430 for (i = 0; i < 2; i++) {
431 dev = &flash_info[i]; 431 dev = &flash_info[i];
432 432
433 if (dev->size) { 433 if (dev->size) {
434 /* calculate new base addr for this chipselect */ 434 /* calculate new base addr for this chipselect */
435 base -= dev->size; 435 base -= dev->size;
436 out_be32(cs_reg, START_REG(base)); 436 out_be32(cs_reg, START_REG(base));
437 cs_reg++; 437 cs_reg++;
438 out_be32(cs_reg, STOP_REG(base, dev->size)); 438 out_be32(cs_reg, STOP_REG(base, dev->size));
439 cs_reg++; 439 cs_reg++;
440 /* recalculate the sectoraddr in the cfi driver */ 440 /* recalculate the sectoraddr in the cfi driver */
441 size += flash_get_size(base, i); 441 size += flash_get_size(base, i);
442 } 442 }
443 } 443 }
444 flash_protect_default(); 444 flash_protect_default();
445 gd->bd->bi_flashstart = base; 445 gd->bd->bi_flashstart = base;
446 return 0; 446 return 0;
447 } 447 }
448 #endif /* defined(CONFIG_SYS_UPDATE_FLASH_SIZE) */ 448 #endif /* defined(CONFIG_SYS_UPDATE_FLASH_SIZE) */
449 449
450 int ft_board_setup(void *blob, bd_t *bd) 450 int ft_board_setup(void *blob, bd_t *bd)
451 { 451 {
452 int phy_addr = CONFIG_PHY_ADDR; 452 int phy_addr = CONFIG_PHY_ADDR;
453 char eth_path[] = "/soc5200@f0000000/mdio@3000/ethernet-phy@0"; 453 char eth_path[] = "/soc5200@f0000000/mdio@3000/ethernet-phy@0";
454 454
455 ft_cpu_setup(blob, bd); 455 ft_cpu_setup(blob, bd);
456 /* 456 /*
457 * There are 2 RTC nodes in the DTS, so remove 457 * There are 2 RTC nodes in the DTS, so remove
458 * the unneeded node here. 458 * the unneeded node here.
459 */ 459 */
460 #if defined(CONFIG_DIGSY_REV5) 460 #if defined(CONFIG_DIGSY_REV5)
461 ft_delete_node(blob, "dallas,ds1339"); 461 ft_delete_node(blob, "dallas,ds1339");
462 #else 462 #else
463 ft_delete_node(blob, "mc,rv3029c2"); 463 ft_delete_node(blob, "mc,rv3029c2");
464 #endif 464 #endif
465 #if defined(CONFIG_SYS_UPDATE_FLASH_SIZE) 465 #if defined(CONFIG_SYS_UPDATE_FLASH_SIZE)
466 #ifdef CONFIG_FDT_FIXUP_NOR_FLASH_SIZE 466 #ifdef CONFIG_FDT_FIXUP_NOR_FLASH_SIZE
467 /* Update reg property in all nor flash nodes too */ 467 /* Update reg property in all nor flash nodes too */
468 fdt_fixup_nor_flash_size(blob); 468 fdt_fixup_nor_flash_size(blob);
469 #endif 469 #endif
470 ft_adapt_flash_base(blob); 470 ft_adapt_flash_base(blob);
471 #endif 471 #endif
472 /* fix up the phy address */ 472 /* fix up the phy address */
473 do_fixup_by_path(blob, eth_path, "reg", &phy_addr, sizeof(int), 0); 473 do_fixup_by_path(blob, eth_path, "reg", &phy_addr, sizeof(int), 0);
474 474
475 return 0; 475 return 0;
476 } 476 }
477 #endif /* CONFIG_OF_BOARD_SETUP */ 477 #endif /* CONFIG_OF_BOARD_SETUP */
478 478
board/jupiter/jupiter.c
1 /* 1 /*
2 * (C) Copyright 2007 2 * (C) Copyright 2007
3 * Heiko Schocher, DENX Software Engineering, hs@denx.de. 3 * Heiko Schocher, DENX Software Engineering, hs@denx.de.
4 * 4 *
5 * (C) Copyright 2004 5 * (C) Copyright 2004
6 * Mark Jonas, Freescale Semiconductor, mark.jonas@motorola.com. 6 * Mark Jonas, Freescale Semiconductor, mark.jonas@motorola.com.
7 * 7 *
8 * SPDX-License-Identifier: GPL-2.0+ 8 * SPDX-License-Identifier: GPL-2.0+
9 */ 9 */
10 10
11 #include <common.h> 11 #include <common.h>
12 #include <mpc5xxx.h> 12 #include <mpc5xxx.h>
13 #include <pci.h> 13 #include <pci.h>
14 #include <asm/processor.h> 14 #include <asm/processor.h>
15 #include <libfdt.h> 15 #include <libfdt.h>
16 16
17 #define SDRAM_DDR 0 17 #define SDRAM_DDR 0
18 #if 1 18 #if 1
19 /* Settings Icecube */ 19 /* Settings Icecube */
20 #define SDRAM_MODE 0x00CD0000 20 #define SDRAM_MODE 0x00CD0000
21 #define SDRAM_CONTROL 0x504F0000 21 #define SDRAM_CONTROL 0x504F0000
22 #define SDRAM_CONFIG1 0xD2322800 22 #define SDRAM_CONFIG1 0xD2322800
23 #define SDRAM_CONFIG2 0x8AD70000 23 #define SDRAM_CONFIG2 0x8AD70000
24 #else 24 #else
25 /*Settings Jupiter UB 1.0.0 */ 25 /*Settings Jupiter UB 1.0.0 */
26 #define SDRAM_MODE 0x008D0000 26 #define SDRAM_MODE 0x008D0000
27 #define SDRAM_CONTROL 0xD04F0000 27 #define SDRAM_CONTROL 0xD04F0000
28 #define SDRAM_CONFIG1 0xf7277f00 28 #define SDRAM_CONFIG1 0xf7277f00
29 #define SDRAM_CONFIG2 0x88b70004 29 #define SDRAM_CONFIG2 0x88b70004
30 #endif 30 #endif
31 31
32 DECLARE_GLOBAL_DATA_PTR; 32 DECLARE_GLOBAL_DATA_PTR;
33 33
34 #ifndef CONFIG_SYS_RAMBOOT 34 #ifndef CONFIG_SYS_RAMBOOT
35 static void sdram_start (int hi_addr) 35 static void sdram_start (int hi_addr)
36 { 36 {
37 long hi_addr_bit = hi_addr ? 0x01000000 : 0; 37 long hi_addr_bit = hi_addr ? 0x01000000 : 0;
38 38
39 /* unlock mode register */ 39 /* unlock mode register */
40 *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000000 | hi_addr_bit; 40 *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000000 | hi_addr_bit;
41 __asm__ volatile ("sync"); 41 __asm__ volatile ("sync");
42 42
43 /* precharge all banks */ 43 /* precharge all banks */
44 *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 | hi_addr_bit; 44 *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 | hi_addr_bit;
45 __asm__ volatile ("sync"); 45 __asm__ volatile ("sync");
46 46
47 #if SDRAM_DDR 47 #if SDRAM_DDR
48 /* set mode register: extended mode */ 48 /* set mode register: extended mode */
49 *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_EMODE; 49 *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_EMODE;
50 __asm__ volatile ("sync"); 50 __asm__ volatile ("sync");
51 51
52 /* set mode register: reset DLL */ 52 /* set mode register: reset DLL */
53 *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE | 0x04000000; 53 *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE | 0x04000000;
54 __asm__ volatile ("sync"); 54 __asm__ volatile ("sync");
55 #endif 55 #endif
56 56
57 /* precharge all banks */ 57 /* precharge all banks */
58 *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 | hi_addr_bit; 58 *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 | hi_addr_bit;
59 __asm__ volatile ("sync"); 59 __asm__ volatile ("sync");
60 60
61 /* auto refresh */ 61 /* auto refresh */
62 *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000004 | hi_addr_bit; 62 *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000004 | hi_addr_bit;
63 __asm__ volatile ("sync"); 63 __asm__ volatile ("sync");
64 64
65 /* set mode register */ 65 /* set mode register */
66 *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE; 66 *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE;
67 __asm__ volatile ("sync"); 67 __asm__ volatile ("sync");
68 68
69 /* normal operation */ 69 /* normal operation */
70 *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | hi_addr_bit; 70 *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | hi_addr_bit;
71 __asm__ volatile ("sync"); 71 __asm__ volatile ("sync");
72 } 72 }
73 #endif 73 #endif
74 74
75 /* 75 /*
76 * ATTENTION: Although partially referenced dram_init does NOT make real use 76 * ATTENTION: Although partially referenced dram_init does NOT make real use
77 * use of CONFIG_SYS_SDRAM_BASE. The code does not work if CONFIG_SYS_SDRAM_BASE 77 * use of CONFIG_SYS_SDRAM_BASE. The code does not work if CONFIG_SYS_SDRAM_BASE
78 * is something else than 0x00000000. 78 * is something else than 0x00000000.
79 */ 79 */
80 80
81 int dram_init(void) 81 int dram_init(void)
82 { 82 {
83 ulong dramsize = 0; 83 ulong dramsize = 0;
84 ulong dramsize2 = 0; 84 ulong dramsize2 = 0;
85 uint svr, pvr; 85 uint svr, pvr;
86 86
87 #ifndef CONFIG_SYS_RAMBOOT 87 #ifndef CONFIG_SYS_RAMBOOT
88 ulong test1, test2; 88 ulong test1, test2;
89 89
90 /* setup SDRAM chip selects */ 90 /* setup SDRAM chip selects */
91 *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x0000001e;/* 2G at 0x0 */ 91 *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x0000001e;/* 2G at 0x0 */
92 *(vu_long *)MPC5XXX_SDRAM_CS1CFG = 0x80000000;/* disabled */ 92 *(vu_long *)MPC5XXX_SDRAM_CS1CFG = 0x80000000;/* disabled */
93 __asm__ volatile ("sync"); 93 __asm__ volatile ("sync");
94 94
95 /* setup config registers */ 95 /* setup config registers */
96 *(vu_long *)MPC5XXX_SDRAM_CONFIG1 = SDRAM_CONFIG1; 96 *(vu_long *)MPC5XXX_SDRAM_CONFIG1 = SDRAM_CONFIG1;
97 *(vu_long *)MPC5XXX_SDRAM_CONFIG2 = SDRAM_CONFIG2; 97 *(vu_long *)MPC5XXX_SDRAM_CONFIG2 = SDRAM_CONFIG2;
98 __asm__ volatile ("sync"); 98 __asm__ volatile ("sync");
99 99
100 #if SDRAM_DDR 100 #if SDRAM_DDR
101 /* set tap delay */ 101 /* set tap delay */
102 *(vu_long *)MPC5XXX_CDM_PORCFG = SDRAM_TAPDELAY; 102 *(vu_long *)MPC5XXX_CDM_PORCFG = SDRAM_TAPDELAY;
103 __asm__ volatile ("sync"); 103 __asm__ volatile ("sync");
104 #endif 104 #endif
105 105
106 /* find RAM size using SDRAM CS0 only */ 106 /* find RAM size using SDRAM CS0 only */
107 sdram_start(0); 107 sdram_start(0);
108 test1 = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, 0x80000000); 108 test1 = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, 0x80000000);
109 sdram_start(1); 109 sdram_start(1);
110 test2 = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, 0x80000000); 110 test2 = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, 0x80000000);
111 if (test1 > test2) { 111 if (test1 > test2) {
112 sdram_start(0); 112 sdram_start(0);
113 dramsize = test1; 113 dramsize = test1;
114 } else { 114 } else {
115 dramsize = test2; 115 dramsize = test2;
116 } 116 }
117 117
118 /* memory smaller than 1MB is impossible */ 118 /* memory smaller than 1MB is impossible */
119 if (dramsize < (1 << 20)) { 119 if (dramsize < (1 << 20)) {
120 dramsize = 0; 120 dramsize = 0;
121 } 121 }
122 122
123 /* set SDRAM CS0 size according to the amount of RAM found */ 123 /* set SDRAM CS0 size according to the amount of RAM found */
124 if (dramsize > 0) { 124 if (dramsize > 0) {
125 *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x13 + __builtin_ffs(dramsize >> 20) - 1; 125 *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x13 + __builtin_ffs(dramsize >> 20) - 1;
126 } else { 126 } else {
127 *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0; /* disabled */ 127 *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0; /* disabled */
128 } 128 }
129 129
130 /* let SDRAM CS1 start right after CS0 */ 130 /* let SDRAM CS1 start right after CS0 */
131 *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize + 0x0000001e;/* 2G */ 131 *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize + 0x0000001e;/* 2G */
132 132
133 /* find RAM size using SDRAM CS1 only */ 133 /* find RAM size using SDRAM CS1 only */
134 if (!dramsize) 134 if (!dramsize)
135 sdram_start(0); 135 sdram_start(0);
136 test2 = test1 = get_ram_size((long *)(CONFIG_SYS_SDRAM_BASE + dramsize), 0x80000000); 136 test2 = test1 = get_ram_size((long *)(CONFIG_SYS_SDRAM_BASE + dramsize), 0x80000000);
137 if (!dramsize) { 137 if (!dramsize) {
138 sdram_start(1); 138 sdram_start(1);
139 test2 = get_ram_size((long *)(CONFIG_SYS_SDRAM_BASE + dramsize), 0x80000000); 139 test2 = get_ram_size((long *)(CONFIG_SYS_SDRAM_BASE + dramsize), 0x80000000);
140 } 140 }
141 if (test1 > test2) { 141 if (test1 > test2) {
142 sdram_start(0); 142 sdram_start(0);
143 dramsize2 = test1; 143 dramsize2 = test1;
144 } else { 144 } else {
145 dramsize2 = test2; 145 dramsize2 = test2;
146 } 146 }
147 147
148 /* memory smaller than 1MB is impossible */ 148 /* memory smaller than 1MB is impossible */
149 if (dramsize2 < (1 << 20)) { 149 if (dramsize2 < (1 << 20)) {
150 dramsize2 = 0; 150 dramsize2 = 0;
151 } 151 }
152 152
153 /* set SDRAM CS1 size according to the amount of RAM found */ 153 /* set SDRAM CS1 size according to the amount of RAM found */
154 if (dramsize2 > 0) { 154 if (dramsize2 > 0) {
155 *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize 155 *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize
156 | (0x13 + __builtin_ffs(dramsize2 >> 20) - 1); 156 | (0x13 + __builtin_ffs(dramsize2 >> 20) - 1);
157 } else { 157 } else {
158 *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize; /* disabled */ 158 *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize; /* disabled */
159 } 159 }
160 160
161 #else /* CONFIG_SYS_RAMBOOT */ 161 #else /* CONFIG_SYS_RAMBOOT */
162 162
163 /* retrieve size of memory connected to SDRAM CS0 */ 163 /* retrieve size of memory connected to SDRAM CS0 */
164 dramsize = *(vu_long *)MPC5XXX_SDRAM_CS0CFG & 0xFF; 164 dramsize = *(vu_long *)MPC5XXX_SDRAM_CS0CFG & 0xFF;
165 if (dramsize >= 0x13) { 165 if (dramsize >= 0x13) {
166 dramsize = (1 << (dramsize - 0x13)) << 20; 166 dramsize = (1 << (dramsize - 0x13)) << 20;
167 } else { 167 } else {
168 dramsize = 0; 168 dramsize = 0;
169 } 169 }
170 170
171 /* retrieve size of memory connected to SDRAM CS1 */ 171 /* retrieve size of memory connected to SDRAM CS1 */
172 dramsize2 = *(vu_long *)MPC5XXX_SDRAM_CS1CFG & 0xFF; 172 dramsize2 = *(vu_long *)MPC5XXX_SDRAM_CS1CFG & 0xFF;
173 if (dramsize2 >= 0x13) { 173 if (dramsize2 >= 0x13) {
174 dramsize2 = (1 << (dramsize2 - 0x13)) << 20; 174 dramsize2 = (1 << (dramsize2 - 0x13)) << 20;
175 } else { 175 } else {
176 dramsize2 = 0; 176 dramsize2 = 0;
177 } 177 }
178 178
179 #endif /* CONFIG_SYS_RAMBOOT */ 179 #endif /* CONFIG_SYS_RAMBOOT */
180 180
181 /* 181 /*
182 * On MPC5200B we need to set the special configuration delay in the 182 * On MPC5200B we need to set the special configuration delay in the
183 * DDR controller. Please refer to Freescale's AN3221 "MPC5200B SDRAM 183 * DDR controller. Please refer to Freescale's AN3221 "MPC5200B SDRAM
184 * Initialization and Configuration", 3.3.1 SDelay--MBAR + 0x0190: 184 * Initialization and Configuration", 3.3.1 SDelay--MBAR + 0x0190:
185 * 185 *
186 * "The SDelay should be written to a value of 0x00000004. It is 186 * "The SDelay should be written to a value of 0x00000004. It is
187 * required to account for changes caused by normal wafer processing 187 * required to account for changes caused by normal wafer processing
188 * parameters." 188 * parameters."
189 */ 189 */
190 svr = get_svr(); 190 svr = get_svr();
191 pvr = get_pvr(); 191 pvr = get_pvr();
192 if ((SVR_MJREV(svr) >= 2) && 192 if ((SVR_MJREV(svr) >= 2) &&
193 (PVR_MAJ(pvr) == 1) && (PVR_MIN(pvr) == 4)) { 193 (PVR_MAJ(pvr) == 1) && (PVR_MIN(pvr) == 4)) {
194 194
195 *(vu_long *)MPC5XXX_SDRAM_SDELAY = 0x04; 195 *(vu_long *)MPC5XXX_SDRAM_SDELAY = 0x04;
196 __asm__ volatile ("sync"); 196 __asm__ volatile ("sync");
197 } 197 }
198 198
199 gd->ram_size = dramsize + dramsize2; 199 gd->ram_size = dramsize + dramsize2;
200 200
201 return 0; 201 return 0;
202 } 202 }
203 203
204 int checkboard (void) 204 int checkboard (void)
205 { 205 {
206 puts ("Board: Sauter (Jupiter)\n"); 206 puts ("Board: Sauter (Jupiter)\n");
207 return 0; 207 return 0;
208 } 208 }
209 209
210 void flash_preinit(void) 210 void flash_preinit(void)
211 { 211 {
212 /* 212 /*
213 * Now, when we are in RAM, enable flash write 213 * Now, when we are in RAM, enable flash write
214 * access for detection process. 214 * access for detection process.
215 * Note that CS_BOOT cannot be cleared when 215 * Note that CS_BOOT cannot be cleared when
216 * executing in flash. 216 * executing in flash.
217 */ 217 */
218 *(vu_long *)MPC5XXX_BOOTCS_CFG &= ~0x1; /* clear RO */ 218 *(vu_long *)MPC5XXX_BOOTCS_CFG &= ~0x1; /* clear RO */
219 } 219 }
220 220
221 int board_early_init_r (void) 221 int board_early_init_r (void)
222 { 222 {
223 flash_preinit (); 223 flash_preinit ();
224 return 0; 224 return 0;
225 } 225 }
226 226
227 void flash_afterinit(ulong size) 227 void flash_afterinit(ulong size)
228 { 228 {
229 if (size == 0x1000000) { /* adjust mapping */ 229 if (size == 0x1000000) { /* adjust mapping */
230 *(vu_long *)MPC5XXX_BOOTCS_START = *(vu_long *)MPC5XXX_CS0_START = 230 *(vu_long *)MPC5XXX_BOOTCS_START = *(vu_long *)MPC5XXX_CS0_START =
231 START_REG(CONFIG_SYS_BOOTCS_START | size); 231 START_REG(CONFIG_SYS_BOOTCS_START | size);
232 *(vu_long *)MPC5XXX_BOOTCS_STOP = *(vu_long *)MPC5XXX_CS0_STOP = 232 *(vu_long *)MPC5XXX_BOOTCS_STOP = *(vu_long *)MPC5XXX_CS0_STOP =
233 STOP_REG(CONFIG_SYS_BOOTCS_START | size, size); 233 STOP_REG(CONFIG_SYS_BOOTCS_START | size, size);
234 } 234 }
235 *(vu_long *)MPC5XXX_ADDECR &= ~(1 << 25); /* disable CS_BOOT */ 235 *(vu_long *)MPC5XXX_ADDECR &= ~(1 << 25); /* disable CS_BOOT */
236 *(vu_long *)MPC5XXX_ADDECR |= (1 << 16); /* enable CS0 */ 236 *(vu_long *)MPC5XXX_ADDECR |= (1 << 16); /* enable CS0 */
237 } 237 }
238 238
239 int update_flash_size (int flash_size) 239 int update_flash_size (int flash_size)
240 { 240 {
241 flash_afterinit (flash_size); 241 flash_afterinit (flash_size);
242 return 0; 242 return 0;
243 } 243 }
244 244
245 int board_early_init_f (void) 245 int board_early_init_f (void)
246 { 246 {
247 *(vu_long *)MPC5XXX_BOOTCS_CFG &= ~0x1; /* clear RO */ 247 *(vu_long *)MPC5XXX_BOOTCS_CFG &= ~0x1; /* clear RO */
248 return 0; 248 return 0;
249 } 249 }
250 250
251 #ifdef CONFIG_PCI 251 #ifdef CONFIG_PCI
252 static struct pci_controller hose; 252 static struct pci_controller hose;
253 253
254 extern void pci_mpc5xxx_init(struct pci_controller *); 254 extern void pci_mpc5xxx_init(struct pci_controller *);
255 255
256 void pci_init_board(void) 256 void pci_init_board(void)
257 { 257 {
258 pci_mpc5xxx_init(&hose); 258 pci_mpc5xxx_init(&hose);
259 } 259 }
260 #endif 260 #endif
261 261
262 #if defined(CONFIG_CMD_IDE) && defined(CONFIG_IDE_RESET) 262 #if defined(CONFIG_IDE) && defined(CONFIG_IDE_RESET)
263 263
264 void init_ide_reset (void) 264 void init_ide_reset (void)
265 { 265 {
266 debug ("init_ide_reset\n"); 266 debug ("init_ide_reset\n");
267 267
268 /* Configure PSC1_4 as GPIO output for ATA reset */ 268 /* Configure PSC1_4 as GPIO output for ATA reset */
269 *(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC1_4; 269 *(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC1_4;
270 *(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC1_4; 270 *(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC1_4;
271 /* Deassert reset */ 271 /* Deassert reset */
272 *(vu_long *) MPC5XXX_WU_GPIO_DATA_O |= GPIO_PSC1_4; 272 *(vu_long *) MPC5XXX_WU_GPIO_DATA_O |= GPIO_PSC1_4;
273 } 273 }
274 274
275 void ide_set_reset (int idereset) 275 void ide_set_reset (int idereset)
276 { 276 {
277 debug ("ide_reset(%d)\n", idereset); 277 debug ("ide_reset(%d)\n", idereset);
278 278
279 if (idereset) { 279 if (idereset) {
280 *(vu_long *) MPC5XXX_WU_GPIO_DATA_O &= ~GPIO_PSC1_4; 280 *(vu_long *) MPC5XXX_WU_GPIO_DATA_O &= ~GPIO_PSC1_4;
281 /* Make a delay. MPC5200 spec says 25 usec min */ 281 /* Make a delay. MPC5200 spec says 25 usec min */
282 udelay(500000); 282 udelay(500000);
283 } else { 283 } else {
284 *(vu_long *) MPC5XXX_WU_GPIO_DATA_O |= GPIO_PSC1_4; 284 *(vu_long *) MPC5XXX_WU_GPIO_DATA_O |= GPIO_PSC1_4;
285 } 285 }
286 } 286 }
287 #endif 287 #endif
288 288
289 #ifdef CONFIG_OF_BOARD_SETUP 289 #ifdef CONFIG_OF_BOARD_SETUP
290 int ft_board_setup(void *blob, bd_t *bd) 290 int ft_board_setup(void *blob, bd_t *bd)
291 { 291 {
292 ft_cpu_setup(blob, bd); 292 ft_cpu_setup(blob, bd);
293 293
294 return 0; 294 return 0;
295 } 295 }
296 #endif /* CONFIG_OF_BOARD_SETUP */ 296 #endif /* CONFIG_OF_BOARD_SETUP */
297 297
board/phytec/pcm030/pcm030.c
1 /* 1 /*
2 * (C) Copyright 2003 2 * (C) Copyright 2003
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 * 4 *
5 * (C) Copyright 2004 5 * (C) Copyright 2004
6 * Mark Jonas, Freescale Semiconductor, mark.jonas@motorola.com. 6 * Mark Jonas, Freescale Semiconductor, mark.jonas@motorola.com.
7 * 7 *
8 * (C) Copyright 2006 8 * (C) Copyright 2006
9 * Eric Schumann, Phytec Messtechnik GmbH 9 * Eric Schumann, Phytec Messtechnik GmbH
10 * 10 *
11 * SPDX-License-Identifier: GPL-2.0+ 11 * SPDX-License-Identifier: GPL-2.0+
12 */ 12 */
13 13
14 #include <common.h> 14 #include <common.h>
15 #include <mpc5xxx.h> 15 #include <mpc5xxx.h>
16 #include <pci.h> 16 #include <pci.h>
17 #include <asm/io.h> 17 #include <asm/io.h>
18 18
19 #include "mt46v32m16-75.h" 19 #include "mt46v32m16-75.h"
20 20
21 DECLARE_GLOBAL_DATA_PTR; 21 DECLARE_GLOBAL_DATA_PTR;
22 22
23 #ifndef CONFIG_SYS_RAMBOOT 23 #ifndef CONFIG_SYS_RAMBOOT
24 static void sdram_start(int hi_addr) 24 static void sdram_start(int hi_addr)
25 { 25 {
26 volatile struct mpc5xxx_cdm *cdm = 26 volatile struct mpc5xxx_cdm *cdm =
27 (struct mpc5xxx_cdm *)MPC5XXX_CDM; 27 (struct mpc5xxx_cdm *)MPC5XXX_CDM;
28 volatile struct mpc5xxx_sdram *sdram = 28 volatile struct mpc5xxx_sdram *sdram =
29 (struct mpc5xxx_sdram *)MPC5XXX_SDRAM; 29 (struct mpc5xxx_sdram *)MPC5XXX_SDRAM;
30 30
31 long hi_addr_bit = hi_addr ? 0x01000000 : 0; 31 long hi_addr_bit = hi_addr ? 0x01000000 : 0;
32 32
33 /* unlock mode register */ 33 /* unlock mode register */
34 out_be32 (&sdram->ctrl, 34 out_be32 (&sdram->ctrl,
35 (SDRAM_CONTROL | 0x80000000 | hi_addr_bit)); 35 (SDRAM_CONTROL | 0x80000000 | hi_addr_bit));
36 36
37 /* precharge all banks */ 37 /* precharge all banks */
38 out_be32 (&sdram->ctrl, 38 out_be32 (&sdram->ctrl,
39 (SDRAM_CONTROL | 0x80000002 | hi_addr_bit)); 39 (SDRAM_CONTROL | 0x80000002 | hi_addr_bit));
40 40
41 #ifdef SDRAM_DDR 41 #ifdef SDRAM_DDR
42 /* set mode register: extended mode */ 42 /* set mode register: extended mode */
43 out_be32 (&sdram->mode, (SDRAM_EMODE)); 43 out_be32 (&sdram->mode, (SDRAM_EMODE));
44 44
45 /* set mode register: reset DLL */ 45 /* set mode register: reset DLL */
46 out_be32 (&sdram->mode, 46 out_be32 (&sdram->mode,
47 (SDRAM_MODE | 0x04000000)); 47 (SDRAM_MODE | 0x04000000));
48 #endif 48 #endif
49 49
50 /* precharge all banks */ 50 /* precharge all banks */
51 out_be32 (&sdram->ctrl, 51 out_be32 (&sdram->ctrl,
52 (SDRAM_CONTROL | 0x80000002 | hi_addr_bit)); 52 (SDRAM_CONTROL | 0x80000002 | hi_addr_bit));
53 53
54 /* auto refresh */ 54 /* auto refresh */
55 out_be32 (&sdram->ctrl, 55 out_be32 (&sdram->ctrl,
56 (SDRAM_CONTROL | 0x80000004 | hi_addr_bit)); 56 (SDRAM_CONTROL | 0x80000004 | hi_addr_bit));
57 57
58 /* set mode register */ 58 /* set mode register */
59 out_be32 (&sdram->mode, (SDRAM_MODE)); 59 out_be32 (&sdram->mode, (SDRAM_MODE));
60 60
61 /* normal operation */ 61 /* normal operation */
62 out_be32 (&sdram->ctrl, 62 out_be32 (&sdram->ctrl,
63 (SDRAM_CONTROL | hi_addr_bit)); 63 (SDRAM_CONTROL | hi_addr_bit));
64 64
65 /* set CDM clock enable register, set MPC5200B SDRAM bus */ 65 /* set CDM clock enable register, set MPC5200B SDRAM bus */
66 /* to reduced driver strength */ 66 /* to reduced driver strength */
67 out_be32 (&cdm->clock_enable, (0x00CFFFFF)); 67 out_be32 (&cdm->clock_enable, (0x00CFFFFF));
68 } 68 }
69 #endif 69 #endif
70 70
71 /* 71 /*
72 * ATTENTION: Although partially referenced dram_init does NOT make 72 * ATTENTION: Although partially referenced dram_init does NOT make
73 * real use of CONFIG_SYS_SDRAM_BASE. The code does not 73 * real use of CONFIG_SYS_SDRAM_BASE. The code does not
74 * work if CONFIG_SYS_SDRAM_BASE 74 * work if CONFIG_SYS_SDRAM_BASE
75 * is something else than 0x00000000. 75 * is something else than 0x00000000.
76 */ 76 */
77 77
78 int dram_init(void) 78 int dram_init(void)
79 { 79 {
80 volatile struct mpc5xxx_mmap_ctl *mm = 80 volatile struct mpc5xxx_mmap_ctl *mm =
81 (struct mpc5xxx_mmap_ctl *)CONFIG_SYS_MBAR; 81 (struct mpc5xxx_mmap_ctl *)CONFIG_SYS_MBAR;
82 volatile struct mpc5xxx_cdm *cdm = 82 volatile struct mpc5xxx_cdm *cdm =
83 (struct mpc5xxx_cdm *)MPC5XXX_CDM; 83 (struct mpc5xxx_cdm *)MPC5XXX_CDM;
84 volatile struct mpc5xxx_sdram *sdram = 84 volatile struct mpc5xxx_sdram *sdram =
85 (struct mpc5xxx_sdram *)MPC5XXX_SDRAM; 85 (struct mpc5xxx_sdram *)MPC5XXX_SDRAM;
86 ulong dramsize = 0; 86 ulong dramsize = 0;
87 ulong dramsize2 = 0; 87 ulong dramsize2 = 0;
88 #ifndef CONFIG_SYS_RAMBOOT 88 #ifndef CONFIG_SYS_RAMBOOT
89 ulong test1, test2; 89 ulong test1, test2;
90 90
91 /* setup SDRAM chip selects */ 91 /* setup SDRAM chip selects */
92 /* 256MB at 0x0 */ 92 /* 256MB at 0x0 */
93 out_be32 (&mm->sdram0, 0x0000001b); 93 out_be32 (&mm->sdram0, 0x0000001b);
94 /* disabled */ 94 /* disabled */
95 out_be32 (&mm->sdram1, 0x10000000); 95 out_be32 (&mm->sdram1, 0x10000000);
96 96
97 /* setup config registers */ 97 /* setup config registers */
98 out_be32 (&sdram->config1, SDRAM_CONFIG1); 98 out_be32 (&sdram->config1, SDRAM_CONFIG1);
99 out_be32 (&sdram->config2, SDRAM_CONFIG2); 99 out_be32 (&sdram->config2, SDRAM_CONFIG2);
100 100
101 #if defined(SDRAM_DDR) && defined(SDRAM_TAPDELAY) 101 #if defined(SDRAM_DDR) && defined(SDRAM_TAPDELAY)
102 /* set tap delay */ 102 /* set tap delay */
103 out_be32 (&cdm->porcfg, SDRAM_TAPDELAY); 103 out_be32 (&cdm->porcfg, SDRAM_TAPDELAY);
104 #endif 104 #endif
105 105
106 /* find RAM size using SDRAM CS0 only */ 106 /* find RAM size using SDRAM CS0 only */
107 sdram_start(0); 107 sdram_start(0);
108 test1 = get_ram_size((long *) CONFIG_SYS_SDRAM_BASE, 0x10000000); 108 test1 = get_ram_size((long *) CONFIG_SYS_SDRAM_BASE, 0x10000000);
109 sdram_start(1); 109 sdram_start(1);
110 test2 = get_ram_size((long *) CONFIG_SYS_SDRAM_BASE, 0x10000000); 110 test2 = get_ram_size((long *) CONFIG_SYS_SDRAM_BASE, 0x10000000);
111 if (test1 > test2) { 111 if (test1 > test2) {
112 sdram_start(0); 112 sdram_start(0);
113 dramsize = test1; 113 dramsize = test1;
114 } else 114 } else
115 dramsize = test2; 115 dramsize = test2;
116 116
117 /* memory smaller than 1MB is impossible */ 117 /* memory smaller than 1MB is impossible */
118 if (dramsize < (1 << 20)) 118 if (dramsize < (1 << 20))
119 dramsize = 0; 119 dramsize = 0;
120 120
121 /* set SDRAM CS0 size according to the amount of RAM found */ 121 /* set SDRAM CS0 size according to the amount of RAM found */
122 if (dramsize > 0) { 122 if (dramsize > 0) {
123 out_be32 (&mm->sdram0, 123 out_be32 (&mm->sdram0,
124 (0x13 + __builtin_ffs(dramsize >> 20) - 1)); 124 (0x13 + __builtin_ffs(dramsize >> 20) - 1));
125 } else { 125 } else {
126 /* disabled */ 126 /* disabled */
127 out_be32 (&mm->sdram0, 0); 127 out_be32 (&mm->sdram0, 0);
128 } 128 }
129 129
130 #else /* CONFIG_SYS_RAMBOOT */ 130 #else /* CONFIG_SYS_RAMBOOT */
131 131
132 /* retrieve size of memory connected to SDRAM CS0 */ 132 /* retrieve size of memory connected to SDRAM CS0 */
133 dramsize = in_be32(&mm->sdram0) & 0xFF; 133 dramsize = in_be32(&mm->sdram0) & 0xFF;
134 if (dramsize >= 0x13) 134 if (dramsize >= 0x13)
135 dramsize = (1 << (dramsize - 0x13)) << 20; 135 dramsize = (1 << (dramsize - 0x13)) << 20;
136 else 136 else
137 dramsize = 0; 137 dramsize = 0;
138 138
139 /* retrieve size of memory connected to SDRAM CS1 */ 139 /* retrieve size of memory connected to SDRAM CS1 */
140 dramsize2 = in_be32(&mm->sdram1) & 0xFF; 140 dramsize2 = in_be32(&mm->sdram1) & 0xFF;
141 if (dramsize2 >= 0x13) 141 if (dramsize2 >= 0x13)
142 dramsize2 = (1 << (dramsize2 - 0x13)) << 20; 142 dramsize2 = (1 << (dramsize2 - 0x13)) << 20;
143 else 143 else
144 dramsize2 = 0; 144 dramsize2 = 0;
145 145
146 #endif /* CONFIG_SYS_RAMBOOT */ 146 #endif /* CONFIG_SYS_RAMBOOT */
147 147
148 gd->ram_size = dramsize + dramsize2; 148 gd->ram_size = dramsize + dramsize2;
149 149
150 return 0; 150 return 0;
151 } 151 }
152 152
153 int checkboard(void) 153 int checkboard(void)
154 { 154 {
155 puts("Board: phyCORE-MPC5200B-tiny\n"); 155 puts("Board: phyCORE-MPC5200B-tiny\n");
156 return 0; 156 return 0;
157 } 157 }
158 158
159 #ifdef CONFIG_PCI 159 #ifdef CONFIG_PCI
160 static struct pci_controller hose; 160 static struct pci_controller hose;
161 161
162 extern void pci_mpc5xxx_init(struct pci_controller *); 162 extern void pci_mpc5xxx_init(struct pci_controller *);
163 163
164 void pci_init_board(void) 164 void pci_init_board(void)
165 { 165 {
166 pci_mpc5xxx_init(&hose); 166 pci_mpc5xxx_init(&hose);
167 } 167 }
168 #endif 168 #endif
169 169
170 #ifdef CONFIG_OF_BOARD_SETUP 170 #ifdef CONFIG_OF_BOARD_SETUP
171 int ft_board_setup(void *blob, bd_t *bd) 171 int ft_board_setup(void *blob, bd_t *bd)
172 { 172 {
173 ft_cpu_setup(blob, bd); 173 ft_cpu_setup(blob, bd);
174 174
175 return 0; 175 return 0;
176 } 176 }
177 #endif /* CONFIG_OF_BOARD_SETUP */ 177 #endif /* CONFIG_OF_BOARD_SETUP */
178 178
179 #if defined(CONFIG_CMD_IDE) && defined(CONFIG_IDE_RESET) 179 #if defined(CONFIG_IDE) && defined(CONFIG_IDE_RESET)
180 180
181 #define GPIO_PSC2_4 0x02000000UL 181 #define GPIO_PSC2_4 0x02000000UL
182 182
183 void init_ide_reset(void) 183 void init_ide_reset(void)
184 { 184 {
185 volatile struct mpc5xxx_wu_gpio *wu_gpio = 185 volatile struct mpc5xxx_wu_gpio *wu_gpio =
186 (struct mpc5xxx_wu_gpio *)MPC5XXX_WU_GPIO; 186 (struct mpc5xxx_wu_gpio *)MPC5XXX_WU_GPIO;
187 debug("init_ide_reset\n"); 187 debug("init_ide_reset\n");
188 188
189 /* Configure PSC2_4 as GPIO output for ATA reset */ 189 /* Configure PSC2_4 as GPIO output for ATA reset */
190 setbits_be32(&wu_gpio->enable, GPIO_PSC2_4); 190 setbits_be32(&wu_gpio->enable, GPIO_PSC2_4);
191 setbits_be32(&wu_gpio->ddr, GPIO_PSC2_4); 191 setbits_be32(&wu_gpio->ddr, GPIO_PSC2_4);
192 /* Deassert reset */ 192 /* Deassert reset */
193 setbits_be32(&wu_gpio->dvo, GPIO_PSC2_4); 193 setbits_be32(&wu_gpio->dvo, GPIO_PSC2_4);
194 } 194 }
195 195
196 void ide_set_reset(int idereset) 196 void ide_set_reset(int idereset)
197 { 197 {
198 volatile struct mpc5xxx_wu_gpio *wu_gpio = 198 volatile struct mpc5xxx_wu_gpio *wu_gpio =
199 (struct mpc5xxx_wu_gpio *)MPC5XXX_WU_GPIO; 199 (struct mpc5xxx_wu_gpio *)MPC5XXX_WU_GPIO;
200 debug("ide_reset(%d)\n", idereset); 200 debug("ide_reset(%d)\n", idereset);
201 201
202 if (idereset) { 202 if (idereset) {
203 clrbits_be32(&wu_gpio->dvo, GPIO_PSC2_4); 203 clrbits_be32(&wu_gpio->dvo, GPIO_PSC2_4);
204 /* Make a delay. MPC5200 spec says 25 usec min */ 204 /* Make a delay. MPC5200 spec says 25 usec min */
205 udelay(500000); 205 udelay(500000);
206 } else 206 } else
207 setbits_be32(&wu_gpio->dvo, GPIO_PSC2_4); 207 setbits_be32(&wu_gpio->dvo, GPIO_PSC2_4);
208 } 208 }
209 #endif /* defined(CONFIG_CMD_IDE) && defined(CONFIG_IDE_RESET) */ 209 #endif /* defined(CONFIG_IDE) && defined(CONFIG_IDE_RESET) */
210 210
board/tqc/tqm5200/tqm5200.c
1 /* 1 /*
2 * (C) Copyright 2003-2006 2 * (C) Copyright 2003-2006
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 * 4 *
5 * (C) Copyright 2004 5 * (C) Copyright 2004
6 * Mark Jonas, Freescale Semiconductor, mark.jonas@motorola.com. 6 * Mark Jonas, Freescale Semiconductor, mark.jonas@motorola.com.
7 * 7 *
8 * (C) Copyright 2004-2006 8 * (C) Copyright 2004-2006
9 * Martin Krause, TQ-Systems GmbH, martin.krause@tqs.de 9 * Martin Krause, TQ-Systems GmbH, martin.krause@tqs.de
10 * 10 *
11 * SPDX-License-Identifier: GPL-2.0+ 11 * SPDX-License-Identifier: GPL-2.0+
12 */ 12 */
13 13
14 #include <common.h> 14 #include <common.h>
15 #include <console.h> 15 #include <console.h>
16 #include <mpc5xxx.h> 16 #include <mpc5xxx.h>
17 #include <pci.h> 17 #include <pci.h>
18 #include <asm/processor.h> 18 #include <asm/processor.h>
19 #include <libfdt.h> 19 #include <libfdt.h>
20 #include <netdev.h> 20 #include <netdev.h>
21 #include <video.h> 21 #include <video.h>
22 22
23 #ifdef CONFIG_VIDEO_SM501 23 #ifdef CONFIG_VIDEO_SM501
24 #include <sm501.h> 24 #include <sm501.h>
25 #endif 25 #endif
26 26
27 #if defined(CONFIG_MPC5200_DDR) 27 #if defined(CONFIG_MPC5200_DDR)
28 #include "mt46v16m16-75.h" 28 #include "mt46v16m16-75.h"
29 #else 29 #else
30 #include "mt48lc16m16a2-75.h" 30 #include "mt48lc16m16a2-75.h"
31 #endif 31 #endif
32 32
33 #ifdef CONFIG_OF_LIBFDT 33 #ifdef CONFIG_OF_LIBFDT
34 #include <fdt_support.h> 34 #include <fdt_support.h>
35 #endif /* CONFIG_OF_LIBFDT */ 35 #endif /* CONFIG_OF_LIBFDT */
36 36
37 DECLARE_GLOBAL_DATA_PTR; 37 DECLARE_GLOBAL_DATA_PTR;
38 38
39 #ifdef CONFIG_PS2MULT 39 #ifdef CONFIG_PS2MULT
40 void ps2mult_early_init(void); 40 void ps2mult_early_init(void);
41 #endif 41 #endif
42 42
43 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) && \ 43 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) && \
44 defined(CONFIG_VIDEO) 44 defined(CONFIG_VIDEO)
45 /* 45 /*
46 * EDID block has been generated using Phoenix EDID Designer 1.3. 46 * EDID block has been generated using Phoenix EDID Designer 1.3.
47 * This tool creates a text file containing: 47 * This tool creates a text file containing:
48 * 48 *
49 * EDID BYTES: 49 * EDID BYTES:
50 * 50 *
51 * 0x 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 51 * 0x 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
52 * ------------------------------------------------ 52 * ------------------------------------------------
53 * 00 | 00 FF FF FF FF FF FF 00 04 21 00 00 00 00 00 00 53 * 00 | 00 FF FF FF FF FF FF 00 04 21 00 00 00 00 00 00
54 * 10 | 01 00 01 03 00 00 00 00 00 00 00 00 00 00 00 00 54 * 10 | 01 00 01 03 00 00 00 00 00 00 00 00 00 00 00 00
55 * 20 | 00 00 00 21 00 00 01 01 01 01 01 01 01 01 01 01 55 * 20 | 00 00 00 21 00 00 01 01 01 01 01 01 01 01 01 01
56 * 30 | 01 01 01 01 01 01 64 00 00 00 00 00 00 00 00 00 56 * 30 | 01 01 01 01 01 01 64 00 00 00 00 00 00 00 00 00
57 * 40 | 00 00 00 00 00 00 00 00 00 00 00 10 00 00 00 00 57 * 40 | 00 00 00 00 00 00 00 00 00 00 00 10 00 00 00 00
58 * 50 | 00 00 00 00 00 00 00 00 00 00 00 00 00 10 00 00 58 * 50 | 00 00 00 00 00 00 00 00 00 00 00 00 00 10 00 00
59 * 60 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10 59 * 60 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10
60 * 70 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17 60 * 70 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17
61 * 61 *
62 * Then this data has been manually converted to the char 62 * Then this data has been manually converted to the char
63 * array below. 63 * array below.
64 */ 64 */
65 static unsigned char edid_buf[128] = { 65 static unsigned char edid_buf[128] = {
66 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 66 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
67 0x04, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 67 0x04, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
68 0x01, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 68 0x01, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00,
69 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 69 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
70 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x01, 0x01, 70 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x01, 0x01,
71 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 71 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
72 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x64, 0x00, 72 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x64, 0x00,
73 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 73 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
74 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 74 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
75 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 75 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
76 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 76 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
77 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 77 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
78 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 78 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
79 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 79 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
80 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 80 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
81 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 81 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17,
82 }; 82 };
83 #endif 83 #endif
84 84
85 #ifndef CONFIG_SYS_RAMBOOT 85 #ifndef CONFIG_SYS_RAMBOOT
86 static void sdram_start (int hi_addr) 86 static void sdram_start (int hi_addr)
87 { 87 {
88 long hi_addr_bit = hi_addr ? 0x01000000 : 0; 88 long hi_addr_bit = hi_addr ? 0x01000000 : 0;
89 89
90 /* unlock mode register */ 90 /* unlock mode register */
91 *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000000 | 91 *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000000 |
92 hi_addr_bit; 92 hi_addr_bit;
93 __asm__ volatile ("sync"); 93 __asm__ volatile ("sync");
94 94
95 /* precharge all banks */ 95 /* precharge all banks */
96 *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 | 96 *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 |
97 hi_addr_bit; 97 hi_addr_bit;
98 __asm__ volatile ("sync"); 98 __asm__ volatile ("sync");
99 99
100 #if SDRAM_DDR 100 #if SDRAM_DDR
101 /* set mode register: extended mode */ 101 /* set mode register: extended mode */
102 *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_EMODE; 102 *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_EMODE;
103 __asm__ volatile ("sync"); 103 __asm__ volatile ("sync");
104 104
105 /* set mode register: reset DLL */ 105 /* set mode register: reset DLL */
106 *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE | 0x04000000; 106 *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE | 0x04000000;
107 __asm__ volatile ("sync"); 107 __asm__ volatile ("sync");
108 #endif 108 #endif
109 109
110 /* precharge all banks */ 110 /* precharge all banks */
111 *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 | 111 *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 |
112 hi_addr_bit; 112 hi_addr_bit;
113 __asm__ volatile ("sync"); 113 __asm__ volatile ("sync");
114 114
115 /* auto refresh */ 115 /* auto refresh */
116 *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000004 | 116 *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000004 |
117 hi_addr_bit; 117 hi_addr_bit;
118 __asm__ volatile ("sync"); 118 __asm__ volatile ("sync");
119 119
120 /* set mode register */ 120 /* set mode register */
121 *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE; 121 *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE;
122 __asm__ volatile ("sync"); 122 __asm__ volatile ("sync");
123 123
124 /* normal operation */ 124 /* normal operation */
125 *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | hi_addr_bit; 125 *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | hi_addr_bit;
126 __asm__ volatile ("sync"); 126 __asm__ volatile ("sync");
127 } 127 }
128 #endif 128 #endif
129 129
130 /* 130 /*
131 * ATTENTION: Although partially referenced dram_init does NOT make real use 131 * ATTENTION: Although partially referenced dram_init does NOT make real use
132 * use of CONFIG_SYS_SDRAM_BASE. The code does not work if CONFIG_SYS_SDRAM_BASE 132 * use of CONFIG_SYS_SDRAM_BASE. The code does not work if CONFIG_SYS_SDRAM_BASE
133 * is something else than 0x00000000. 133 * is something else than 0x00000000.
134 */ 134 */
135 135
136 int dram_init(void) 136 int dram_init(void)
137 { 137 {
138 ulong dramsize = 0; 138 ulong dramsize = 0;
139 ulong dramsize2 = 0; 139 ulong dramsize2 = 0;
140 uint svr, pvr; 140 uint svr, pvr;
141 141
142 #ifndef CONFIG_SYS_RAMBOOT 142 #ifndef CONFIG_SYS_RAMBOOT
143 ulong test1, test2; 143 ulong test1, test2;
144 144
145 /* setup SDRAM chip selects */ 145 /* setup SDRAM chip selects */
146 *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x0000001c; /* 512MB at 0x0 */ 146 *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x0000001c; /* 512MB at 0x0 */
147 *(vu_long *)MPC5XXX_SDRAM_CS1CFG = 0x40000000; /* disabled */ 147 *(vu_long *)MPC5XXX_SDRAM_CS1CFG = 0x40000000; /* disabled */
148 __asm__ volatile ("sync"); 148 __asm__ volatile ("sync");
149 149
150 /* setup config registers */ 150 /* setup config registers */
151 *(vu_long *)MPC5XXX_SDRAM_CONFIG1 = SDRAM_CONFIG1; 151 *(vu_long *)MPC5XXX_SDRAM_CONFIG1 = SDRAM_CONFIG1;
152 *(vu_long *)MPC5XXX_SDRAM_CONFIG2 = SDRAM_CONFIG2; 152 *(vu_long *)MPC5XXX_SDRAM_CONFIG2 = SDRAM_CONFIG2;
153 __asm__ volatile ("sync"); 153 __asm__ volatile ("sync");
154 154
155 #if SDRAM_DDR 155 #if SDRAM_DDR
156 /* set tap delay */ 156 /* set tap delay */
157 *(vu_long *)MPC5XXX_CDM_PORCFG = SDRAM_TAPDELAY; 157 *(vu_long *)MPC5XXX_CDM_PORCFG = SDRAM_TAPDELAY;
158 __asm__ volatile ("sync"); 158 __asm__ volatile ("sync");
159 #endif 159 #endif
160 160
161 /* find RAM size using SDRAM CS0 only */ 161 /* find RAM size using SDRAM CS0 only */
162 sdram_start(0); 162 sdram_start(0);
163 test1 = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, 0x20000000); 163 test1 = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, 0x20000000);
164 sdram_start(1); 164 sdram_start(1);
165 test2 = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, 0x20000000); 165 test2 = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, 0x20000000);
166 if (test1 > test2) { 166 if (test1 > test2) {
167 sdram_start(0); 167 sdram_start(0);
168 dramsize = test1; 168 dramsize = test1;
169 } else { 169 } else {
170 dramsize = test2; 170 dramsize = test2;
171 } 171 }
172 172
173 /* memory smaller than 1MB is impossible */ 173 /* memory smaller than 1MB is impossible */
174 if (dramsize < (1 << 20)) { 174 if (dramsize < (1 << 20)) {
175 dramsize = 0; 175 dramsize = 0;
176 } 176 }
177 177
178 /* set SDRAM CS0 size according to the amount of RAM found */ 178 /* set SDRAM CS0 size according to the amount of RAM found */
179 if (dramsize > 0) { 179 if (dramsize > 0) {
180 *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x13 + 180 *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x13 +
181 __builtin_ffs(dramsize >> 20) - 1; 181 __builtin_ffs(dramsize >> 20) - 1;
182 } else { 182 } else {
183 *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0; /* disabled */ 183 *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0; /* disabled */
184 } 184 }
185 185
186 /* let SDRAM CS1 start right after CS0 */ 186 /* let SDRAM CS1 start right after CS0 */
187 *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize + 0x0000001c; /* 512MB */ 187 *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize + 0x0000001c; /* 512MB */
188 188
189 /* find RAM size using SDRAM CS1 only */ 189 /* find RAM size using SDRAM CS1 only */
190 if (!dramsize) 190 if (!dramsize)
191 sdram_start(0); 191 sdram_start(0);
192 test2 = test1 = get_ram_size((long *)(CONFIG_SYS_SDRAM_BASE + dramsize), 0x20000000); 192 test2 = test1 = get_ram_size((long *)(CONFIG_SYS_SDRAM_BASE + dramsize), 0x20000000);
193 if (!dramsize) { 193 if (!dramsize) {
194 sdram_start(1); 194 sdram_start(1);
195 test2 = get_ram_size((long *)(CONFIG_SYS_SDRAM_BASE + dramsize), 0x20000000); 195 test2 = get_ram_size((long *)(CONFIG_SYS_SDRAM_BASE + dramsize), 0x20000000);
196 } 196 }
197 if (test1 > test2) { 197 if (test1 > test2) {
198 sdram_start(0); 198 sdram_start(0);
199 dramsize2 = test1; 199 dramsize2 = test1;
200 } else { 200 } else {
201 dramsize2 = test2; 201 dramsize2 = test2;
202 } 202 }
203 203
204 /* memory smaller than 1MB is impossible */ 204 /* memory smaller than 1MB is impossible */
205 if (dramsize2 < (1 << 20)) { 205 if (dramsize2 < (1 << 20)) {
206 dramsize2 = 0; 206 dramsize2 = 0;
207 } 207 }
208 208
209 /* set SDRAM CS1 size according to the amount of RAM found */ 209 /* set SDRAM CS1 size according to the amount of RAM found */
210 if (dramsize2 > 0) { 210 if (dramsize2 > 0) {
211 *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize 211 *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize
212 | (0x13 + __builtin_ffs(dramsize2 >> 20) - 1); 212 | (0x13 + __builtin_ffs(dramsize2 >> 20) - 1);
213 } else { 213 } else {
214 *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize; /* disabled */ 214 *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize; /* disabled */
215 } 215 }
216 216
217 #else /* CONFIG_SYS_RAMBOOT */ 217 #else /* CONFIG_SYS_RAMBOOT */
218 218
219 /* retrieve size of memory connected to SDRAM CS0 */ 219 /* retrieve size of memory connected to SDRAM CS0 */
220 dramsize = *(vu_long *)MPC5XXX_SDRAM_CS0CFG & 0xFF; 220 dramsize = *(vu_long *)MPC5XXX_SDRAM_CS0CFG & 0xFF;
221 if (dramsize >= 0x13) { 221 if (dramsize >= 0x13) {
222 dramsize = (1 << (dramsize - 0x13)) << 20; 222 dramsize = (1 << (dramsize - 0x13)) << 20;
223 } else { 223 } else {
224 dramsize = 0; 224 dramsize = 0;
225 } 225 }
226 226
227 /* retrieve size of memory connected to SDRAM CS1 */ 227 /* retrieve size of memory connected to SDRAM CS1 */
228 dramsize2 = *(vu_long *)MPC5XXX_SDRAM_CS1CFG & 0xFF; 228 dramsize2 = *(vu_long *)MPC5XXX_SDRAM_CS1CFG & 0xFF;
229 if (dramsize2 >= 0x13) { 229 if (dramsize2 >= 0x13) {
230 dramsize2 = (1 << (dramsize2 - 0x13)) << 20; 230 dramsize2 = (1 << (dramsize2 - 0x13)) << 20;
231 } else { 231 } else {
232 dramsize2 = 0; 232 dramsize2 = 0;
233 } 233 }
234 #endif /* CONFIG_SYS_RAMBOOT */ 234 #endif /* CONFIG_SYS_RAMBOOT */
235 235
236 /* 236 /*
237 * On MPC5200B we need to set the special configuration delay in the 237 * On MPC5200B we need to set the special configuration delay in the
238 * DDR controller. Please refer to Freescale's AN3221 "MPC5200B SDRAM 238 * DDR controller. Please refer to Freescale's AN3221 "MPC5200B SDRAM
239 * Initialization and Configuration", 3.3.1 SDelay--MBAR + 0x0190: 239 * Initialization and Configuration", 3.3.1 SDelay--MBAR + 0x0190:
240 * 240 *
241 * "The SDelay should be written to a value of 0x00000004. It is 241 * "The SDelay should be written to a value of 0x00000004. It is
242 * required to account for changes caused by normal wafer processing 242 * required to account for changes caused by normal wafer processing
243 * parameters." 243 * parameters."
244 */ 244 */
245 svr = get_svr(); 245 svr = get_svr();
246 pvr = get_pvr(); 246 pvr = get_pvr();
247 if ((SVR_MJREV(svr) >= 2) && 247 if ((SVR_MJREV(svr) >= 2) &&
248 (PVR_MAJ(pvr) == 1) && (PVR_MIN(pvr) == 4)) { 248 (PVR_MAJ(pvr) == 1) && (PVR_MIN(pvr) == 4)) {
249 249
250 *(vu_long *)MPC5XXX_SDRAM_SDELAY = 0x04; 250 *(vu_long *)MPC5XXX_SDRAM_SDELAY = 0x04;
251 __asm__ volatile ("sync"); 251 __asm__ volatile ("sync");
252 } 252 }
253 253
254 #if defined(CONFIG_TQM5200_B) 254 #if defined(CONFIG_TQM5200_B)
255 gd->ram_size = dramsize + dramsize2; 255 gd->ram_size = dramsize + dramsize2;
256 #else 256 #else
257 gd->ram_size = dramsize; 257 gd->ram_size = dramsize;
258 #endif /* CONFIG_TQM5200_B */ 258 #endif /* CONFIG_TQM5200_B */
259 259
260 return 0; 260 return 0;
261 } 261 }
262 262
263 int checkboard (void) 263 int checkboard (void)
264 { 264 {
265 #if defined(CONFIG_TQM5200S) 265 #if defined(CONFIG_TQM5200S)
266 # define MODULE_NAME "TQM5200S" 266 # define MODULE_NAME "TQM5200S"
267 #else 267 #else
268 # define MODULE_NAME "TQM5200" 268 # define MODULE_NAME "TQM5200"
269 #endif 269 #endif
270 270
271 #if defined(CONFIG_STK52XX) 271 #if defined(CONFIG_STK52XX)
272 # define CARRIER_NAME "STK52xx" 272 # define CARRIER_NAME "STK52xx"
273 #elif defined(CONFIG_CAM5200) 273 #elif defined(CONFIG_CAM5200)
274 # define CARRIER_NAME "CAM5200" 274 # define CARRIER_NAME "CAM5200"
275 #elif defined(CONFIG_FO300) 275 #elif defined(CONFIG_FO300)
276 # define CARRIER_NAME "FO300" 276 # define CARRIER_NAME "FO300"
277 #elif defined(CONFIG_CHARON) 277 #elif defined(CONFIG_CHARON)
278 # define CARRIER_NAME "CHARON" 278 # define CARRIER_NAME "CHARON"
279 #else 279 #else
280 # error "UNKNOWN" 280 # error "UNKNOWN"
281 #endif 281 #endif
282 282
283 puts ( "Board: " MODULE_NAME " (TQ-Components GmbH)\n" 283 puts ( "Board: " MODULE_NAME " (TQ-Components GmbH)\n"
284 " on a " CARRIER_NAME " carrier board\n"); 284 " on a " CARRIER_NAME " carrier board\n");
285 285
286 return 0; 286 return 0;
287 } 287 }
288 288
289 #undef MODULE_NAME 289 #undef MODULE_NAME
290 #undef CARRIER_NAME 290 #undef CARRIER_NAME
291 291
292 void flash_preinit(void) 292 void flash_preinit(void)
293 { 293 {
294 /* 294 /*
295 * Now, when we are in RAM, enable flash write 295 * Now, when we are in RAM, enable flash write
296 * access for detection process. 296 * access for detection process.
297 * Note that CS_BOOT cannot be cleared when 297 * Note that CS_BOOT cannot be cleared when
298 * executing in flash. 298 * executing in flash.
299 */ 299 */
300 *(vu_long *)MPC5XXX_BOOTCS_CFG &= ~0x1; /* clear RO */ 300 *(vu_long *)MPC5XXX_BOOTCS_CFG &= ~0x1; /* clear RO */
301 } 301 }
302 302
303 303
304 #ifdef CONFIG_PCI 304 #ifdef CONFIG_PCI
305 static struct pci_controller hose; 305 static struct pci_controller hose;
306 306
307 extern void pci_mpc5xxx_init(struct pci_controller *); 307 extern void pci_mpc5xxx_init(struct pci_controller *);
308 308
309 void pci_init_board(void) 309 void pci_init_board(void)
310 { 310 {
311 pci_mpc5xxx_init(&hose); 311 pci_mpc5xxx_init(&hose);
312 } 312 }
313 #endif 313 #endif
314 314
315 #if defined(CONFIG_CMD_IDE) && defined(CONFIG_IDE_RESET) 315 #if defined(CONFIG_IDE) && defined(CONFIG_IDE_RESET)
316 316
317 #if defined (CONFIG_MINIFAP) 317 #if defined (CONFIG_MINIFAP)
318 #define SM501_POWER_MODE0_GATE 0x00000040UL 318 #define SM501_POWER_MODE0_GATE 0x00000040UL
319 #define SM501_POWER_MODE1_GATE 0x00000048UL 319 #define SM501_POWER_MODE1_GATE 0x00000048UL
320 #define POWER_MODE_GATE_GPIO_PWM_I2C 0x00000040UL 320 #define POWER_MODE_GATE_GPIO_PWM_I2C 0x00000040UL
321 #define SM501_GPIO_DATA_DIR_HIGH 0x0001000CUL 321 #define SM501_GPIO_DATA_DIR_HIGH 0x0001000CUL
322 #define SM501_GPIO_DATA_HIGH 0x00010004UL 322 #define SM501_GPIO_DATA_HIGH 0x00010004UL
323 #define SM501_GPIO_51 0x00080000UL 323 #define SM501_GPIO_51 0x00080000UL
324 #endif /* CONFIG MINIFAP */ 324 #endif /* CONFIG MINIFAP */
325 325
326 void init_ide_reset (void) 326 void init_ide_reset (void)
327 { 327 {
328 debug ("init_ide_reset\n"); 328 debug ("init_ide_reset\n");
329 329
330 #if defined (CONFIG_MINIFAP) 330 #if defined (CONFIG_MINIFAP)
331 /* Configure GPIO_51 of the SM501 grafic controller as ATA reset */ 331 /* Configure GPIO_51 of the SM501 grafic controller as ATA reset */
332 332
333 /* enable GPIO control (in both power modes) */ 333 /* enable GPIO control (in both power modes) */
334 *(vu_long *) (SM501_MMIO_BASE+SM501_POWER_MODE0_GATE) |= 334 *(vu_long *) (SM501_MMIO_BASE+SM501_POWER_MODE0_GATE) |=
335 POWER_MODE_GATE_GPIO_PWM_I2C; 335 POWER_MODE_GATE_GPIO_PWM_I2C;
336 *(vu_long *) (SM501_MMIO_BASE+SM501_POWER_MODE1_GATE) |= 336 *(vu_long *) (SM501_MMIO_BASE+SM501_POWER_MODE1_GATE) |=
337 POWER_MODE_GATE_GPIO_PWM_I2C; 337 POWER_MODE_GATE_GPIO_PWM_I2C;
338 /* configure GPIO51 as output */ 338 /* configure GPIO51 as output */
339 *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_DIR_HIGH) |= 339 *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_DIR_HIGH) |=
340 SM501_GPIO_51; 340 SM501_GPIO_51;
341 #else 341 #else
342 /* Configure PSC1_4 as GPIO output for ATA reset */ 342 /* Configure PSC1_4 as GPIO output for ATA reset */
343 *(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC1_4; 343 *(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC1_4;
344 *(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC1_4; 344 *(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC1_4;
345 345
346 /* by default the ATA reset is de-asserted */ 346 /* by default the ATA reset is de-asserted */
347 *(vu_long *) MPC5XXX_WU_GPIO_DATA_O |= GPIO_PSC1_4; 347 *(vu_long *) MPC5XXX_WU_GPIO_DATA_O |= GPIO_PSC1_4;
348 #endif 348 #endif
349 } 349 }
350 350
351 void ide_set_reset (int idereset) 351 void ide_set_reset (int idereset)
352 { 352 {
353 debug ("ide_reset(%d)\n", idereset); 353 debug ("ide_reset(%d)\n", idereset);
354 354
355 #if defined (CONFIG_MINIFAP) 355 #if defined (CONFIG_MINIFAP)
356 if (idereset) { 356 if (idereset) {
357 *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) &= 357 *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) &=
358 ~SM501_GPIO_51; 358 ~SM501_GPIO_51;
359 } else { 359 } else {
360 *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) |= 360 *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) |=
361 SM501_GPIO_51; 361 SM501_GPIO_51;
362 } 362 }
363 #else 363 #else
364 if (idereset) { 364 if (idereset) {
365 *(vu_long *) MPC5XXX_WU_GPIO_DATA_O &= ~GPIO_PSC1_4; 365 *(vu_long *) MPC5XXX_WU_GPIO_DATA_O &= ~GPIO_PSC1_4;
366 } else { 366 } else {
367 *(vu_long *) MPC5XXX_WU_GPIO_DATA_O |= GPIO_PSC1_4; 367 *(vu_long *) MPC5XXX_WU_GPIO_DATA_O |= GPIO_PSC1_4;
368 } 368 }
369 #endif 369 #endif
370 } 370 }
371 #endif 371 #endif
372 372
373 #ifdef CONFIG_POST 373 #ifdef CONFIG_POST
374 /* 374 /*
375 * Reads GPIO pin PSC6_3. A keypress is reported, if PSC6_3 is low. If PSC6_3 375 * Reads GPIO pin PSC6_3. A keypress is reported, if PSC6_3 is low. If PSC6_3
376 * is left open, no keypress is detected. 376 * is left open, no keypress is detected.
377 */ 377 */
378 int post_hotkeys_pressed(void) 378 int post_hotkeys_pressed(void)
379 { 379 {
380 #ifdef CONFIG_STK52XX 380 #ifdef CONFIG_STK52XX
381 struct mpc5xxx_gpio *gpio; 381 struct mpc5xxx_gpio *gpio;
382 382
383 gpio = (struct mpc5xxx_gpio*) MPC5XXX_GPIO; 383 gpio = (struct mpc5xxx_gpio*) MPC5XXX_GPIO;
384 384
385 /* 385 /*
386 * Configure PSC6_0 through PSC6_3 as GPIO. 386 * Configure PSC6_0 through PSC6_3 as GPIO.
387 */ 387 */
388 gpio->port_config &= ~(0x00700000); 388 gpio->port_config &= ~(0x00700000);
389 389
390 /* Enable GPIO for GPIO_IRDA_1 (IR_USB_CLK pin) = PSC6_3 */ 390 /* Enable GPIO for GPIO_IRDA_1 (IR_USB_CLK pin) = PSC6_3 */
391 gpio->simple_gpioe |= 0x20000000; 391 gpio->simple_gpioe |= 0x20000000;
392 392
393 /* Configure GPIO_IRDA_1 as input */ 393 /* Configure GPIO_IRDA_1 as input */
394 gpio->simple_ddr &= ~(0x20000000); 394 gpio->simple_ddr &= ~(0x20000000);
395 395
396 return ((gpio->simple_ival & 0x20000000) ? 0 : 1); 396 return ((gpio->simple_ival & 0x20000000) ? 0 : 1);
397 #else 397 #else
398 return 0; 398 return 0;
399 #endif 399 #endif
400 } 400 }
401 #endif 401 #endif
402 402
403 #ifdef CONFIG_BOARD_EARLY_INIT_R 403 #ifdef CONFIG_BOARD_EARLY_INIT_R
404 int board_early_init_r (void) 404 int board_early_init_r (void)
405 { 405 {
406 406
407 extern int usb_cpu_init(void); 407 extern int usb_cpu_init(void);
408 408
409 #ifdef CONFIG_PS2MULT 409 #ifdef CONFIG_PS2MULT
410 ps2mult_early_init(); 410 ps2mult_early_init();
411 #endif /* CONFIG_PS2MULT */ 411 #endif /* CONFIG_PS2MULT */
412 412
413 #if defined(CONFIG_USB_OHCI_NEW) && defined(CONFIG_SYS_USB_OHCI_CPU_INIT) 413 #if defined(CONFIG_USB_OHCI_NEW) && defined(CONFIG_SYS_USB_OHCI_CPU_INIT)
414 /* Low level USB init, required for proper kernel operation */ 414 /* Low level USB init, required for proper kernel operation */
415 usb_cpu_init(); 415 usb_cpu_init();
416 #endif 416 #endif
417 417
418 return (0); 418 return (0);
419 } 419 }
420 #endif 420 #endif
421 421
422 #ifdef CONFIG_FO300 422 #ifdef CONFIG_FO300
423 int silent_boot (void) 423 int silent_boot (void)
424 { 424 {
425 vu_long timer3_status; 425 vu_long timer3_status;
426 426
427 /* Configure GPT3 as GPIO input */ 427 /* Configure GPT3 as GPIO input */
428 *(vu_long *)MPC5XXX_GPT3_ENABLE = 0x00000004; 428 *(vu_long *)MPC5XXX_GPT3_ENABLE = 0x00000004;
429 429
430 /* Read in TIMER_3 pin status */ 430 /* Read in TIMER_3 pin status */
431 timer3_status = *(vu_long *)MPC5XXX_GPT3_STATUS; 431 timer3_status = *(vu_long *)MPC5XXX_GPT3_STATUS;
432 432
433 #ifdef FO300_SILENT_CONSOLE_WHEN_S1_CLOSED 433 #ifdef FO300_SILENT_CONSOLE_WHEN_S1_CLOSED
434 /* Force silent console mode if S1 switch 434 /* Force silent console mode if S1 switch
435 * is in closed position (TIMER_3 pin status is LOW). */ 435 * is in closed position (TIMER_3 pin status is LOW). */
436 if (MPC5XXX_GPT_GPIO_PIN(timer3_status) == 0) 436 if (MPC5XXX_GPT_GPIO_PIN(timer3_status) == 0)
437 return 1; 437 return 1;
438 #else 438 #else
439 /* Force silent console mode if S1 switch 439 /* Force silent console mode if S1 switch
440 * is in open position (TIMER_3 pin status is HIGH). */ 440 * is in open position (TIMER_3 pin status is HIGH). */
441 if (MPC5XXX_GPT_GPIO_PIN(timer3_status) == 1) 441 if (MPC5XXX_GPT_GPIO_PIN(timer3_status) == 1)
442 return 1; 442 return 1;
443 #endif 443 #endif
444 444
445 return 0; 445 return 0;
446 } 446 }
447 447
448 int board_early_init_f (void) 448 int board_early_init_f (void)
449 { 449 {
450 if (silent_boot()) 450 if (silent_boot())
451 gd->flags |= GD_FLG_SILENT; 451 gd->flags |= GD_FLG_SILENT;
452 452
453 return 0; 453 return 0;
454 } 454 }
455 #endif /* CONFIG_FO300 */ 455 #endif /* CONFIG_FO300 */
456 456
457 #if defined(CONFIG_CHARON) 457 #if defined(CONFIG_CHARON)
458 #include <i2c.h> 458 #include <i2c.h>
459 #include <asm/io.h> 459 #include <asm/io.h>
460 460
461 /* The TFP410 registers */ 461 /* The TFP410 registers */
462 #define TFP410_REG_VEN_ID_L 0x00 462 #define TFP410_REG_VEN_ID_L 0x00
463 #define TFP410_REG_VEN_ID_H 0x01 463 #define TFP410_REG_VEN_ID_H 0x01
464 #define TFP410_REG_DEV_ID_L 0x02 464 #define TFP410_REG_DEV_ID_L 0x02
465 #define TFP410_REG_DEV_ID_H 0x03 465 #define TFP410_REG_DEV_ID_H 0x03
466 #define TFP410_REG_REV_ID 0x04 466 #define TFP410_REG_REV_ID 0x04
467 467
468 #define TFP410_REG_CTL_1_MODE 0x08 468 #define TFP410_REG_CTL_1_MODE 0x08
469 #define TFP410_REG_CTL_2_MODE 0x09 469 #define TFP410_REG_CTL_2_MODE 0x09
470 #define TFP410_REG_CTL_3_MODE 0x0A 470 #define TFP410_REG_CTL_3_MODE 0x0A
471 471
472 #define TFP410_REG_CFG 0x0B 472 #define TFP410_REG_CFG 0x0B
473 473
474 #define TFP410_REG_DE_DLY 0x32 474 #define TFP410_REG_DE_DLY 0x32
475 #define TFP410_REG_DE_CTL 0x33 475 #define TFP410_REG_DE_CTL 0x33
476 #define TFP410_REG_DE_TOP 0x34 476 #define TFP410_REG_DE_TOP 0x34
477 #define TFP410_REG_DE_CNT_L 0x36 477 #define TFP410_REG_DE_CNT_L 0x36
478 #define TFP410_REG_DE_CNT_H 0x37 478 #define TFP410_REG_DE_CNT_H 0x37
479 #define TFP410_REG_DE_LIN_L 0x38 479 #define TFP410_REG_DE_LIN_L 0x38
480 #define TFP410_REG_DE_LIN_H 0x39 480 #define TFP410_REG_DE_LIN_H 0x39
481 481
482 #define TFP410_REG_H_RES_L 0x3A 482 #define TFP410_REG_H_RES_L 0x3A
483 #define TFP410_REG_H_RES_H 0x3B 483 #define TFP410_REG_H_RES_H 0x3B
484 #define TFP410_REG_V_RES_L 0x3C 484 #define TFP410_REG_V_RES_L 0x3C
485 #define TFP410_REG_V_RES_H 0x3D 485 #define TFP410_REG_V_RES_H 0x3D
486 486
487 static int tfp410_read_reg(int reg, uchar *buf) 487 static int tfp410_read_reg(int reg, uchar *buf)
488 { 488 {
489 puts("Error reading the chip.\n"); 489 puts("Error reading the chip.\n");
490 return -ENOSYS; 490 return -ENOSYS;
491 } 491 }
492 492
493 static int tfp410_write_reg(int reg, uchar buf) 493 static int tfp410_write_reg(int reg, uchar buf)
494 { 494 {
495 puts("Error writing the chip.\n"); 495 puts("Error writing the chip.\n");
496 return -ENOSYS; 496 return -ENOSYS;
497 } 497 }
498 498
499 typedef struct _tfp410_config { 499 typedef struct _tfp410_config {
500 int reg; 500 int reg;
501 uchar val; 501 uchar val;
502 }TFP410_CONFIG; 502 }TFP410_CONFIG;
503 503
504 static TFP410_CONFIG tfp410_configtbl[] = { 504 static TFP410_CONFIG tfp410_configtbl[] = {
505 {TFP410_REG_CTL_1_MODE, 0x37}, 505 {TFP410_REG_CTL_1_MODE, 0x37},
506 {TFP410_REG_CTL_2_MODE, 0x20}, 506 {TFP410_REG_CTL_2_MODE, 0x20},
507 {TFP410_REG_CTL_3_MODE, 0x80}, 507 {TFP410_REG_CTL_3_MODE, 0x80},
508 {TFP410_REG_DE_DLY, 0x90}, 508 {TFP410_REG_DE_DLY, 0x90},
509 {TFP410_REG_DE_CTL, 0x00}, 509 {TFP410_REG_DE_CTL, 0x00},
510 {TFP410_REG_DE_TOP, 0x23}, 510 {TFP410_REG_DE_TOP, 0x23},
511 {TFP410_REG_DE_CNT_H, 0x02}, 511 {TFP410_REG_DE_CNT_H, 0x02},
512 {TFP410_REG_DE_CNT_L, 0x80}, 512 {TFP410_REG_DE_CNT_L, 0x80},
513 {TFP410_REG_DE_LIN_H, 0x01}, 513 {TFP410_REG_DE_LIN_H, 0x01},
514 {TFP410_REG_DE_LIN_L, 0xe0}, 514 {TFP410_REG_DE_LIN_L, 0xe0},
515 {-1, 0}, 515 {-1, 0},
516 }; 516 };
517 517
518 static int charon_last_stage_init(void) 518 static int charon_last_stage_init(void)
519 { 519 {
520 volatile struct mpc5xxx_lpb *lpb = 520 volatile struct mpc5xxx_lpb *lpb =
521 (struct mpc5xxx_lpb *) MPC5XXX_LPB; 521 (struct mpc5xxx_lpb *) MPC5XXX_LPB;
522 uchar buf; 522 uchar buf;
523 int i = 0; 523 int i = 0;
524 524
525 /* check version */ 525 /* check version */
526 if (tfp410_read_reg(TFP410_REG_DEV_ID_H, &buf) != 0) 526 if (tfp410_read_reg(TFP410_REG_DEV_ID_H, &buf) != 0)
527 return -1; 527 return -1;
528 if (!(buf & 0x04)) 528 if (!(buf & 0x04))
529 return -1; 529 return -1;
530 if (tfp410_read_reg(TFP410_REG_DEV_ID_L, &buf) != 0) 530 if (tfp410_read_reg(TFP410_REG_DEV_ID_L, &buf) != 0)
531 return -1; 531 return -1;
532 if (!(buf & 0x10)) 532 if (!(buf & 0x10))
533 return -1; 533 return -1;
534 /* OK, now init the chip */ 534 /* OK, now init the chip */
535 while (tfp410_configtbl[i].reg != -1) { 535 while (tfp410_configtbl[i].reg != -1) {
536 int ret; 536 int ret;
537 537
538 ret = tfp410_write_reg(tfp410_configtbl[i].reg, 538 ret = tfp410_write_reg(tfp410_configtbl[i].reg,
539 tfp410_configtbl[i].val); 539 tfp410_configtbl[i].val);
540 if (ret != 0) 540 if (ret != 0)
541 return -1; 541 return -1;
542 i++; 542 i++;
543 } 543 }
544 printf("TFP410 initialized.\n"); 544 printf("TFP410 initialized.\n");
545 545
546 /* set deadcycle for cs3 to 0 */ 546 /* set deadcycle for cs3 to 0 */
547 setbits_be32(&lpb->cs_deadcycle, 0xffffcfff); 547 setbits_be32(&lpb->cs_deadcycle, 0xffffcfff);
548 return 0; 548 return 0;
549 } 549 }
550 #endif 550 #endif
551 551
552 int last_stage_init (void) 552 int last_stage_init (void)
553 { 553 {
554 /* 554 /*
555 * auto scan for really existing devices and re-set chip select 555 * auto scan for really existing devices and re-set chip select
556 * configuration. 556 * configuration.
557 */ 557 */
558 u16 save, tmp; 558 u16 save, tmp;
559 int restore; 559 int restore;
560 560
561 /* 561 /*
562 * Check for SRAM and SRAM size 562 * Check for SRAM and SRAM size
563 */ 563 */
564 564
565 /* save original SRAM content */ 565 /* save original SRAM content */
566 save = *(volatile u16 *)CONFIG_SYS_CS2_START; 566 save = *(volatile u16 *)CONFIG_SYS_CS2_START;
567 restore = 1; 567 restore = 1;
568 568
569 /* write test pattern to SRAM */ 569 /* write test pattern to SRAM */
570 *(volatile u16 *)CONFIG_SYS_CS2_START = 0xA5A5; 570 *(volatile u16 *)CONFIG_SYS_CS2_START = 0xA5A5;
571 __asm__ volatile ("sync"); 571 __asm__ volatile ("sync");
572 /* 572 /*
573 * Put a different pattern on the data lines: otherwise they may float 573 * Put a different pattern on the data lines: otherwise they may float
574 * long enough to read back what we wrote. 574 * long enough to read back what we wrote.
575 */ 575 */
576 tmp = *(volatile u16 *)CONFIG_SYS_FLASH_BASE; 576 tmp = *(volatile u16 *)CONFIG_SYS_FLASH_BASE;
577 if (tmp == 0xA5A5) 577 if (tmp == 0xA5A5)
578 puts ("!! possible error in SRAM detection\n"); 578 puts ("!! possible error in SRAM detection\n");
579 579
580 if (*(volatile u16 *)CONFIG_SYS_CS2_START != 0xA5A5) { 580 if (*(volatile u16 *)CONFIG_SYS_CS2_START != 0xA5A5) {
581 /* no SRAM at all, disable cs */ 581 /* no SRAM at all, disable cs */
582 *(vu_long *)MPC5XXX_ADDECR &= ~(1 << 18); 582 *(vu_long *)MPC5XXX_ADDECR &= ~(1 << 18);
583 *(vu_long *)MPC5XXX_CS2_START = 0x0000FFFF; 583 *(vu_long *)MPC5XXX_CS2_START = 0x0000FFFF;
584 *(vu_long *)MPC5XXX_CS2_STOP = 0x0000FFFF; 584 *(vu_long *)MPC5XXX_CS2_STOP = 0x0000FFFF;
585 restore = 0; 585 restore = 0;
586 __asm__ volatile ("sync"); 586 __asm__ volatile ("sync");
587 } else if (*(volatile u16 *)(CONFIG_SYS_CS2_START + (1<<19)) == 0xA5A5) { 587 } else if (*(volatile u16 *)(CONFIG_SYS_CS2_START + (1<<19)) == 0xA5A5) {
588 /* make sure that we access a mirrored address */ 588 /* make sure that we access a mirrored address */
589 *(volatile u16 *)CONFIG_SYS_CS2_START = 0x1111; 589 *(volatile u16 *)CONFIG_SYS_CS2_START = 0x1111;
590 __asm__ volatile ("sync"); 590 __asm__ volatile ("sync");
591 if (*(volatile u16 *)(CONFIG_SYS_CS2_START + (1<<19)) == 0x1111) { 591 if (*(volatile u16 *)(CONFIG_SYS_CS2_START + (1<<19)) == 0x1111) {
592 /* SRAM size = 512 kByte */ 592 /* SRAM size = 512 kByte */
593 *(vu_long *)MPC5XXX_CS2_STOP = STOP_REG(CONFIG_SYS_CS2_START, 593 *(vu_long *)MPC5XXX_CS2_STOP = STOP_REG(CONFIG_SYS_CS2_START,
594 0x80000); 594 0x80000);
595 __asm__ volatile ("sync"); 595 __asm__ volatile ("sync");
596 puts ("SRAM: 512 kB\n"); 596 puts ("SRAM: 512 kB\n");
597 } 597 }
598 else 598 else
599 puts ("!! possible error in SRAM detection\n"); 599 puts ("!! possible error in SRAM detection\n");
600 } else { 600 } else {
601 puts ("SRAM: 1 MB\n"); 601 puts ("SRAM: 1 MB\n");
602 } 602 }
603 /* restore origianl SRAM content */ 603 /* restore origianl SRAM content */
604 if (restore) { 604 if (restore) {
605 *(volatile u16 *)CONFIG_SYS_CS2_START = save; 605 *(volatile u16 *)CONFIG_SYS_CS2_START = save;
606 __asm__ volatile ("sync"); 606 __asm__ volatile ("sync");
607 } 607 }
608 608
609 #ifndef CONFIG_TQM5200S /* The TQM5200S has no SM501 grafic controller */ 609 #ifndef CONFIG_TQM5200S /* The TQM5200S has no SM501 grafic controller */
610 /* 610 /*
611 * Check for Grafic Controller 611 * Check for Grafic Controller
612 */ 612 */
613 613
614 /* save origianl FB content */ 614 /* save origianl FB content */
615 save = *(volatile u16 *)CONFIG_SYS_CS1_START; 615 save = *(volatile u16 *)CONFIG_SYS_CS1_START;
616 restore = 1; 616 restore = 1;
617 617
618 /* write test pattern to FB memory */ 618 /* write test pattern to FB memory */
619 *(volatile u16 *)CONFIG_SYS_CS1_START = 0xA5A5; 619 *(volatile u16 *)CONFIG_SYS_CS1_START = 0xA5A5;
620 __asm__ volatile ("sync"); 620 __asm__ volatile ("sync");
621 /* 621 /*
622 * Put a different pattern on the data lines: otherwise they may float 622 * Put a different pattern on the data lines: otherwise they may float
623 * long enough to read back what we wrote. 623 * long enough to read back what we wrote.
624 */ 624 */
625 tmp = *(volatile u16 *)CONFIG_SYS_FLASH_BASE; 625 tmp = *(volatile u16 *)CONFIG_SYS_FLASH_BASE;
626 if (tmp == 0xA5A5) 626 if (tmp == 0xA5A5)
627 puts ("!! possible error in grafic controller detection\n"); 627 puts ("!! possible error in grafic controller detection\n");
628 628
629 if (*(volatile u16 *)CONFIG_SYS_CS1_START != 0xA5A5) { 629 if (*(volatile u16 *)CONFIG_SYS_CS1_START != 0xA5A5) {
630 /* no grafic controller at all, disable cs */ 630 /* no grafic controller at all, disable cs */
631 *(vu_long *)MPC5XXX_ADDECR &= ~(1 << 17); 631 *(vu_long *)MPC5XXX_ADDECR &= ~(1 << 17);
632 *(vu_long *)MPC5XXX_CS1_START = 0x0000FFFF; 632 *(vu_long *)MPC5XXX_CS1_START = 0x0000FFFF;
633 *(vu_long *)MPC5XXX_CS1_STOP = 0x0000FFFF; 633 *(vu_long *)MPC5XXX_CS1_STOP = 0x0000FFFF;
634 restore = 0; 634 restore = 0;
635 __asm__ volatile ("sync"); 635 __asm__ volatile ("sync");
636 } else { 636 } else {
637 puts ("VGA: SMI501 (Voyager) with 8 MB\n"); 637 puts ("VGA: SMI501 (Voyager) with 8 MB\n");
638 } 638 }
639 /* restore origianl FB content */ 639 /* restore origianl FB content */
640 if (restore) { 640 if (restore) {
641 *(volatile u16 *)CONFIG_SYS_CS1_START = save; 641 *(volatile u16 *)CONFIG_SYS_CS1_START = save;
642 __asm__ volatile ("sync"); 642 __asm__ volatile ("sync");
643 } 643 }
644 644
645 #ifdef CONFIG_FO300 645 #ifdef CONFIG_FO300
646 if (silent_boot()) { 646 if (silent_boot()) {
647 setenv("bootdelay", "0"); 647 setenv("bootdelay", "0");
648 disable_ctrlc(1); 648 disable_ctrlc(1);
649 } 649 }
650 #endif 650 #endif
651 #endif /* !CONFIG_TQM5200S */ 651 #endif /* !CONFIG_TQM5200S */
652 652
653 #if defined(CONFIG_CHARON) 653 #if defined(CONFIG_CHARON)
654 charon_last_stage_init(); 654 charon_last_stage_init();
655 #endif 655 #endif
656 return 0; 656 return 0;
657 } 657 }
658 658
659 #ifdef CONFIG_VIDEO_SM501 659 #ifdef CONFIG_VIDEO_SM501
660 660
661 #ifdef CONFIG_FO300 661 #ifdef CONFIG_FO300
662 #define DISPLAY_WIDTH 800 662 #define DISPLAY_WIDTH 800
663 #else 663 #else
664 #define DISPLAY_WIDTH 640 664 #define DISPLAY_WIDTH 640
665 #endif 665 #endif
666 #define DISPLAY_HEIGHT 480 666 #define DISPLAY_HEIGHT 480
667 667
668 #ifdef CONFIG_VIDEO_SM501_8BPP 668 #ifdef CONFIG_VIDEO_SM501_8BPP
669 #error CONFIG_VIDEO_SM501_8BPP not supported. 669 #error CONFIG_VIDEO_SM501_8BPP not supported.
670 #endif /* CONFIG_VIDEO_SM501_8BPP */ 670 #endif /* CONFIG_VIDEO_SM501_8BPP */
671 671
672 #ifdef CONFIG_VIDEO_SM501_16BPP 672 #ifdef CONFIG_VIDEO_SM501_16BPP
673 #error CONFIG_VIDEO_SM501_16BPP not supported. 673 #error CONFIG_VIDEO_SM501_16BPP not supported.
674 #endif /* CONFIG_VIDEO_SM501_16BPP */ 674 #endif /* CONFIG_VIDEO_SM501_16BPP */
675 #ifdef CONFIG_VIDEO_SM501_32BPP 675 #ifdef CONFIG_VIDEO_SM501_32BPP
676 static const SMI_REGS init_regs [] = 676 static const SMI_REGS init_regs [] =
677 { 677 {
678 #if 0 /* CRT only */ 678 #if 0 /* CRT only */
679 {0x00004, 0x0}, 679 {0x00004, 0x0},
680 {0x00048, 0x00021807}, 680 {0x00048, 0x00021807},
681 {0x0004C, 0x10090a01}, 681 {0x0004C, 0x10090a01},
682 {0x00054, 0x1}, 682 {0x00054, 0x1},
683 {0x00040, 0x00021807}, 683 {0x00040, 0x00021807},
684 {0x00044, 0x10090a01}, 684 {0x00044, 0x10090a01},
685 {0x00054, 0x0}, 685 {0x00054, 0x0},
686 {0x80200, 0x00010000}, 686 {0x80200, 0x00010000},
687 {0x80204, 0x0}, 687 {0x80204, 0x0},
688 {0x80208, 0x0A000A00}, 688 {0x80208, 0x0A000A00},
689 {0x8020C, 0x02fa027f}, 689 {0x8020C, 0x02fa027f},
690 {0x80210, 0x004a028b}, 690 {0x80210, 0x004a028b},
691 {0x80214, 0x020c01df}, 691 {0x80214, 0x020c01df},
692 {0x80218, 0x000201e9}, 692 {0x80218, 0x000201e9},
693 {0x80200, 0x00013306}, 693 {0x80200, 0x00013306},
694 #else /* panel + CRT */ 694 #else /* panel + CRT */
695 #ifdef CONFIG_FO300 695 #ifdef CONFIG_FO300
696 {0x00004, 0x0}, 696 {0x00004, 0x0},
697 {0x00048, 0x00021807}, 697 {0x00048, 0x00021807},
698 {0x0004C, 0x301a0a01}, 698 {0x0004C, 0x301a0a01},
699 {0x00054, 0x1}, 699 {0x00054, 0x1},
700 {0x00040, 0x00021807}, 700 {0x00040, 0x00021807},
701 {0x00044, 0x091a0a01}, 701 {0x00044, 0x091a0a01},
702 {0x00054, 0x0}, 702 {0x00054, 0x0},
703 {0x80000, 0x0f013106}, 703 {0x80000, 0x0f013106},
704 {0x80004, 0xc428bb17}, 704 {0x80004, 0xc428bb17},
705 {0x8000C, 0x00000000}, 705 {0x8000C, 0x00000000},
706 {0x80010, 0x0C800C80}, 706 {0x80010, 0x0C800C80},
707 {0x80014, 0x03200000}, 707 {0x80014, 0x03200000},
708 {0x80018, 0x01e00000}, 708 {0x80018, 0x01e00000},
709 {0x8001C, 0x00000000}, 709 {0x8001C, 0x00000000},
710 {0x80020, 0x01e00320}, 710 {0x80020, 0x01e00320},
711 {0x80024, 0x042a031f}, 711 {0x80024, 0x042a031f},
712 {0x80028, 0x0086034a}, 712 {0x80028, 0x0086034a},
713 {0x8002C, 0x020c01df}, 713 {0x8002C, 0x020c01df},
714 {0x80030, 0x000201ea}, 714 {0x80030, 0x000201ea},
715 {0x80200, 0x00010000}, 715 {0x80200, 0x00010000},
716 #else 716 #else
717 {0x00004, 0x0}, 717 {0x00004, 0x0},
718 {0x00048, 0x00021807}, 718 {0x00048, 0x00021807},
719 {0x0004C, 0x091a0a01}, 719 {0x0004C, 0x091a0a01},
720 {0x00054, 0x1}, 720 {0x00054, 0x1},
721 {0x00040, 0x00021807}, 721 {0x00040, 0x00021807},
722 {0x00044, 0x091a0a01}, 722 {0x00044, 0x091a0a01},
723 {0x00054, 0x0}, 723 {0x00054, 0x0},
724 {0x80000, 0x0f013106}, 724 {0x80000, 0x0f013106},
725 {0x80004, 0xc428bb17}, 725 {0x80004, 0xc428bb17},
726 {0x8000C, 0x00000000}, 726 {0x8000C, 0x00000000},
727 {0x80010, 0x0a000a00}, 727 {0x80010, 0x0a000a00},
728 {0x80014, 0x02800000}, 728 {0x80014, 0x02800000},
729 {0x80018, 0x01e00000}, 729 {0x80018, 0x01e00000},
730 {0x8001C, 0x00000000}, 730 {0x8001C, 0x00000000},
731 {0x80020, 0x01e00280}, 731 {0x80020, 0x01e00280},
732 {0x80024, 0x02fa027f}, 732 {0x80024, 0x02fa027f},
733 {0x80028, 0x004a028b}, 733 {0x80028, 0x004a028b},
734 {0x8002C, 0x020c01df}, 734 {0x8002C, 0x020c01df},
735 {0x80030, 0x000201e9}, 735 {0x80030, 0x000201e9},
736 {0x80200, 0x00010000}, 736 {0x80200, 0x00010000},
737 #endif /* #ifdef CONFIG_FO300 */ 737 #endif /* #ifdef CONFIG_FO300 */
738 #endif 738 #endif
739 {0, 0} 739 {0, 0}
740 }; 740 };
741 #endif /* CONFIG_VIDEO_SM501_32BPP */ 741 #endif /* CONFIG_VIDEO_SM501_32BPP */
742 742
743 #ifdef CONFIG_CONSOLE_EXTRA_INFO 743 #ifdef CONFIG_CONSOLE_EXTRA_INFO
744 /* 744 /*
745 * Return text to be printed besides the logo. 745 * Return text to be printed besides the logo.
746 */ 746 */
747 void video_get_info_str (int line_number, char *info) 747 void video_get_info_str (int line_number, char *info)
748 { 748 {
749 if (line_number == 1) { 749 if (line_number == 1) {
750 strcpy (info, " Board: TQM5200 (TQ-Components GmbH)"); 750 strcpy (info, " Board: TQM5200 (TQ-Components GmbH)");
751 #if defined (CONFIG_CHARON) || defined (CONFIG_FO300) || \ 751 #if defined (CONFIG_CHARON) || defined (CONFIG_FO300) || \
752 defined(CONFIG_STK52XX) 752 defined(CONFIG_STK52XX)
753 } else if (line_number == 2) { 753 } else if (line_number == 2) {
754 #if defined (CONFIG_CHARON) 754 #if defined (CONFIG_CHARON)
755 strcpy (info, " on a CHARON carrier board"); 755 strcpy (info, " on a CHARON carrier board");
756 #endif 756 #endif
757 #if defined (CONFIG_STK52XX) 757 #if defined (CONFIG_STK52XX)
758 strcpy (info, " on a STK52xx carrier board"); 758 strcpy (info, " on a STK52xx carrier board");
759 #endif 759 #endif
760 #if defined (CONFIG_FO300) 760 #if defined (CONFIG_FO300)
761 strcpy (info, " on a FO300 carrier board"); 761 strcpy (info, " on a FO300 carrier board");
762 #endif 762 #endif
763 #endif 763 #endif
764 } 764 }
765 else { 765 else {
766 info [0] = '\0'; 766 info [0] = '\0';
767 } 767 }
768 } 768 }
769 #endif 769 #endif
770 770
771 /* 771 /*
772 * Returns SM501 register base address. First thing called in the 772 * Returns SM501 register base address. First thing called in the
773 * driver. Checks if SM501 is physically present. 773 * driver. Checks if SM501 is physically present.
774 */ 774 */
775 unsigned int board_video_init (void) 775 unsigned int board_video_init (void)
776 { 776 {
777 u16 save, tmp; 777 u16 save, tmp;
778 int restore, ret; 778 int restore, ret;
779 779
780 /* 780 /*
781 * Check for Grafic Controller 781 * Check for Grafic Controller
782 */ 782 */
783 783
784 /* save origianl FB content */ 784 /* save origianl FB content */
785 save = *(volatile u16 *)CONFIG_SYS_CS1_START; 785 save = *(volatile u16 *)CONFIG_SYS_CS1_START;
786 restore = 1; 786 restore = 1;
787 787
788 /* write test pattern to FB memory */ 788 /* write test pattern to FB memory */
789 *(volatile u16 *)CONFIG_SYS_CS1_START = 0xA5A5; 789 *(volatile u16 *)CONFIG_SYS_CS1_START = 0xA5A5;
790 __asm__ volatile ("sync"); 790 __asm__ volatile ("sync");
791 /* 791 /*
792 * Put a different pattern on the data lines: otherwise they may float 792 * Put a different pattern on the data lines: otherwise they may float
793 * long enough to read back what we wrote. 793 * long enough to read back what we wrote.
794 */ 794 */
795 tmp = *(volatile u16 *)CONFIG_SYS_FLASH_BASE; 795 tmp = *(volatile u16 *)CONFIG_SYS_FLASH_BASE;
796 if (tmp == 0xA5A5) 796 if (tmp == 0xA5A5)
797 puts ("!! possible error in grafic controller detection\n"); 797 puts ("!! possible error in grafic controller detection\n");
798 798
799 if (*(volatile u16 *)CONFIG_SYS_CS1_START != 0xA5A5) { 799 if (*(volatile u16 *)CONFIG_SYS_CS1_START != 0xA5A5) {
800 /* no grafic controller found */ 800 /* no grafic controller found */
801 restore = 0; 801 restore = 0;
802 ret = 0; 802 ret = 0;
803 } else { 803 } else {
804 ret = SM501_MMIO_BASE; 804 ret = SM501_MMIO_BASE;
805 } 805 }
806 806
807 if (restore) { 807 if (restore) {
808 *(volatile u16 *)CONFIG_SYS_CS1_START = save; 808 *(volatile u16 *)CONFIG_SYS_CS1_START = save;
809 __asm__ volatile ("sync"); 809 __asm__ volatile ("sync");
810 } 810 }
811 return ret; 811 return ret;
812 } 812 }
813 813
814 /* 814 /*
815 * Returns SM501 framebuffer address 815 * Returns SM501 framebuffer address
816 */ 816 */
817 unsigned int board_video_get_fb (void) 817 unsigned int board_video_get_fb (void)
818 { 818 {
819 return SM501_FB_BASE; 819 return SM501_FB_BASE;
820 } 820 }
821 821
822 /* 822 /*
823 * Called after initializing the SM501 and before clearing the screen. 823 * Called after initializing the SM501 and before clearing the screen.
824 */ 824 */
825 void board_validate_screen (unsigned int base) 825 void board_validate_screen (unsigned int base)
826 { 826 {
827 } 827 }
828 828
829 /* 829 /*
830 * Return a pointer to the initialization sequence. 830 * Return a pointer to the initialization sequence.
831 */ 831 */
832 const SMI_REGS *board_get_regs (void) 832 const SMI_REGS *board_get_regs (void)
833 { 833 {
834 return init_regs; 834 return init_regs;
835 } 835 }
836 836
837 int board_get_width (void) 837 int board_get_width (void)
838 { 838 {
839 return DISPLAY_WIDTH; 839 return DISPLAY_WIDTH;
840 } 840 }
841 841
842 int board_get_height (void) 842 int board_get_height (void)
843 { 843 {
844 return DISPLAY_HEIGHT; 844 return DISPLAY_HEIGHT;
845 } 845 }
846 846
847 #endif /* CONFIG_VIDEO_SM501 */ 847 #endif /* CONFIG_VIDEO_SM501 */
848 848
849 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) 849 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
850 int ft_board_setup(void *blob, bd_t *bd) 850 int ft_board_setup(void *blob, bd_t *bd)
851 { 851 {
852 ft_cpu_setup(blob, bd); 852 ft_cpu_setup(blob, bd);
853 #if defined(CONFIG_VIDEO) 853 #if defined(CONFIG_VIDEO)
854 fdt_add_edid(blob, "smi,sm501", edid_buf); 854 fdt_add_edid(blob, "smi,sm501", edid_buf);
855 #endif 855 #endif
856 856
857 return 0; 857 return 0;
858 } 858 }
859 #endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */ 859 #endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
860 860
861 #if defined(CONFIG_RESET_PHY_R) 861 #if defined(CONFIG_RESET_PHY_R)
862 #include <miiphy.h> 862 #include <miiphy.h>
863 863
864 void reset_phy(void) 864 void reset_phy(void)
865 { 865 {
866 /* init Micrel KSZ8993 PHY */ 866 /* init Micrel KSZ8993 PHY */
867 miiphy_write("FEC", CONFIG_PHY_ADDR, 0x01, 0x09); 867 miiphy_write("FEC", CONFIG_PHY_ADDR, 0x01, 0x09);
868 } 868 }
869 #endif 869 #endif
870 870
871 int board_eth_init(bd_t *bis) 871 int board_eth_init(bd_t *bis)
872 { 872 {
873 cpu_eth_init(bis); /* Built in FEC comes first */ 873 cpu_eth_init(bis); /* Built in FEC comes first */
874 return pci_eth_init(bis); 874 return pci_eth_init(bis);
875 } 875 }
876 876
1 /* 1 /*
2 * (C) Copyright 2003-2006 2 * (C) Copyright 2003-2006
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 * 4 *
5 * (C) Copyright 2004 5 * (C) Copyright 2004
6 * Mark Jonas, Freescale Semiconductor, mark.jonas@motorola.com. 6 * Mark Jonas, Freescale Semiconductor, mark.jonas@motorola.com.
7 * 7 *
8 * SPDX-License-Identifier: GPL-2.0+ 8 * SPDX-License-Identifier: GPL-2.0+
9 */ 9 */
10 10
11 #include <common.h> 11 #include <common.h>
12 #include <mpc5xxx.h> 12 #include <mpc5xxx.h>
13 #include <net.h> 13 #include <net.h>
14 #include <asm/processor.h> 14 #include <asm/processor.h>
15 15
16 DECLARE_GLOBAL_DATA_PTR; 16 DECLARE_GLOBAL_DATA_PTR;
17 17
18 #ifndef CONFIG_SYS_RAMBOOT 18 #ifndef CONFIG_SYS_RAMBOOT
19 static void sdram_start(int hi_addr) 19 static void sdram_start(int hi_addr)
20 { 20 {
21 long hi_addr_bit = hi_addr ? 0x01000000 : 0; 21 long hi_addr_bit = hi_addr ? 0x01000000 : 0;
22 22
23 /* unlock mode register */ 23 /* unlock mode register */
24 *(vu_long *) MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000000 | hi_addr_bit; 24 *(vu_long *) MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000000 | hi_addr_bit;
25 __asm__ volatile ("sync"); 25 __asm__ volatile ("sync");
26 26
27 /* precharge all banks */ 27 /* precharge all banks */
28 *(vu_long *) MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 | hi_addr_bit; 28 *(vu_long *) MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 | hi_addr_bit;
29 __asm__ volatile ("sync"); 29 __asm__ volatile ("sync");
30 30
31 #if SDRAM_DDR 31 #if SDRAM_DDR
32 /* set mode register: extended mode */ 32 /* set mode register: extended mode */
33 *(vu_long *) MPC5XXX_SDRAM_MODE = SDRAM_EMODE; 33 *(vu_long *) MPC5XXX_SDRAM_MODE = SDRAM_EMODE;
34 __asm__ volatile ("sync"); 34 __asm__ volatile ("sync");
35 35
36 /* set mode register: reset DLL */ 36 /* set mode register: reset DLL */
37 *(vu_long *) MPC5XXX_SDRAM_MODE = SDRAM_MODE | 0x04000000; 37 *(vu_long *) MPC5XXX_SDRAM_MODE = SDRAM_MODE | 0x04000000;
38 __asm__ volatile ("sync"); 38 __asm__ volatile ("sync");
39 #endif /* SDRAM_DDR */ 39 #endif /* SDRAM_DDR */
40 40
41 /* precharge all banks */ 41 /* precharge all banks */
42 *(vu_long *) MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 | hi_addr_bit; 42 *(vu_long *) MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 | hi_addr_bit;
43 __asm__ volatile ("sync"); 43 __asm__ volatile ("sync");
44 44
45 /* auto refresh */ 45 /* auto refresh */
46 *(vu_long *) MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000004 | hi_addr_bit; 46 *(vu_long *) MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000004 | hi_addr_bit;
47 __asm__ volatile ("sync"); 47 __asm__ volatile ("sync");
48 48
49 /* set mode register */ 49 /* set mode register */
50 *(vu_long *) MPC5XXX_SDRAM_MODE = SDRAM_MODE; 50 *(vu_long *) MPC5XXX_SDRAM_MODE = SDRAM_MODE;
51 __asm__ volatile ("sync"); 51 __asm__ volatile ("sync");
52 52
53 /* normal operation */ 53 /* normal operation */
54 *(vu_long *) MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | hi_addr_bit; 54 *(vu_long *) MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | hi_addr_bit;
55 __asm__ volatile ("sync"); 55 __asm__ volatile ("sync");
56 } 56 }
57 #endif /* !CONFIG_SYS_RAMBOOT */ 57 #endif /* !CONFIG_SYS_RAMBOOT */
58 58
59 59
60 int dram_init(void) 60 int dram_init(void)
61 { 61 {
62 ulong dramsize = 0; 62 ulong dramsize = 0;
63 ulong dramsize2 = 0; 63 ulong dramsize2 = 0;
64 uint svr, pvr; 64 uint svr, pvr;
65 65
66 #ifndef CONFIG_SYS_RAMBOOT 66 #ifndef CONFIG_SYS_RAMBOOT
67 ulong test1, test2; 67 ulong test1, test2;
68 68
69 /* setup SDRAM chip selects */ 69 /* setup SDRAM chip selects */
70 *(vu_long *) MPC5XXX_SDRAM_CS0CFG = 0x0000001e; /* 2G at 0x0 */ 70 *(vu_long *) MPC5XXX_SDRAM_CS0CFG = 0x0000001e; /* 2G at 0x0 */
71 *(vu_long *) MPC5XXX_SDRAM_CS1CFG = 0x80000000; /* disabled */ 71 *(vu_long *) MPC5XXX_SDRAM_CS1CFG = 0x80000000; /* disabled */
72 __asm__ volatile ("sync"); 72 __asm__ volatile ("sync");
73 73
74 /* setup config registers */ 74 /* setup config registers */
75 *(vu_long *) MPC5XXX_SDRAM_CONFIG1 = SDRAM_CONFIG1; 75 *(vu_long *) MPC5XXX_SDRAM_CONFIG1 = SDRAM_CONFIG1;
76 *(vu_long *) MPC5XXX_SDRAM_CONFIG2 = SDRAM_CONFIG2; 76 *(vu_long *) MPC5XXX_SDRAM_CONFIG2 = SDRAM_CONFIG2;
77 __asm__ volatile ("sync"); 77 __asm__ volatile ("sync");
78 78
79 #if SDRAM_DDR 79 #if SDRAM_DDR
80 /* set tap delay */ 80 /* set tap delay */
81 *(vu_long *) MPC5XXX_CDM_PORCFG = SDRAM_TAPDELAY; 81 *(vu_long *) MPC5XXX_CDM_PORCFG = SDRAM_TAPDELAY;
82 __asm__ volatile ("sync"); 82 __asm__ volatile ("sync");
83 #endif /* SDRAM_DDR */ 83 #endif /* SDRAM_DDR */
84 84
85 /* find RAM size using SDRAM CS0 only */ 85 /* find RAM size using SDRAM CS0 only */
86 sdram_start(0); 86 sdram_start(0);
87 test1 = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, 0x80000000); 87 test1 = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, 0x80000000);
88 sdram_start(1); 88 sdram_start(1);
89 test2 = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, 0x80000000); 89 test2 = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, 0x80000000);
90 if (test1 > test2) { 90 if (test1 > test2) {
91 sdram_start(0); 91 sdram_start(0);
92 dramsize = test1; 92 dramsize = test1;
93 } else 93 } else
94 dramsize = test2; 94 dramsize = test2;
95 95
96 /* memory smaller than 1MB is impossible */ 96 /* memory smaller than 1MB is impossible */
97 if (dramsize < (1 << 20)) 97 if (dramsize < (1 << 20))
98 dramsize = 0; 98 dramsize = 0;
99 99
100 /* set SDRAM CS0 size according to the amount of RAM found */ 100 /* set SDRAM CS0 size according to the amount of RAM found */
101 if (dramsize > 0) 101 if (dramsize > 0)
102 *(vu_long *) MPC5XXX_SDRAM_CS0CFG = 0x13 + __builtin_ffs(dramsize >> 20) - 1; 102 *(vu_long *) MPC5XXX_SDRAM_CS0CFG = 0x13 + __builtin_ffs(dramsize >> 20) - 1;
103 else 103 else
104 *(vu_long *) MPC5XXX_SDRAM_CS0CFG = 0; /* disabled */ 104 *(vu_long *) MPC5XXX_SDRAM_CS0CFG = 0; /* disabled */
105 105
106 /* let SDRAM CS1 start right after CS0 */ 106 /* let SDRAM CS1 start right after CS0 */
107 *(vu_long *) MPC5XXX_SDRAM_CS1CFG = dramsize + 0x0000001e;/* 2G */ 107 *(vu_long *) MPC5XXX_SDRAM_CS1CFG = dramsize + 0x0000001e;/* 2G */
108 108
109 /* find RAM size using SDRAM CS1 only */ 109 /* find RAM size using SDRAM CS1 only */
110 if (!dramsize) 110 if (!dramsize)
111 sdram_start(0); 111 sdram_start(0);
112 test2 = test1 = get_ram_size((long *) (CONFIG_SYS_SDRAM_BASE + dramsize), 0x80000000); 112 test2 = test1 = get_ram_size((long *) (CONFIG_SYS_SDRAM_BASE + dramsize), 0x80000000);
113 if (!dramsize) { 113 if (!dramsize) {
114 sdram_start(1); 114 sdram_start(1);
115 test2 = get_ram_size((long *) (CONFIG_SYS_SDRAM_BASE + dramsize), 0x80000000); 115 test2 = get_ram_size((long *) (CONFIG_SYS_SDRAM_BASE + dramsize), 0x80000000);
116 } 116 }
117 if (test1 > test2) { 117 if (test1 > test2) {
118 sdram_start(0); 118 sdram_start(0);
119 dramsize2 = test1; 119 dramsize2 = test1;
120 } else 120 } else
121 dramsize2 = test2; 121 dramsize2 = test2;
122 122
123 /* memory smaller than 1MB is impossible */ 123 /* memory smaller than 1MB is impossible */
124 if (dramsize2 < (1 << 20)) 124 if (dramsize2 < (1 << 20))
125 dramsize2 = 0; 125 dramsize2 = 0;
126 126
127 /* set SDRAM CS1 size according to the amount of RAM found */ 127 /* set SDRAM CS1 size according to the amount of RAM found */
128 if (dramsize2 > 0) 128 if (dramsize2 > 0)
129 *(vu_long *) MPC5XXX_SDRAM_CS1CFG = dramsize 129 *(vu_long *) MPC5XXX_SDRAM_CS1CFG = dramsize
130 | (0x13 + __builtin_ffs(dramsize2 >> 20) - 1); 130 | (0x13 + __builtin_ffs(dramsize2 >> 20) - 1);
131 else 131 else
132 *(vu_long *) MPC5XXX_SDRAM_CS1CFG = dramsize; /* disabled */ 132 *(vu_long *) MPC5XXX_SDRAM_CS1CFG = dramsize; /* disabled */
133 133
134 #else /* CONFIG_SYS_RAMBOOT */ 134 #else /* CONFIG_SYS_RAMBOOT */
135 135
136 /* retrieve size of memory connected to SDRAM CS0 */ 136 /* retrieve size of memory connected to SDRAM CS0 */
137 dramsize = *(vu_long *) MPC5XXX_SDRAM_CS0CFG & 0xFF; 137 dramsize = *(vu_long *) MPC5XXX_SDRAM_CS0CFG & 0xFF;
138 if (dramsize >= 0x13) 138 if (dramsize >= 0x13)
139 dramsize = (1 << (dramsize - 0x13)) << 20; 139 dramsize = (1 << (dramsize - 0x13)) << 20;
140 else 140 else
141 dramsize = 0; 141 dramsize = 0;
142 142
143 /* retrieve size of memory connected to SDRAM CS1 */ 143 /* retrieve size of memory connected to SDRAM CS1 */
144 dramsize2 = *(vu_long *) MPC5XXX_SDRAM_CS1CFG & 0xFF; 144 dramsize2 = *(vu_long *) MPC5XXX_SDRAM_CS1CFG & 0xFF;
145 if (dramsize2 >= 0x13) 145 if (dramsize2 >= 0x13)
146 dramsize2 = (1 << (dramsize2 - 0x13)) << 20; 146 dramsize2 = (1 << (dramsize2 - 0x13)) << 20;
147 else 147 else
148 dramsize2 = 0; 148 dramsize2 = 0;
149 149
150 #endif /* CONFIG_SYS_RAMBOOT */ 150 #endif /* CONFIG_SYS_RAMBOOT */
151 151
152 /* 152 /*
153 * On MPC5200B we need to set the special configuration delay in the 153 * On MPC5200B we need to set the special configuration delay in the
154 * DDR controller. Please refer to Freescale's AN3221 "MPC5200B SDRAM 154 * DDR controller. Please refer to Freescale's AN3221 "MPC5200B SDRAM
155 * Initialization and Configuration", 3.3.1 SDelay--MBAR + 0x0190: 155 * Initialization and Configuration", 3.3.1 SDelay--MBAR + 0x0190:
156 * 156 *
157 * "The SDelay should be written to a value of 0x00000004. It is 157 * "The SDelay should be written to a value of 0x00000004. It is
158 * required to account for changes caused by normal wafer processing 158 * required to account for changes caused by normal wafer processing
159 * parameters." 159 * parameters."
160 */ 160 */
161 svr = get_svr(); 161 svr = get_svr();
162 pvr = get_pvr(); 162 pvr = get_pvr();
163 if ((SVR_MJREV(svr) >= 2) && 163 if ((SVR_MJREV(svr) >= 2) &&
164 (PVR_MAJ(pvr) == 1) && (PVR_MIN(pvr) == 4)) { 164 (PVR_MAJ(pvr) == 1) && (PVR_MIN(pvr) == 4)) {
165 165
166 *(vu_long *) MPC5XXX_SDRAM_SDELAY = 0x04; 166 *(vu_long *) MPC5XXX_SDRAM_SDELAY = 0x04;
167 __asm__ volatile ("sync"); 167 __asm__ volatile ("sync");
168 } 168 }
169 169
170 gd->ram_size = dramsize + dramsize2; 170 gd->ram_size = dramsize + dramsize2;
171 171
172 return 0; 172 return 0;
173 } 173 }
174 174
175 175
176 int checkboard (void) 176 int checkboard (void)
177 { 177 {
178 puts("Board: MarelV38B\n"); 178 puts("Board: MarelV38B\n");
179 return 0; 179 return 0;
180 } 180 }
181 181
182 int board_early_init_f(void) 182 int board_early_init_f(void)
183 { 183 {
184 #ifdef CONFIG_HW_WATCHDOG 184 #ifdef CONFIG_HW_WATCHDOG
185 /* 185 /*
186 * Enable and configure the direction (output) of PSC3_9 - watchdog 186 * Enable and configure the direction (output) of PSC3_9 - watchdog
187 * reset input. Refer to 7.3.2.2.[1,3,4] of the MPC5200B User's 187 * reset input. Refer to 7.3.2.2.[1,3,4] of the MPC5200B User's
188 * Manual. 188 * Manual.
189 */ 189 */
190 *(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC3_9; 190 *(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC3_9;
191 *(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC3_9; 191 *(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC3_9;
192 #endif /* CONFIG_HW_WATCHDOG */ 192 #endif /* CONFIG_HW_WATCHDOG */
193 return 0; 193 return 0;
194 } 194 }
195 195
196 int board_early_init_r(void) 196 int board_early_init_r(void)
197 { 197 {
198 /* 198 /*
199 * Now, when we are in RAM, enable flash write access for the 199 * Now, when we are in RAM, enable flash write access for the
200 * detection process. Note that CS_BOOT cannot be cleared when 200 * detection process. Note that CS_BOOT cannot be cleared when
201 * executing in flash. 201 * executing in flash.
202 */ 202 */
203 *(vu_long *) MPC5XXX_BOOTCS_CFG &= ~0x1; /* clear RO */ 203 *(vu_long *) MPC5XXX_BOOTCS_CFG &= ~0x1; /* clear RO */
204 204
205 /* 205 /*
206 * Enable GPIO_WKUP_7 to "read the status of the actual power 206 * Enable GPIO_WKUP_7 to "read the status of the actual power
207 * situation". Default direction is input, so no need to set it 207 * situation". Default direction is input, so no need to set it
208 * explicitly. 208 * explicitly.
209 */ 209 */
210 *(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_WKUP_7; 210 *(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_WKUP_7;
211 return 0; 211 return 0;
212 } 212 }
213 213
214 extern void board_get_enetaddr(uchar *enetaddr); 214 extern void board_get_enetaddr(uchar *enetaddr);
215 int misc_init_r(void) 215 int misc_init_r(void)
216 { 216 {
217 uchar enetaddr[6]; 217 uchar enetaddr[6];
218 218
219 if (!eth_getenv_enetaddr("ethaddr", enetaddr)) { 219 if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
220 board_get_enetaddr(enetaddr); 220 board_get_enetaddr(enetaddr);
221 eth_setenv_enetaddr("ethaddr", enetaddr); 221 eth_setenv_enetaddr("ethaddr", enetaddr);
222 } 222 }
223 223
224 return 0; 224 return 0;
225 } 225 }
226 226
227 #if defined(CONFIG_CMD_IDE) && defined(CONFIG_IDE_RESET) 227 #if defined(CONFIG_IDE) && defined(CONFIG_IDE_RESET)
228 void init_ide_reset(void) 228 void init_ide_reset(void)
229 { 229 {
230 debug("init_ide_reset\n"); 230 debug("init_ide_reset\n");
231 231
232 /* Configure PSC1_4 as GPIO output for ATA reset */ 232 /* Configure PSC1_4 as GPIO output for ATA reset */
233 *(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC1_4; 233 *(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC1_4;
234 *(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC1_4; 234 *(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC1_4;
235 /* Deassert reset */ 235 /* Deassert reset */
236 *(vu_long *) MPC5XXX_WU_GPIO_DATA_O |= GPIO_PSC1_4; 236 *(vu_long *) MPC5XXX_WU_GPIO_DATA_O |= GPIO_PSC1_4;
237 } 237 }
238 238
239 239
240 void ide_set_reset(int idereset) 240 void ide_set_reset(int idereset)
241 { 241 {
242 debug("ide_reset(%d)\n", idereset); 242 debug("ide_reset(%d)\n", idereset);
243 243
244 if (idereset) { 244 if (idereset) {
245 *(vu_long *) MPC5XXX_WU_GPIO_DATA_O &= ~GPIO_PSC1_4; 245 *(vu_long *) MPC5XXX_WU_GPIO_DATA_O &= ~GPIO_PSC1_4;
246 /* Make a delay. MPC5200 spec says 25 usec min */ 246 /* Make a delay. MPC5200 spec says 25 usec min */
247 udelay(500000); 247 udelay(500000);
248 } else 248 } else
249 *(vu_long *) MPC5XXX_WU_GPIO_DATA_O |= GPIO_PSC1_4; 249 *(vu_long *) MPC5XXX_WU_GPIO_DATA_O |= GPIO_PSC1_4;
250 } 250 }
251 #endif 251 #endif
252 252
253 253
254 #ifdef CONFIG_HW_WATCHDOG 254 #ifdef CONFIG_HW_WATCHDOG
255 void hw_watchdog_reset(void) 255 void hw_watchdog_reset(void)
256 { 256 {
257 /* 257 /*
258 * MarelV38B has a TPS3705 watchdog. Spec says that to kick the dog 258 * MarelV38B has a TPS3705 watchdog. Spec says that to kick the dog
259 * we need a positive or negative transition on WDI i.e., our PSC3_9. 259 * we need a positive or negative transition on WDI i.e., our PSC3_9.
260 */ 260 */
261 *(vu_long *) MPC5XXX_WU_GPIO_DATA_O ^= GPIO_PSC3_9; 261 *(vu_long *) MPC5XXX_WU_GPIO_DATA_O ^= GPIO_PSC3_9;
262 } 262 }
263 #endif /* CONFIG_HW_WATCHDOG */ 263 #endif /* CONFIG_HW_WATCHDOG */
264 264
1 menu "Command line interface" 1 menu "Command line interface"
2 2
3 config CMDLINE 3 config CMDLINE
4 bool "Support U-Boot commands" 4 bool "Support U-Boot commands"
5 default y 5 default y
6 help 6 help
7 Enable U-Boot's command-line functions. This provides a means 7 Enable U-Boot's command-line functions. This provides a means
8 to enter commands into U-Boot for a wide variety of purposes. It 8 to enter commands into U-Boot for a wide variety of purposes. It
9 also allows scripts (containing commands) to be executed. 9 also allows scripts (containing commands) to be executed.
10 Various commands and command categorys can be indivdually enabled. 10 Various commands and command categorys can be indivdually enabled.
11 Depending on the number of commands enabled, this can add 11 Depending on the number of commands enabled, this can add
12 substantially to the size of U-Boot. 12 substantially to the size of U-Boot.
13 13
14 config HUSH_PARSER 14 config HUSH_PARSER
15 bool "Use hush shell" 15 bool "Use hush shell"
16 depends on CMDLINE 16 depends on CMDLINE
17 help 17 help
18 This option enables the "hush" shell (from Busybox) as command line 18 This option enables the "hush" shell (from Busybox) as command line
19 interpreter, thus enabling powerful command line syntax like 19 interpreter, thus enabling powerful command line syntax like
20 if...then...else...fi conditionals or `&&' and '||' 20 if...then...else...fi conditionals or `&&' and '||'
21 constructs ("shell scripts"). 21 constructs ("shell scripts").
22 22
23 If disabled, you get the old, much simpler behaviour with a somewhat 23 If disabled, you get the old, much simpler behaviour with a somewhat
24 smaller memory footprint. 24 smaller memory footprint.
25 25
26 config SYS_PROMPT 26 config SYS_PROMPT
27 string "Shell prompt" 27 string "Shell prompt"
28 default "=> " 28 default "=> "
29 help 29 help
30 This string is displayed in the command line to the left of the 30 This string is displayed in the command line to the left of the
31 cursor. 31 cursor.
32 32
33 menu "Autoboot options" 33 menu "Autoboot options"
34 34
35 config AUTOBOOT 35 config AUTOBOOT
36 bool "Autoboot" 36 bool "Autoboot"
37 default y 37 default y
38 help 38 help
39 This enables the autoboot. See doc/README.autoboot for detail. 39 This enables the autoboot. See doc/README.autoboot for detail.
40 40
41 config AUTOBOOT_KEYED 41 config AUTOBOOT_KEYED
42 bool "Stop autobooting via specific input key / string" 42 bool "Stop autobooting via specific input key / string"
43 default n 43 default n
44 help 44 help
45 This option enables stopping (aborting) of the automatic 45 This option enables stopping (aborting) of the automatic
46 boot feature only by issuing a specific input key or 46 boot feature only by issuing a specific input key or
47 string. If not enabled, any input key will abort the 47 string. If not enabled, any input key will abort the
48 U-Boot automatic booting process and bring the device 48 U-Boot automatic booting process and bring the device
49 to the U-Boot prompt for user input. 49 to the U-Boot prompt for user input.
50 50
51 config AUTOBOOT_PROMPT 51 config AUTOBOOT_PROMPT
52 string "Autoboot stop prompt" 52 string "Autoboot stop prompt"
53 depends on AUTOBOOT_KEYED 53 depends on AUTOBOOT_KEYED
54 default "Autoboot in %d seconds\\n" 54 default "Autoboot in %d seconds\\n"
55 help 55 help
56 This string is displayed before the boot delay selected by 56 This string is displayed before the boot delay selected by
57 CONFIG_BOOTDELAY starts. If it is not defined there is no 57 CONFIG_BOOTDELAY starts. If it is not defined there is no
58 output indicating that autoboot is in progress. 58 output indicating that autoboot is in progress.
59 59
60 Note that this define is used as the (only) argument to a 60 Note that this define is used as the (only) argument to a
61 printf() call, so it may contain '%' format specifications, 61 printf() call, so it may contain '%' format specifications,
62 provided that it also includes, sepearated by commas exactly 62 provided that it also includes, sepearated by commas exactly
63 like in a printf statement, the required arguments. It is 63 like in a printf statement, the required arguments. It is
64 the responsibility of the user to select only such arguments 64 the responsibility of the user to select only such arguments
65 that are valid in the given context. 65 that are valid in the given context.
66 66
67 config AUTOBOOT_ENCRYPTION 67 config AUTOBOOT_ENCRYPTION
68 bool "Enable encryption in autoboot stopping" 68 bool "Enable encryption in autoboot stopping"
69 depends on AUTOBOOT_KEYED 69 depends on AUTOBOOT_KEYED
70 default n 70 default n
71 71
72 config AUTOBOOT_DELAY_STR 72 config AUTOBOOT_DELAY_STR
73 string "Delay autobooting via specific input key / string" 73 string "Delay autobooting via specific input key / string"
74 depends on AUTOBOOT_KEYED && !AUTOBOOT_ENCRYPTION 74 depends on AUTOBOOT_KEYED && !AUTOBOOT_ENCRYPTION
75 help 75 help
76 This option delays the automatic boot feature by issuing 76 This option delays the automatic boot feature by issuing
77 a specific input key or string. If CONFIG_AUTOBOOT_DELAY_STR 77 a specific input key or string. If CONFIG_AUTOBOOT_DELAY_STR
78 or the environment variable "bootdelaykey" is specified 78 or the environment variable "bootdelaykey" is specified
79 and this string is received from console input before 79 and this string is received from console input before
80 autoboot starts booting, U-Boot gives a command prompt. The 80 autoboot starts booting, U-Boot gives a command prompt. The
81 U-Boot prompt will time out if CONFIG_BOOT_RETRY_TIME is 81 U-Boot prompt will time out if CONFIG_BOOT_RETRY_TIME is
82 used, otherwise it never times out. 82 used, otherwise it never times out.
83 83
84 config AUTOBOOT_STOP_STR 84 config AUTOBOOT_STOP_STR
85 string "Stop autobooting via specific input key / string" 85 string "Stop autobooting via specific input key / string"
86 depends on AUTOBOOT_KEYED && !AUTOBOOT_ENCRYPTION 86 depends on AUTOBOOT_KEYED && !AUTOBOOT_ENCRYPTION
87 help 87 help
88 This option enables stopping (aborting) of the automatic 88 This option enables stopping (aborting) of the automatic
89 boot feature only by issuing a specific input key or 89 boot feature only by issuing a specific input key or
90 string. If CONFIG_AUTOBOOT_STOP_STR or the environment 90 string. If CONFIG_AUTOBOOT_STOP_STR or the environment
91 variable "bootstopkey" is specified and this string is 91 variable "bootstopkey" is specified and this string is
92 received from console input before autoboot starts booting, 92 received from console input before autoboot starts booting,
93 U-Boot gives a command prompt. The U-Boot prompt never 93 U-Boot gives a command prompt. The U-Boot prompt never
94 times out, even if CONFIG_BOOT_RETRY_TIME is used. 94 times out, even if CONFIG_BOOT_RETRY_TIME is used.
95 95
96 config AUTOBOOT_KEYED_CTRLC 96 config AUTOBOOT_KEYED_CTRLC
97 bool "Enable Ctrl-C autoboot interruption" 97 bool "Enable Ctrl-C autoboot interruption"
98 depends on AUTOBOOT_KEYED && !AUTOBOOT_ENCRYPTION 98 depends on AUTOBOOT_KEYED && !AUTOBOOT_ENCRYPTION
99 default n 99 default n
100 help 100 help
101 This option allows for the boot sequence to be interrupted 101 This option allows for the boot sequence to be interrupted
102 by ctrl-c, in addition to the "bootdelaykey" and "bootstopkey". 102 by ctrl-c, in addition to the "bootdelaykey" and "bootstopkey".
103 Setting this variable provides an escape sequence from the 103 Setting this variable provides an escape sequence from the
104 limited "password" strings. 104 limited "password" strings.
105 105
106 config AUTOBOOT_STOP_STR_SHA256 106 config AUTOBOOT_STOP_STR_SHA256
107 string "Stop autobooting via SHA256 encrypted password" 107 string "Stop autobooting via SHA256 encrypted password"
108 depends on AUTOBOOT_KEYED && AUTOBOOT_ENCRYPTION 108 depends on AUTOBOOT_KEYED && AUTOBOOT_ENCRYPTION
109 help 109 help
110 This option adds the feature to only stop the autobooting, 110 This option adds the feature to only stop the autobooting,
111 and therefore boot into the U-Boot prompt, when the input 111 and therefore boot into the U-Boot prompt, when the input
112 string / password matches a values that is encypted via 112 string / password matches a values that is encypted via
113 a SHA256 hash and saved in the environment. 113 a SHA256 hash and saved in the environment.
114 114
115 endmenu 115 endmenu
116 116
117 source "cmd/fastboot/Kconfig" 117 source "cmd/fastboot/Kconfig"
118 118
119 comment "Commands" 119 comment "Commands"
120 120
121 menu "Info commands" 121 menu "Info commands"
122 122
123 config CMD_BDI 123 config CMD_BDI
124 bool "bdinfo" 124 bool "bdinfo"
125 default y 125 default y
126 help 126 help
127 Print board info 127 Print board info
128 128
129 config CMD_CONFIG 129 config CMD_CONFIG
130 bool "config" 130 bool "config"
131 select BUILD_BIN2C 131 select BUILD_BIN2C
132 default SANDBOX 132 default SANDBOX
133 help 133 help
134 Print ".config" contents. 134 Print ".config" contents.
135 135
136 If this option is enabled, the ".config" file contents are embedded 136 If this option is enabled, the ".config" file contents are embedded
137 in the U-Boot image and can be printed on the console by the "config" 137 in the U-Boot image and can be printed on the console by the "config"
138 command. This provides information of which options are enabled on 138 command. This provides information of which options are enabled on
139 the running U-Boot. 139 the running U-Boot.
140 140
141 config CMD_CONSOLE 141 config CMD_CONSOLE
142 bool "coninfo" 142 bool "coninfo"
143 default y 143 default y
144 help 144 help
145 Print console devices and information. 145 Print console devices and information.
146 146
147 config CMD_CPU 147 config CMD_CPU
148 bool "cpu" 148 bool "cpu"
149 help 149 help
150 Print information about available CPUs. This normally shows the 150 Print information about available CPUs. This normally shows the
151 number of CPUs, type (e.g. manufacturer, architecture, product or 151 number of CPUs, type (e.g. manufacturer, architecture, product or
152 internal name) and clock frequency. Other information may be 152 internal name) and clock frequency. Other information may be
153 available depending on the CPU driver. 153 available depending on the CPU driver.
154 154
155 config CMD_LICENSE 155 config CMD_LICENSE
156 bool "license" 156 bool "license"
157 select BUILD_BIN2C 157 select BUILD_BIN2C
158 help 158 help
159 Print GPL license text 159 Print GPL license text
160 160
161 endmenu 161 endmenu
162 162
163 menu "Boot commands" 163 menu "Boot commands"
164 164
165 config CMD_BOOTD 165 config CMD_BOOTD
166 bool "bootd" 166 bool "bootd"
167 default y 167 default y
168 help 168 help
169 Run the command stored in the environment "bootcmd", i.e. 169 Run the command stored in the environment "bootcmd", i.e.
170 "bootd" does the same thing as "run bootcmd". 170 "bootd" does the same thing as "run bootcmd".
171 171
172 config CMD_BOOTM 172 config CMD_BOOTM
173 bool "bootm" 173 bool "bootm"
174 default y 174 default y
175 help 175 help
176 Boot an application image from the memory. 176 Boot an application image from the memory.
177 177
178 config CMD_BOOTZ 178 config CMD_BOOTZ
179 bool "bootz" 179 bool "bootz"
180 help 180 help
181 Boot the Linux zImage 181 Boot the Linux zImage
182 182
183 config CMD_BOOTI 183 config CMD_BOOTI
184 bool "booti" 184 bool "booti"
185 depends on ARM64 185 depends on ARM64
186 default y 186 default y
187 help 187 help
188 Boot an AArch64 Linux Kernel image from memory. 188 Boot an AArch64 Linux Kernel image from memory.
189 189
190 config CMD_BOOTEFI 190 config CMD_BOOTEFI
191 bool "bootefi" 191 bool "bootefi"
192 depends on EFI_LOADER 192 depends on EFI_LOADER
193 default y 193 default y
194 help 194 help
195 Boot an EFI image from memory. 195 Boot an EFI image from memory.
196 196
197 config CMD_BOOTEFI_HELLO_COMPILE 197 config CMD_BOOTEFI_HELLO_COMPILE
198 bool "Compile a standard EFI hello world binary for testing" 198 bool "Compile a standard EFI hello world binary for testing"
199 depends on CMD_BOOTEFI && (ARM || X86) 199 depends on CMD_BOOTEFI && (ARM || X86)
200 default y 200 default y
201 help 201 help
202 This compiles a standard EFI hello world application with U-Boot so 202 This compiles a standard EFI hello world application with U-Boot so
203 that it can be used with the test/py testing framework. This is useful 203 that it can be used with the test/py testing framework. This is useful
204 for testing that EFI is working at a basic level, and for bringing 204 for testing that EFI is working at a basic level, and for bringing
205 up EFI support on a new architecture. 205 up EFI support on a new architecture.
206 206
207 No additional space will be required in the resulting U-Boot binary 207 No additional space will be required in the resulting U-Boot binary
208 when this option is enabled. 208 when this option is enabled.
209 209
210 config CMD_BOOTEFI_HELLO 210 config CMD_BOOTEFI_HELLO
211 bool "Allow booting a standard EFI hello world for testing" 211 bool "Allow booting a standard EFI hello world for testing"
212 depends on CMD_BOOTEFI_HELLO_COMPILE 212 depends on CMD_BOOTEFI_HELLO_COMPILE
213 help 213 help
214 This adds a standard EFI hello world application to U-Boot so that 214 This adds a standard EFI hello world application to U-Boot so that
215 it can be used with the 'bootefi hello' command. This is useful 215 it can be used with the 'bootefi hello' command. This is useful
216 for testing that EFI is working at a basic level, and for bringing 216 for testing that EFI is working at a basic level, and for bringing
217 up EFI support on a new architecture. 217 up EFI support on a new architecture.
218 218
219 config CMD_BOOTMENU 219 config CMD_BOOTMENU
220 bool "bootmenu" 220 bool "bootmenu"
221 select MENU 221 select MENU
222 help 222 help
223 Add an ANSI terminal boot menu command. 223 Add an ANSI terminal boot menu command.
224 224
225 config CMD_ELF 225 config CMD_ELF
226 bool "bootelf, bootvx" 226 bool "bootelf, bootvx"
227 default y 227 default y
228 help 228 help
229 Boot an ELF/vxWorks image from the memory. 229 Boot an ELF/vxWorks image from the memory.
230 230
231 config CMD_FDT 231 config CMD_FDT
232 bool "Flattened Device Tree utility commands" 232 bool "Flattened Device Tree utility commands"
233 default y 233 default y
234 depends on OF_LIBFDT 234 depends on OF_LIBFDT
235 help 235 help
236 Do FDT related setup before booting into the Operating System. 236 Do FDT related setup before booting into the Operating System.
237 237
238 config CMD_GO 238 config CMD_GO
239 bool "go" 239 bool "go"
240 default y 240 default y
241 help 241 help
242 Start an application at a given address. 242 Start an application at a given address.
243 243
244 config CMD_RUN 244 config CMD_RUN
245 bool "run" 245 bool "run"
246 default y 246 default y
247 help 247 help
248 Run the command in the given environment variable. 248 Run the command in the given environment variable.
249 249
250 config CMD_IMI 250 config CMD_IMI
251 bool "iminfo" 251 bool "iminfo"
252 default y 252 default y
253 help 253 help
254 Print header information for application image. 254 Print header information for application image.
255 255
256 config CMD_IMLS 256 config CMD_IMLS
257 bool "imls" 257 bool "imls"
258 default y 258 default y
259 help 259 help
260 List all images found in flash 260 List all images found in flash
261 261
262 config CMD_XIMG 262 config CMD_XIMG
263 bool "imxtract" 263 bool "imxtract"
264 default y 264 default y
265 help 265 help
266 Extract a part of a multi-image. 266 Extract a part of a multi-image.
267 267
268 config CMD_POWEROFF 268 config CMD_POWEROFF
269 bool 269 bool
270 270
271 endmenu 271 endmenu
272 272
273 menu "Environment commands" 273 menu "Environment commands"
274 274
275 config CMD_ASKENV 275 config CMD_ASKENV
276 bool "ask for env variable" 276 bool "ask for env variable"
277 help 277 help
278 Ask for environment variable 278 Ask for environment variable
279 279
280 config CMD_EXPORTENV 280 config CMD_EXPORTENV
281 bool "env export" 281 bool "env export"
282 default y 282 default y
283 help 283 help
284 Export environments. 284 Export environments.
285 285
286 config CMD_IMPORTENV 286 config CMD_IMPORTENV
287 bool "env import" 287 bool "env import"
288 default y 288 default y
289 help 289 help
290 Import environments. 290 Import environments.
291 291
292 config CMD_EDITENV 292 config CMD_EDITENV
293 bool "editenv" 293 bool "editenv"
294 default y 294 default y
295 help 295 help
296 Edit environment variable. 296 Edit environment variable.
297 297
298 config CMD_GREPENV 298 config CMD_GREPENV
299 bool "search env" 299 bool "search env"
300 help 300 help
301 Allow for searching environment variables 301 Allow for searching environment variables
302 302
303 config CMD_SAVEENV 303 config CMD_SAVEENV
304 bool "saveenv" 304 bool "saveenv"
305 default y 305 default y
306 help 306 help
307 Save all environment variables into the compiled-in persistent 307 Save all environment variables into the compiled-in persistent
308 storage. 308 storage.
309 309
310 config CMD_ENV_EXISTS 310 config CMD_ENV_EXISTS
311 bool "env exists" 311 bool "env exists"
312 default y 312 default y
313 help 313 help
314 Check if a variable is defined in the environment for use in 314 Check if a variable is defined in the environment for use in
315 shell scripting. 315 shell scripting.
316 316
317 config CMD_ENV_CALLBACK 317 config CMD_ENV_CALLBACK
318 bool "env callbacks - print callbacks and their associated variables" 318 bool "env callbacks - print callbacks and their associated variables"
319 help 319 help
320 Some environment variable have callbacks defined by 320 Some environment variable have callbacks defined by
321 U_BOOT_ENV_CALLBACK. These are called when the variable changes. 321 U_BOOT_ENV_CALLBACK. These are called when the variable changes.
322 For example changing "baudrate" adjust the serial baud rate. This 322 For example changing "baudrate" adjust the serial baud rate. This
323 command lists the currently defined callbacks. 323 command lists the currently defined callbacks.
324 324
325 config CMD_ENV_FLAGS 325 config CMD_ENV_FLAGS
326 bool "env flags -print variables that have non-default flags" 326 bool "env flags -print variables that have non-default flags"
327 help 327 help
328 Some environment variables have special flags that control their 328 Some environment variables have special flags that control their
329 behaviour. For example, serial# can only be written once and cannot 329 behaviour. For example, serial# can only be written once and cannot
330 be deleted. This command shows the variables that have special 330 be deleted. This command shows the variables that have special
331 flags. 331 flags.
332 332
333 endmenu 333 endmenu
334 334
335 menu "Memory commands" 335 menu "Memory commands"
336 336
337 config CMD_MEMORY 337 config CMD_MEMORY
338 bool "md, mm, nm, mw, cp, cmp, base, loop" 338 bool "md, mm, nm, mw, cp, cmp, base, loop"
339 default y 339 default y
340 help 340 help
341 Memory commands. 341 Memory commands.
342 md - memory display 342 md - memory display
343 mm - memory modify (auto-incrementing address) 343 mm - memory modify (auto-incrementing address)
344 nm - memory modify (constant address) 344 nm - memory modify (constant address)
345 mw - memory write (fill) 345 mw - memory write (fill)
346 cp - memory copy 346 cp - memory copy
347 cmp - memory compare 347 cmp - memory compare
348 base - print or set address offset 348 base - print or set address offset
349 loop - initialize loop on address range 349 loop - initialize loop on address range
350 350
351 config CMD_CRC32 351 config CMD_CRC32
352 bool "crc32" 352 bool "crc32"
353 select HASH 353 select HASH
354 default y 354 default y
355 help 355 help
356 Compute CRC32. 356 Compute CRC32.
357 357
358 config CMD_EEPROM 358 config CMD_EEPROM
359 bool "eeprom - EEPROM subsystem" 359 bool "eeprom - EEPROM subsystem"
360 help 360 help
361 (deprecated, needs conversion to driver model) 361 (deprecated, needs conversion to driver model)
362 Provides commands to read and write EEPROM (Electrically Erasable 362 Provides commands to read and write EEPROM (Electrically Erasable
363 Programmable Read Only Memory) chips that are connected over an 363 Programmable Read Only Memory) chips that are connected over an
364 I2C bus. 364 I2C bus.
365 365
366 config CMD_EEPROM_LAYOUT 366 config CMD_EEPROM_LAYOUT
367 bool "Enable layout-aware eeprom commands" 367 bool "Enable layout-aware eeprom commands"
368 depends on CMD_EEPROM 368 depends on CMD_EEPROM
369 help 369 help
370 (deprecated, needs conversion to driver model) 370 (deprecated, needs conversion to driver model)
371 When enabled, additional eeprom sub-commands become available. 371 When enabled, additional eeprom sub-commands become available.
372 372
373 eeprom print - prints the contents of the eeprom in a human-readable 373 eeprom print - prints the contents of the eeprom in a human-readable
374 way (eeprom layout fields, and data formatted to be fit for human 374 way (eeprom layout fields, and data formatted to be fit for human
375 consumption). 375 consumption).
376 376
377 eeprom update - allows user to update eeprom fields by specifying 377 eeprom update - allows user to update eeprom fields by specifying
378 the field name, and providing the new data in a human readable format 378 the field name, and providing the new data in a human readable format
379 (same format as displayed by the eeprom print command). 379 (same format as displayed by the eeprom print command).
380 380
381 Both commands can either auto detect the layout, or be told which 381 Both commands can either auto detect the layout, or be told which
382 layout to use. 382 layout to use.
383 383
384 Feature API: 384 Feature API:
385 __weak int parse_layout_version(char *str) 385 __weak int parse_layout_version(char *str)
386 - override to provide your own layout name parsing 386 - override to provide your own layout name parsing
387 __weak void __eeprom_layout_assign(struct eeprom_layout *layout, 387 __weak void __eeprom_layout_assign(struct eeprom_layout *layout,
388 int layout_version); 388 int layout_version);
389 - override to setup the layout metadata based on the version 389 - override to setup the layout metadata based on the version
390 __weak int eeprom_layout_detect(unsigned char *data) 390 __weak int eeprom_layout_detect(unsigned char *data)
391 - override to provide your own algorithm for detecting layout 391 - override to provide your own algorithm for detecting layout
392 version 392 version
393 eeprom_field.c 393 eeprom_field.c
394 - contains various printing and updating functions for common 394 - contains various printing and updating functions for common
395 types of eeprom fields. Can be used for defining 395 types of eeprom fields. Can be used for defining
396 custom layouts. 396 custom layouts.
397 397
398 config EEPROM_LAYOUT_HELP_STRING 398 config EEPROM_LAYOUT_HELP_STRING
399 string "Tells user what layout names are supported" 399 string "Tells user what layout names are supported"
400 depends on CMD_EEPROM_LAYOUT 400 depends on CMD_EEPROM_LAYOUT
401 default "<not defined>" 401 default "<not defined>"
402 help 402 help
403 Help printed with the LAYOUT VERSIONS part of the 'eeprom' 403 Help printed with the LAYOUT VERSIONS part of the 'eeprom'
404 command's help. 404 command's help.
405 405
406 config CMD_MD5SUM 406 config CMD_MD5SUM
407 bool "md5sum" 407 bool "md5sum"
408 default n 408 default n
409 select MD5 409 select MD5
410 help 410 help
411 Compute MD5 checksum. 411 Compute MD5 checksum.
412 412
413 config MD5SUM_VERFIY 413 config MD5SUM_VERFIY
414 bool "md5sum -v" 414 bool "md5sum -v"
415 default n 415 default n
416 depends on CMD_MD5SUM 416 depends on CMD_MD5SUM
417 help 417 help
418 Add -v option to verify data against an MD5 checksum. 418 Add -v option to verify data against an MD5 checksum.
419 419
420 config LOOPW 420 config LOOPW
421 bool "loopw" 421 bool "loopw"
422 help 422 help
423 Infinite write loop on address range 423 Infinite write loop on address range
424 424
425 config CMD_MEMTEST 425 config CMD_MEMTEST
426 bool "memtest" 426 bool "memtest"
427 help 427 help
428 Simple RAM read/write test. 428 Simple RAM read/write test.
429 429
430 config CMD_MX_CYCLIC 430 config CMD_MX_CYCLIC
431 bool "mdc, mwc" 431 bool "mdc, mwc"
432 help 432 help
433 mdc - memory display cyclic 433 mdc - memory display cyclic
434 mwc - memory write cyclic 434 mwc - memory write cyclic
435 435
436 config CMD_MEMINFO 436 config CMD_MEMINFO
437 bool "meminfo" 437 bool "meminfo"
438 help 438 help
439 Display memory information. 439 Display memory information.
440 440
441 config CMD_UNZIP 441 config CMD_UNZIP
442 bool "unzip" 442 bool "unzip"
443 help 443 help
444 Uncompress a zip-compressed memory region. 444 Uncompress a zip-compressed memory region.
445 445
446 config CMD_ZIP 446 config CMD_ZIP
447 bool "zip" 447 bool "zip"
448 help 448 help
449 Compress a memory region with zlib deflate method. 449 Compress a memory region with zlib deflate method.
450 450
451 endmenu 451 endmenu
452 452
453 menu "Device access commands" 453 menu "Device access commands"
454 454
455 config CMD_CLK 455 config CMD_CLK
456 bool "clk - Show clock frequencies" 456 bool "clk - Show clock frequencies"
457 help 457 help
458 (deprecated) 458 (deprecated)
459 Shows clock frequences by calling a sock_clk_dump() hook function. 459 Shows clock frequences by calling a sock_clk_dump() hook function.
460 This is depreated in favour of using the CLK uclass and accessing 460 This is depreated in favour of using the CLK uclass and accessing
461 clock values from associated drivers. However currently no command 461 clock values from associated drivers. However currently no command
462 exists for this. 462 exists for this.
463 463
464 config CMD_DM 464 config CMD_DM
465 bool "dm - Access to driver model information" 465 bool "dm - Access to driver model information"
466 depends on DM 466 depends on DM
467 default y 467 default y
468 help 468 help
469 Provides access to driver model data structures and information, 469 Provides access to driver model data structures and information,
470 such as a list of devices, list of uclasses and the state of each 470 such as a list of devices, list of uclasses and the state of each
471 device (e.g. activated). This is not required for operation, but 471 device (e.g. activated). This is not required for operation, but
472 can be useful to see the state of driver model for debugging or 472 can be useful to see the state of driver model for debugging or
473 interest. 473 interest.
474 474
475 config CMD_DEMO 475 config CMD_DEMO
476 bool "demo - Demonstration commands for driver model" 476 bool "demo - Demonstration commands for driver model"
477 depends on DM 477 depends on DM
478 help 478 help
479 Provides a 'demo' command which can be used to play around with 479 Provides a 'demo' command which can be used to play around with
480 driver model. To use this properly you will need to enable one or 480 driver model. To use this properly you will need to enable one or
481 both of the demo devices (DM_DEMO_SHAPE and DM_DEMO_SIMPLE). 481 both of the demo devices (DM_DEMO_SHAPE and DM_DEMO_SIMPLE).
482 Otherwise you will always get an empty list of devices. The demo 482 Otherwise you will always get an empty list of devices. The demo
483 devices are defined in the sandbox device tree, so the easiest 483 devices are defined in the sandbox device tree, so the easiest
484 option is to use sandbox and pass the -d point to sandbox's 484 option is to use sandbox and pass the -d point to sandbox's
485 u-boot.dtb file. 485 u-boot.dtb file.
486 486
487 config CMD_IDE 487 config CMD_IDE
488 bool "ide - Support for IDE drivers" 488 bool "ide - Support for IDE drivers"
489 select IDE
489 help 490 help
490 Provides an 'ide' command which allows accessing the IDE drive, 491 Provides an 'ide' command which allows accessing the IDE drive,
491 reseting the IDE interface, printing the partition table and 492 reseting the IDE interface, printing the partition table and
492 geting device info. It also enables the 'diskboot' command which 493 geting device info. It also enables the 'diskboot' command which
493 permits booting from an IDE drive. 494 permits booting from an IDE drive.
494 495
495 config CMD_LOADB 496 config CMD_LOADB
496 bool "loadb" 497 bool "loadb"
497 default y 498 default y
498 help 499 help
499 Load a binary file over serial line. 500 Load a binary file over serial line.
500 501
501 config CMD_LOADS 502 config CMD_LOADS
502 bool "loads" 503 bool "loads"
503 default y 504 default y
504 help 505 help
505 Load an S-Record file over serial line 506 Load an S-Record file over serial line
506 507
507 config CMD_FLASH 508 config CMD_FLASH
508 bool "flinfo, erase, protect" 509 bool "flinfo, erase, protect"
509 default y 510 default y
510 help 511 help
511 NOR flash support. 512 NOR flash support.
512 flinfo - print FLASH memory information 513 flinfo - print FLASH memory information
513 erase - FLASH memory 514 erase - FLASH memory
514 protect - enable or disable FLASH write protection 515 protect - enable or disable FLASH write protection
515 516
516 config CMD_GPT 517 config CMD_GPT
517 bool "GPT (GUID Partition Table) command" 518 bool "GPT (GUID Partition Table) command"
518 select PARTITION_UUIDS 519 select PARTITION_UUIDS
519 select EFI_PARTITION 520 select EFI_PARTITION
520 help 521 help
521 Enable the 'gpt' command to ready and write GPT style partition 522 Enable the 'gpt' command to ready and write GPT style partition
522 tables. 523 tables.
523 524
524 config CMD_ARMFLASH 525 config CMD_ARMFLASH
525 #depends on FLASH_CFI_DRIVER 526 #depends on FLASH_CFI_DRIVER
526 bool "armflash" 527 bool "armflash"
527 help 528 help
528 ARM Ltd reference designs flash partition access 529 ARM Ltd reference designs flash partition access
529 530
530 config CMD_MMC 531 config CMD_MMC
531 bool "mmc" 532 bool "mmc"
532 help 533 help
533 MMC memory mapped support. 534 MMC memory mapped support.
534 535
535 config CMD_NAND 536 config CMD_NAND
536 bool "nand" 537 bool "nand"
537 default y if NAND_SUNXI 538 default y if NAND_SUNXI
538 help 539 help
539 NAND support. 540 NAND support.
540 541
541 if CMD_NAND 542 if CMD_NAND
542 config CMD_NAND_TRIMFFS 543 config CMD_NAND_TRIMFFS
543 bool "nand write.trimffs" 544 bool "nand write.trimffs"
544 default y if ARCH_SUNXI 545 default y if ARCH_SUNXI
545 help 546 help
546 Allows one to skip empty pages when flashing something on a NAND. 547 Allows one to skip empty pages when flashing something on a NAND.
547 548
548 config CMD_NAND_LOCK_UNLOCK 549 config CMD_NAND_LOCK_UNLOCK
549 bool "nand lock/unlock" 550 bool "nand lock/unlock"
550 help 551 help
551 NAND locking support. 552 NAND locking support.
552 553
553 config CMD_NAND_TORTURE 554 config CMD_NAND_TORTURE
554 bool "nand torture" 555 bool "nand torture"
555 help 556 help
556 NAND torture support. 557 NAND torture support.
557 558
558 endif # CMD_NAND 559 endif # CMD_NAND
559 560
560 config CMD_PART 561 config CMD_PART
561 bool "part" 562 bool "part"
562 select PARTITION_UUIDS 563 select PARTITION_UUIDS
563 help 564 help
564 Read and display information about the partition table on 565 Read and display information about the partition table on
565 various media. 566 various media.
566 567
567 config CMD_SF 568 config CMD_SF
568 bool "sf" 569 bool "sf"
569 help 570 help
570 SPI Flash support 571 SPI Flash support
571 572
572 config CMD_SPI 573 config CMD_SPI
573 bool "sspi" 574 bool "sspi"
574 help 575 help
575 SPI utility command. 576 SPI utility command.
576 577
577 config CMD_I2C 578 config CMD_I2C
578 bool "i2c" 579 bool "i2c"
579 help 580 help
580 I2C support. 581 I2C support.
581 582
582 config CMD_USB 583 config CMD_USB
583 bool "usb" 584 bool "usb"
584 help 585 help
585 USB support. 586 USB support.
586 587
587 config CMD_DFU 588 config CMD_DFU
588 bool "dfu" 589 bool "dfu"
589 select USB_FUNCTION_DFU 590 select USB_FUNCTION_DFU
590 help 591 help
591 Enables the command "dfu" which is used to have U-Boot create a DFU 592 Enables the command "dfu" which is used to have U-Boot create a DFU
592 class device via USB. 593 class device via USB.
593 594
594 config CMD_USB_MASS_STORAGE 595 config CMD_USB_MASS_STORAGE
595 bool "UMS usb mass storage" 596 bool "UMS usb mass storage"
596 help 597 help
597 USB mass storage support 598 USB mass storage support
598 599
599 config CMD_FPGA 600 config CMD_FPGA
600 bool "fpga" 601 bool "fpga"
601 default y 602 default y
602 help 603 help
603 FPGA support. 604 FPGA support.
604 605
605 config CMD_FPGA_LOADBP 606 config CMD_FPGA_LOADBP
606 bool "fpga loadbp - load partial bitstream (Xilinx only)" 607 bool "fpga loadbp - load partial bitstream (Xilinx only)"
607 depends on CMD_FPGA 608 depends on CMD_FPGA
608 help 609 help
609 Supports loading an FPGA device from a bitstream buffer containing 610 Supports loading an FPGA device from a bitstream buffer containing
610 a partial bitstream. 611 a partial bitstream.
611 612
612 config CMD_FPGA_LOADFS 613 config CMD_FPGA_LOADFS
613 bool "fpga loadfs - load bitstream from FAT filesystem (Xilinx only)" 614 bool "fpga loadfs - load bitstream from FAT filesystem (Xilinx only)"
614 depends on CMD_FPGA 615 depends on CMD_FPGA
615 help 616 help
616 Supports loading an FPGA device from a FAT filesystem. 617 Supports loading an FPGA device from a FAT filesystem.
617 618
618 config CMD_FPGA_LOADMK 619 config CMD_FPGA_LOADMK
619 bool "fpga loadmk - load bitstream from image" 620 bool "fpga loadmk - load bitstream from image"
620 depends on CMD_FPGA 621 depends on CMD_FPGA
621 help 622 help
622 Supports loading an FPGA device from a image generated by mkimage. 623 Supports loading an FPGA device from a image generated by mkimage.
623 624
624 config CMD_FPGA_LOADP 625 config CMD_FPGA_LOADP
625 bool "fpga loadp - load partial bitstream" 626 bool "fpga loadp - load partial bitstream"
626 depends on CMD_FPGA 627 depends on CMD_FPGA
627 help 628 help
628 Supports loading an FPGA device from a bitstream buffer containing 629 Supports loading an FPGA device from a bitstream buffer containing
629 a partial bitstream. 630 a partial bitstream.
630 631
631 config CMD_FPGAD 632 config CMD_FPGAD
632 bool "fpgad - dump FPGA registers" 633 bool "fpgad - dump FPGA registers"
633 help 634 help
634 (legacy, needs conversion to driver model) 635 (legacy, needs conversion to driver model)
635 Provides a way to dump FPGA registers by calling the board-specific 636 Provides a way to dump FPGA registers by calling the board-specific
636 fpga_get_reg() function. This functions similarly to the 'md' 637 fpga_get_reg() function. This functions similarly to the 'md'
637 command. 638 command.
638 639
639 config CMD_FUSE 640 config CMD_FUSE
640 bool "fuse - support for the fuse subssystem" 641 bool "fuse - support for the fuse subssystem"
641 help 642 help
642 (deprecated - needs conversion to driver model) 643 (deprecated - needs conversion to driver model)
643 This allows reading, sensing, programming or overriding fuses 644 This allows reading, sensing, programming or overriding fuses
644 which control the behaviour of the device. The command uses the 645 which control the behaviour of the device. The command uses the
645 fuse_...() API. 646 fuse_...() API.
646 647
647 config CMD_REMOTEPROC 648 config CMD_REMOTEPROC
648 bool "remoteproc" 649 bool "remoteproc"
649 depends on REMOTEPROC 650 depends on REMOTEPROC
650 help 651 help
651 Support for Remote Processor control 652 Support for Remote Processor control
652 653
653 config CMD_GPIO 654 config CMD_GPIO
654 bool "gpio" 655 bool "gpio"
655 help 656 help
656 GPIO support. 657 GPIO support.
657 658
658 config CMD_FDC 659 config CMD_FDC
659 bool "fdcboot - Boot from floppy device" 660 bool "fdcboot - Boot from floppy device"
660 help 661 help
661 The 'fdtboot' command allows booting an image from a floppy disk. 662 The 'fdtboot' command allows booting an image from a floppy disk.
662 663
663 endmenu 664 endmenu
664 665
665 666
666 menu "Shell scripting commands" 667 menu "Shell scripting commands"
667 668
668 config CMD_ECHO 669 config CMD_ECHO
669 bool "echo" 670 bool "echo"
670 default y 671 default y
671 help 672 help
672 Echo args to console 673 Echo args to console
673 674
674 config CMD_ITEST 675 config CMD_ITEST
675 bool "itest" 676 bool "itest"
676 default y 677 default y
677 help 678 help
678 Return true/false on integer compare. 679 Return true/false on integer compare.
679 680
680 config CMD_SOURCE 681 config CMD_SOURCE
681 bool "source" 682 bool "source"
682 default y 683 default y
683 help 684 help
684 Run script from memory 685 Run script from memory
685 686
686 config CMD_SETEXPR 687 config CMD_SETEXPR
687 bool "setexpr" 688 bool "setexpr"
688 default y 689 default y
689 help 690 help
690 Evaluate boolean and math expressions and store the result in an env 691 Evaluate boolean and math expressions and store the result in an env
691 variable. 692 variable.
692 Also supports loading the value at a memory location into a variable. 693 Also supports loading the value at a memory location into a variable.
693 If CONFIG_REGEX is enabled, setexpr also supports a gsub function. 694 If CONFIG_REGEX is enabled, setexpr also supports a gsub function.
694 695
695 endmenu 696 endmenu
696 697
697 menu "Network commands" 698 menu "Network commands"
698 699
699 config CMD_NET 700 config CMD_NET
700 bool "bootp, tftpboot" 701 bool "bootp, tftpboot"
701 select NET 702 select NET
702 default y 703 default y
703 help 704 help
704 Network commands. 705 Network commands.
705 bootp - boot image via network using BOOTP/TFTP protocol 706 bootp - boot image via network using BOOTP/TFTP protocol
706 tftpboot - boot image via network using TFTP protocol 707 tftpboot - boot image via network using TFTP protocol
707 708
708 config CMD_TFTPPUT 709 config CMD_TFTPPUT
709 bool "tftp put" 710 bool "tftp put"
710 help 711 help
711 TFTP put command, for uploading files to a server 712 TFTP put command, for uploading files to a server
712 713
713 config CMD_TFTPSRV 714 config CMD_TFTPSRV
714 bool "tftpsrv" 715 bool "tftpsrv"
715 help 716 help
716 Act as a TFTP server and boot the first received file 717 Act as a TFTP server and boot the first received file
717 718
718 config CMD_RARP 719 config CMD_RARP
719 bool "rarpboot" 720 bool "rarpboot"
720 help 721 help
721 Boot image via network using RARP/TFTP protocol 722 Boot image via network using RARP/TFTP protocol
722 723
723 config CMD_DHCP 724 config CMD_DHCP
724 bool "dhcp" 725 bool "dhcp"
725 help 726 help
726 Boot image via network using DHCP/TFTP protocol 727 Boot image via network using DHCP/TFTP protocol
727 728
728 config CMD_PXE 729 config CMD_PXE
729 bool "pxe" 730 bool "pxe"
730 select MENU 731 select MENU
731 help 732 help
732 Boot image via network using PXE protocol 733 Boot image via network using PXE protocol
733 734
734 config CMD_NFS 735 config CMD_NFS
735 bool "nfs" 736 bool "nfs"
736 default y 737 default y
737 help 738 help
738 Boot image via network using NFS protocol. 739 Boot image via network using NFS protocol.
739 740
740 config CMD_MII 741 config CMD_MII
741 bool "mii" 742 bool "mii"
742 help 743 help
743 Enable MII utility commands. 744 Enable MII utility commands.
744 745
745 config CMD_PING 746 config CMD_PING
746 bool "ping" 747 bool "ping"
747 help 748 help
748 Send ICMP ECHO_REQUEST to network host 749 Send ICMP ECHO_REQUEST to network host
749 750
750 config CMD_CDP 751 config CMD_CDP
751 bool "cdp" 752 bool "cdp"
752 help 753 help
753 Perform CDP network configuration 754 Perform CDP network configuration
754 755
755 config CMD_SNTP 756 config CMD_SNTP
756 bool "sntp" 757 bool "sntp"
757 help 758 help
758 Synchronize RTC via network 759 Synchronize RTC via network
759 760
760 config CMD_DNS 761 config CMD_DNS
761 bool "dns" 762 bool "dns"
762 help 763 help
763 Lookup the IP of a hostname 764 Lookup the IP of a hostname
764 765
765 config CMD_LINK_LOCAL 766 config CMD_LINK_LOCAL
766 bool "linklocal" 767 bool "linklocal"
767 help 768 help
768 Acquire a network IP address using the link-local protocol 769 Acquire a network IP address using the link-local protocol
769 770
770 config CMD_ETHSW 771 config CMD_ETHSW
771 bool "ethsw" 772 bool "ethsw"
772 help 773 help
773 Allow control of L2 Ethernet switch commands. These are supported 774 Allow control of L2 Ethernet switch commands. These are supported
774 by the vsc9953 Ethernet driver at present. Sub-commands allow 775 by the vsc9953 Ethernet driver at present. Sub-commands allow
775 operations such as enabling / disabling a port and 776 operations such as enabling / disabling a port and
776 viewing/maintaining the filtering database (FDB) 777 viewing/maintaining the filtering database (FDB)
777 778
778 endmenu 779 endmenu
779 780
780 menu "Misc commands" 781 menu "Misc commands"
781 782
782 config CMD_BMP 783 config CMD_BMP
783 bool "Enable 'bmp' command" 784 bool "Enable 'bmp' command"
784 depends on LCD || DM_VIDEO || VIDEO 785 depends on LCD || DM_VIDEO || VIDEO
785 help 786 help
786 This provides a way to obtain information about a BMP-format iamge 787 This provides a way to obtain information about a BMP-format iamge
787 and to display it. BMP (which presumably stands for BitMaP) is a 788 and to display it. BMP (which presumably stands for BitMaP) is a
788 file format defined by Microsoft which supports images of various 789 file format defined by Microsoft which supports images of various
789 depths, formats and compression methods. Headers on the file 790 depths, formats and compression methods. Headers on the file
790 determine the formats used. This command can be used by first loading 791 determine the formats used. This command can be used by first loading
791 the image into RAM, then using this command to look at it or display 792 the image into RAM, then using this command to look at it or display
792 it. 793 it.
793 794
794 config CMD_BSP 795 config CMD_BSP
795 bool "Enable board-specific commands" 796 bool "Enable board-specific commands"
796 help 797 help
797 (deprecated: instead, please define a Kconfig option for each command) 798 (deprecated: instead, please define a Kconfig option for each command)
798 799
799 Some boards have board-specific commands which are only enabled 800 Some boards have board-specific commands which are only enabled
800 during developemnt and need to be turned off for production. This 801 during developemnt and need to be turned off for production. This
801 option provides a way to control this. The commands that are enabled 802 option provides a way to control this. The commands that are enabled
802 vary depending on the board. 803 vary depending on the board.
803 804
804 config CMD_BKOPS_ENABLE 805 config CMD_BKOPS_ENABLE
805 bool "mmc bkops enable" 806 bool "mmc bkops enable"
806 depends on CMD_MMC 807 depends on CMD_MMC
807 default n 808 default n
808 help 809 help
809 Enable command for setting manual background operations handshake 810 Enable command for setting manual background operations handshake
810 on a eMMC device. The feature is optionally available on eMMC devices 811 on a eMMC device. The feature is optionally available on eMMC devices
811 conforming to standard >= 4.41. 812 conforming to standard >= 4.41.
812 813
813 config CMD_BLOCK_CACHE 814 config CMD_BLOCK_CACHE
814 bool "blkcache - control and stats for block cache" 815 bool "blkcache - control and stats for block cache"
815 depends on BLOCK_CACHE 816 depends on BLOCK_CACHE
816 default y if BLOCK_CACHE 817 default y if BLOCK_CACHE
817 help 818 help
818 Enable the blkcache command, which can be used to control the 819 Enable the blkcache command, which can be used to control the
819 operation of the cache functions. 820 operation of the cache functions.
820 This is most useful when fine-tuning the operation of the cache 821 This is most useful when fine-tuning the operation of the cache
821 during development, but also allows the cache to be disabled when 822 during development, but also allows the cache to be disabled when
822 it might hurt performance (e.g. when using the ums command). 823 it might hurt performance (e.g. when using the ums command).
823 824
824 config CMD_CACHE 825 config CMD_CACHE
825 bool "icache or dcache" 826 bool "icache or dcache"
826 help 827 help
827 Enable the "icache" and "dcache" commands 828 Enable the "icache" and "dcache" commands
828 829
829 config CMD_DISPLAY 830 config CMD_DISPLAY
830 bool "Enable the 'display' command, for character displays" 831 bool "Enable the 'display' command, for character displays"
831 help 832 help
832 (this needs porting to driver model) 833 (this needs porting to driver model)
833 This enables the 'display' command which allows a string to be 834 This enables the 'display' command which allows a string to be
834 displayed on a simple board-specific display. Implement 835 displayed on a simple board-specific display. Implement
835 display_putc() to use it. 836 display_putc() to use it.
836 837
837 config CMD_LED 838 config CMD_LED
838 bool "led" 839 bool "led"
839 default y if LED 840 default y if LED
840 help 841 help
841 Enable the 'led' command which allows for control of LEDs supported 842 Enable the 'led' command which allows for control of LEDs supported
842 by the board. The LEDs can be listed with 'led list' and controlled 843 by the board. The LEDs can be listed with 'led list' and controlled
843 with led on/off/togle/blink. Any LED drivers can be controlled with 844 with led on/off/togle/blink. Any LED drivers can be controlled with
844 this command, e.g. led_gpio. 845 this command, e.g. led_gpio.
845 846
846 config CMD_DATE 847 config CMD_DATE
847 bool "date" 848 bool "date"
848 default y if DM_RTC 849 default y if DM_RTC
849 help 850 help
850 Enable the 'date' command for getting/setting the time/date in RTC 851 Enable the 'date' command for getting/setting the time/date in RTC
851 devices. 852 devices.
852 853
853 config CMD_TIME 854 config CMD_TIME
854 bool "time" 855 bool "time"
855 help 856 help
856 Run commands and summarize execution time. 857 Run commands and summarize execution time.
857 858
858 config CMD_GETTIME 859 config CMD_GETTIME
859 bool "gettime - read elapsed time" 860 bool "gettime - read elapsed time"
860 help 861 help
861 Enable the 'gettime' command which reads the elapsed time since 862 Enable the 'gettime' command which reads the elapsed time since
862 U-Boot started running. This shows the time in seconds and 863 U-Boot started running. This shows the time in seconds and
863 milliseconds. See also the 'bootstage' command which provides more 864 milliseconds. See also the 'bootstage' command which provides more
864 flexibility for boot timing. 865 flexibility for boot timing.
865 866
866 # TODO: rename to CMD_SLEEP 867 # TODO: rename to CMD_SLEEP
867 config CMD_MISC 868 config CMD_MISC
868 bool "sleep" 869 bool "sleep"
869 default y 870 default y
870 help 871 help
871 Delay execution for some time 872 Delay execution for some time
872 873
873 config CMD_TIMER 874 config CMD_TIMER
874 bool "timer" 875 bool "timer"
875 help 876 help
876 Access the system timer. 877 Access the system timer.
877 878
878 config CMD_SETGETDCR 879 config CMD_SETGETDCR
879 bool "getdcr, setdcr, getidcr, setidcr" 880 bool "getdcr, setdcr, getidcr, setidcr"
880 depends on 4xx 881 depends on 4xx
881 default y 882 default y
882 help 883 help
883 getdcr - Get an AMCC PPC 4xx DCR's value 884 getdcr - Get an AMCC PPC 4xx DCR's value
884 setdcr - Set an AMCC PPC 4xx DCR's value 885 setdcr - Set an AMCC PPC 4xx DCR's value
885 getidcr - Get a register value via indirect DCR addressing 886 getidcr - Get a register value via indirect DCR addressing
886 setidcr - Set a register value via indirect DCR addressing 887 setidcr - Set a register value via indirect DCR addressing
887 888
888 config CMD_SOUND 889 config CMD_SOUND
889 bool "sound" 890 bool "sound"
890 depends on SOUND 891 depends on SOUND
891 help 892 help
892 This provides basic access to the U-Boot's sound support. The main 893 This provides basic access to the U-Boot's sound support. The main
893 feature is to play a beep. 894 feature is to play a beep.
894 895
895 sound init - set up sound system 896 sound init - set up sound system
896 sound play - play a sound 897 sound play - play a sound
897 898
898 config CMD_QFW 899 config CMD_QFW
899 bool "qfw" 900 bool "qfw"
900 select QFW 901 select QFW
901 help 902 help
902 This provides access to the QEMU firmware interface. The main 903 This provides access to the QEMU firmware interface. The main
903 feature is to allow easy loading of files passed to qemu-system 904 feature is to allow easy loading of files passed to qemu-system
904 via -kernel / -initrd 905 via -kernel / -initrd
905 906
906 source "cmd/mvebu/Kconfig" 907 source "cmd/mvebu/Kconfig"
907 908
908 endmenu 909 endmenu
909 910
910 config CMD_BOOTSTAGE 911 config CMD_BOOTSTAGE
911 bool "Enable the 'bootstage' command" 912 bool "Enable the 'bootstage' command"
912 depends on BOOTSTAGE 913 depends on BOOTSTAGE
913 help 914 help
914 Add a 'bootstage' command which supports printing a report 915 Add a 'bootstage' command which supports printing a report
915 and un/stashing of bootstage data. 916 and un/stashing of bootstage data.
916 917
917 menu "Power commands" 918 menu "Power commands"
918 config CMD_PMIC 919 config CMD_PMIC
919 bool "Enable Driver Model PMIC command" 920 bool "Enable Driver Model PMIC command"
920 depends on DM_PMIC 921 depends on DM_PMIC
921 help 922 help
922 This is the pmic command, based on a driver model pmic's API. 923 This is the pmic command, based on a driver model pmic's API.
923 Command features are unchanged: 924 Command features are unchanged:
924 - list - list pmic devices 925 - list - list pmic devices
925 - pmic dev <id> - show or [set] operating pmic device (NEW) 926 - pmic dev <id> - show or [set] operating pmic device (NEW)
926 - pmic dump - dump registers 927 - pmic dump - dump registers
927 - pmic read address - read byte of register at address 928 - pmic read address - read byte of register at address
928 - pmic write address - write byte to register at address 929 - pmic write address - write byte to register at address
929 The only one change for this command is 'dev' subcommand. 930 The only one change for this command is 'dev' subcommand.
930 931
931 config CMD_REGULATOR 932 config CMD_REGULATOR
932 bool "Enable Driver Model REGULATOR command" 933 bool "Enable Driver Model REGULATOR command"
933 depends on DM_REGULATOR 934 depends on DM_REGULATOR
934 help 935 help
935 This command is based on driver model regulator's API. 936 This command is based on driver model regulator's API.
936 User interface features: 937 User interface features:
937 - list - list regulator devices 938 - list - list regulator devices
938 - regulator dev <id> - show or [set] operating regulator device 939 - regulator dev <id> - show or [set] operating regulator device
939 - regulator info - print constraints info 940 - regulator info - print constraints info
940 - regulator status - print operating status 941 - regulator status - print operating status
941 - regulator value <val] <-f> - print/[set] voltage value [uV] 942 - regulator value <val] <-f> - print/[set] voltage value [uV]
942 - regulator current <val> - print/[set] current value [uA] 943 - regulator current <val> - print/[set] current value [uA]
943 - regulator mode <id> - print/[set] operating mode id 944 - regulator mode <id> - print/[set] operating mode id
944 - regulator enable - enable the regulator output 945 - regulator enable - enable the regulator output
945 - regulator disable - disable the regulator output 946 - regulator disable - disable the regulator output
946 947
947 The '-f' (force) option can be used for set the value which exceeds 948 The '-f' (force) option can be used for set the value which exceeds
948 the limits, which are found in device-tree and are kept in regulator's 949 the limits, which are found in device-tree and are kept in regulator's
949 uclass platdata structure. 950 uclass platdata structure.
950 951
951 endmenu 952 endmenu
952 953
953 menu "Security commands" 954 menu "Security commands"
954 config CMD_AES 955 config CMD_AES
955 bool "Enable the 'aes' command" 956 bool "Enable the 'aes' command"
956 select AES 957 select AES
957 help 958 help
958 This provides a means to encrypt and decrypt data using the AES 959 This provides a means to encrypt and decrypt data using the AES
959 (Advanced Encryption Standard). This algorithm uses a symetric key 960 (Advanced Encryption Standard). This algorithm uses a symetric key
960 and is widely used as a streaming cipher. Different key lengths are 961 and is widely used as a streaming cipher. Different key lengths are
961 supported by the algorithm but this command only supports 128 bits 962 supported by the algorithm but this command only supports 128 bits
962 at present. 963 at present.
963 964
964 config CMD_BLOB 965 config CMD_BLOB
965 bool "Enable the 'blob' command" 966 bool "Enable the 'blob' command"
966 help 967 help
967 This is used with the Freescale secure boot mechanism. 968 This is used with the Freescale secure boot mechanism.
968 969
969 Freescale's SEC block has built-in Blob Protocol which provides 970 Freescale's SEC block has built-in Blob Protocol which provides
970 a method for protecting user-defined data across system power 971 a method for protecting user-defined data across system power
971 cycles. SEC block protects data in a data structure called a Blob, 972 cycles. SEC block protects data in a data structure called a Blob,
972 which provides both confidentiality and integrity protection. 973 which provides both confidentiality and integrity protection.
973 974
974 Encapsulating data as a blob 975 Encapsulating data as a blob
975 Each time that the Blob Protocol is used to protect data, a 976 Each time that the Blob Protocol is used to protect data, a
976 different randomly generated key is used to encrypt the data. 977 different randomly generated key is used to encrypt the data.
977 This random key is itself encrypted using a key which is derived 978 This random key is itself encrypted using a key which is derived
978 from SoC's non-volatile secret key and a 16 bit Key identifier. 979 from SoC's non-volatile secret key and a 16 bit Key identifier.
979 The resulting encrypted key along with encrypted data is called a 980 The resulting encrypted key along with encrypted data is called a
980 blob. The non-volatile secure key is available for use only during 981 blob. The non-volatile secure key is available for use only during
981 secure boot. 982 secure boot.
982 983
983 During decapsulation, the reverse process is performed to get back 984 During decapsulation, the reverse process is performed to get back
984 the original data. 985 the original data.
985 986
986 Sub-commands: 987 Sub-commands:
987 blob enc - encapsulating data as a cryptgraphic blob 988 blob enc - encapsulating data as a cryptgraphic blob
988 blob dec - decapsulating cryptgraphic blob to get the data 989 blob dec - decapsulating cryptgraphic blob to get the data
989 990
990 Syntax: 991 Syntax:
991 992
992 blob enc src dst len km 993 blob enc src dst len km
993 994
994 Encapsulate and create blob of data $len bytes long 995 Encapsulate and create blob of data $len bytes long
995 at address $src and store the result at address $dst. 996 at address $src and store the result at address $dst.
996 $km is the 16 byte key modifier is also required for 997 $km is the 16 byte key modifier is also required for
997 generation/use as key for cryptographic operation. Key 998 generation/use as key for cryptographic operation. Key
998 modifier should be 16 byte long. 999 modifier should be 16 byte long.
999 1000
1000 blob dec src dst len km 1001 blob dec src dst len km
1001 1002
1002 Decapsulate the blob of data at address $src and 1003 Decapsulate the blob of data at address $src and
1003 store result of $len byte at addr $dst. 1004 store result of $len byte at addr $dst.
1004 $km is the 16 byte key modifier is also required for 1005 $km is the 16 byte key modifier is also required for
1005 generation/use as key for cryptographic operation. Key 1006 generation/use as key for cryptographic operation. Key
1006 modifier should be 16 byte long. 1007 modifier should be 16 byte long.
1007 1008
1008 config CMD_HASH 1009 config CMD_HASH
1009 bool "Support 'hash' command" 1010 bool "Support 'hash' command"
1010 select HASH 1011 select HASH
1011 help 1012 help
1012 This provides a way to hash data in memory using various supported 1013 This provides a way to hash data in memory using various supported
1013 algorithms (such as SHA1, MD5, CRC32). The computed digest can be 1014 algorithms (such as SHA1, MD5, CRC32). The computed digest can be
1014 saved to memory or to an environment variable. It is also possible 1015 saved to memory or to an environment variable. It is also possible
1015 to verify a hash against data in memory. 1016 to verify a hash against data in memory.
1016 1017
1017 config CMD_TPM 1018 config CMD_TPM
1018 bool "Enable the 'tpm' command" 1019 bool "Enable the 'tpm' command"
1019 depends on TPM 1020 depends on TPM
1020 help 1021 help
1021 This provides a means to talk to a TPM from the command line. A wide 1022 This provides a means to talk to a TPM from the command line. A wide
1022 range of commands if provided - see 'tpm help' for details. The 1023 range of commands if provided - see 'tpm help' for details. The
1023 command requires a suitable TPM on your board and the correct driver 1024 command requires a suitable TPM on your board and the correct driver
1024 must be enabled. 1025 must be enabled.
1025 1026
1026 config CMD_TPM_TEST 1027 config CMD_TPM_TEST
1027 bool "Enable the 'tpm test' command" 1028 bool "Enable the 'tpm test' command"
1028 depends on CMD_TPM 1029 depends on CMD_TPM
1029 help 1030 help
1030 This provides a a series of tests to confirm that the TPM is working 1031 This provides a a series of tests to confirm that the TPM is working
1031 correctly. The tests cover initialisation, non-volatile RAM, extend, 1032 correctly. The tests cover initialisation, non-volatile RAM, extend,
1032 global lock and checking that timing is within expectations. The 1033 global lock and checking that timing is within expectations. The
1033 tests pass correctly on Infineon TPMs but may need to be adjusted 1034 tests pass correctly on Infineon TPMs but may need to be adjusted
1034 for other devices. 1035 for other devices.
1035 1036
1036 endmenu 1037 endmenu
1037 1038
1038 menu "Firmware commands" 1039 menu "Firmware commands"
1039 config CMD_CROS_EC 1040 config CMD_CROS_EC
1040 bool "Enable crosec command" 1041 bool "Enable crosec command"
1041 depends on CROS_EC 1042 depends on CROS_EC
1042 default y 1043 default y
1043 help 1044 help
1044 Enable command-line access to the Chrome OS EC (Embedded 1045 Enable command-line access to the Chrome OS EC (Embedded
1045 Controller). This provides the 'crosec' command which has 1046 Controller). This provides the 'crosec' command which has
1046 a number of sub-commands for performing EC tasks such as 1047 a number of sub-commands for performing EC tasks such as
1047 updating its flash, accessing a small saved context area 1048 updating its flash, accessing a small saved context area
1048 and talking to the I2C bus behind the EC (if there is one). 1049 and talking to the I2C bus behind the EC (if there is one).
1049 endmenu 1050 endmenu
1050 1051
1051 menu "Filesystem commands" 1052 menu "Filesystem commands"
1052 config CMD_CBFS 1053 config CMD_CBFS
1053 bool "Enable the 'cbfs' command" 1054 bool "Enable the 'cbfs' command"
1054 depends on FS_CBFS 1055 depends on FS_CBFS
1055 help 1056 help
1056 Define this to enable support for reading from a Coreboot 1057 Define this to enable support for reading from a Coreboot
1057 filesystem. This is a ROM-based filesystem used for accessing files 1058 filesystem. This is a ROM-based filesystem used for accessing files
1058 on systems that use coreboot as the first boot-loader and then load 1059 on systems that use coreboot as the first boot-loader and then load
1059 U-Boot to actually boot the Operating System. Available commands are 1060 U-Boot to actually boot the Operating System. Available commands are
1060 cbfsinit, cbfsinfo, cbfsls and cbfsload. 1061 cbfsinit, cbfsinfo, cbfsls and cbfsload.
1061 1062
1062 config CMD_CRAMFS 1063 config CMD_CRAMFS
1063 bool "Enable the 'cramfs' command" 1064 bool "Enable the 'cramfs' command"
1064 depends on FS_CRAMFS 1065 depends on FS_CRAMFS
1065 help 1066 help
1066 This provides commands for dealing with CRAMFS (Compressed ROM 1067 This provides commands for dealing with CRAMFS (Compressed ROM
1067 filesystem). CRAMFS is useful when space is tight since files are 1068 filesystem). CRAMFS is useful when space is tight since files are
1068 compressed. Two commands are provided: 1069 compressed. Two commands are provided:
1069 1070
1070 cramfsls - lists files in a cramfs image 1071 cramfsls - lists files in a cramfs image
1071 cramfsload - loads a file from a cramfs image 1072 cramfsload - loads a file from a cramfs image
1072 1073
1073 config CMD_EXT2 1074 config CMD_EXT2
1074 bool "ext2 command support" 1075 bool "ext2 command support"
1075 help 1076 help
1076 Enables EXT2 FS command 1077 Enables EXT2 FS command
1077 1078
1078 config CMD_EXT4 1079 config CMD_EXT4
1079 bool "ext4 command support" 1080 bool "ext4 command support"
1080 help 1081 help
1081 Enables EXT4 FS command 1082 Enables EXT4 FS command
1082 1083
1083 config CMD_EXT4_WRITE 1084 config CMD_EXT4_WRITE
1084 depends on CMD_EXT4 1085 depends on CMD_EXT4
1085 bool "ext4 write command support" 1086 bool "ext4 write command support"
1086 help 1087 help
1087 Enables EXT4 FS write command 1088 Enables EXT4 FS write command
1088 1089
1089 config CMD_FAT 1090 config CMD_FAT
1090 bool "FAT command support" 1091 bool "FAT command support"
1091 help 1092 help
1092 Support for the FAT fs 1093 Support for the FAT fs
1093 1094
1094 config CMD_FS_GENERIC 1095 config CMD_FS_GENERIC
1095 bool "filesystem commands" 1096 bool "filesystem commands"
1096 help 1097 help
1097 Enables filesystem commands (e.g. load, ls) that work for multiple 1098 Enables filesystem commands (e.g. load, ls) that work for multiple
1098 fs types. 1099 fs types.
1099 1100
1100 config CMD_FS_UUID 1101 config CMD_FS_UUID
1101 bool "fsuuid command" 1102 bool "fsuuid command"
1102 help 1103 help
1103 Enables fsuuid command for filesystem UUID. 1104 Enables fsuuid command for filesystem UUID.
1104 1105
1105 config CMD_MTDPARTS 1106 config CMD_MTDPARTS
1106 depends on ARCH_SUNXI 1107 depends on ARCH_SUNXI
1107 bool "MTD partition support" 1108 bool "MTD partition support"
1108 help 1109 help
1109 MTD partition support 1110 MTD partition support
1110 1111
1111 config MTDIDS_DEFAULT 1112 config MTDIDS_DEFAULT
1112 string "Default MTD IDs" 1113 string "Default MTD IDs"
1113 depends on CMD_MTDPARTS 1114 depends on CMD_MTDPARTS
1114 help 1115 help
1115 Defines a default MTD ID 1116 Defines a default MTD ID
1116 1117
1117 config MTDPARTS_DEFAULT 1118 config MTDPARTS_DEFAULT
1118 string "Default MTD partition scheme" 1119 string "Default MTD partition scheme"
1119 depends on CMD_MTDPARTS 1120 depends on CMD_MTDPARTS
1120 help 1121 help
1121 Defines a default MTD partitioning scheme in the Linux MTD command 1122 Defines a default MTD partitioning scheme in the Linux MTD command
1122 line partitions format 1123 line partitions format
1123 1124
1124 endmenu 1125 endmenu
1125 1126
1126 menu "Debug commands" 1127 menu "Debug commands"
1127 1128
1128 config CMD_BEDBUG 1129 config CMD_BEDBUG
1129 bool "bedbug" 1130 bool "bedbug"
1130 help 1131 help
1131 The bedbug (emBEDded deBUGger) command provides debugging features 1132 The bedbug (emBEDded deBUGger) command provides debugging features
1132 for some PowerPC processors. For details please see the 1133 for some PowerPC processors. For details please see the
1133 docuemntation in doc/README.beddbug 1134 docuemntation in doc/README.beddbug
1134 1135
1135 config CMD_DIAG 1136 config CMD_DIAG
1136 bool "diag - Board diagnostics" 1137 bool "diag - Board diagnostics"
1137 help 1138 help
1138 This command provides access to board diagnostic tests. These are 1139 This command provides access to board diagnostic tests. These are
1139 called Power-on Self Tests (POST). The command allows listing of 1140 called Power-on Self Tests (POST). The command allows listing of
1140 available tests and running either all the tests, or specific tests 1141 available tests and running either all the tests, or specific tests
1141 identified by name. 1142 identified by name.
1142 1143
1143 endmenu 1144 endmenu
1144 1145
1145 config CMD_UBI 1146 config CMD_UBI
1146 tristate "Enable UBI - Unsorted block images commands" 1147 tristate "Enable UBI - Unsorted block images commands"
1147 select CRC32 1148 select CRC32
1148 select MTD_UBI 1149 select MTD_UBI
1149 default y if NAND_SUNXI 1150 default y if NAND_SUNXI
1150 help 1151 help
1151 UBI is a software layer above MTD layer which admits use of LVM-like 1152 UBI is a software layer above MTD layer which admits use of LVM-like
1152 logical volumes on top of MTD devices, hides some complexities of 1153 logical volumes on top of MTD devices, hides some complexities of
1153 flash chips like wear and bad blocks and provides some other useful 1154 flash chips like wear and bad blocks and provides some other useful
1154 capabilities. Please, consult the MTD web site for more details 1155 capabilities. Please, consult the MTD web site for more details
1155 (www.linux-mtd.infradead.org). Activate this option if you want 1156 (www.linux-mtd.infradead.org). Activate this option if you want
1156 to use U-Boot UBI commands. 1157 to use U-Boot UBI commands.
1157 1158
1158 config CMD_UBIFS 1159 config CMD_UBIFS
1159 tristate "Enable UBIFS - Unsorted block images filesystem commands" 1160 tristate "Enable UBIFS - Unsorted block images filesystem commands"
1160 depends on CMD_UBI 1161 depends on CMD_UBI
1161 select CRC32 1162 select CRC32
1162 select RBTREE if ARCH_SUNXI 1163 select RBTREE if ARCH_SUNXI
1163 select LZO if ARCH_SUNXI 1164 select LZO if ARCH_SUNXI
1164 default y if NAND_SUNXI 1165 default y if NAND_SUNXI
1165 help 1166 help
1166 UBIFS is a file system for flash devices which works on top of UBI. 1167 UBIFS is a file system for flash devices which works on top of UBI.
1167 1168
1168 endmenu 1169 endmenu
1169 1170
1 /* 1 /*
2 * (C) Copyright 2000-2006 2 * (C) Copyright 2000-2006
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 * 4 *
5 * SPDX-License-Identifier: GPL-2.0+ 5 * SPDX-License-Identifier: GPL-2.0+
6 * 6 *
7 ******************************************************************** 7 ********************************************************************
8 * 8 *
9 * Lots of code copied from: 9 * Lots of code copied from:
10 * 10 *
11 * m8xx_pcmcia.c - Linux PCMCIA socket driver for the mpc8xx series. 11 * m8xx_pcmcia.c - Linux PCMCIA socket driver for the mpc8xx series.
12 * (C) 1999-2000 Magnus Damm <damm@bitsmart.com> 12 * (C) 1999-2000 Magnus Damm <damm@bitsmart.com>
13 * 13 *
14 * "The ExCA standard specifies that socket controllers should provide 14 * "The ExCA standard specifies that socket controllers should provide
15 * two IO and five memory windows per socket, which can be independently 15 * two IO and five memory windows per socket, which can be independently
16 * configured and positioned in the host address space and mapped to 16 * configured and positioned in the host address space and mapped to
17 * arbitrary segments of card address space. " - David A Hinds. 1999 17 * arbitrary segments of card address space. " - David A Hinds. 1999
18 * 18 *
19 * This controller does _not_ meet the ExCA standard. 19 * This controller does _not_ meet the ExCA standard.
20 * 20 *
21 * m8xx pcmcia controller brief info: 21 * m8xx pcmcia controller brief info:
22 * + 8 windows (attrib, mem, i/o) 22 * + 8 windows (attrib, mem, i/o)
23 * + up to two slots (SLOT_A and SLOT_B) 23 * + up to two slots (SLOT_A and SLOT_B)
24 * + inputpins, outputpins, event and mask registers. 24 * + inputpins, outputpins, event and mask registers.
25 * - no offset register. sigh. 25 * - no offset register. sigh.
26 * 26 *
27 * Because of the lacking offset register we must map the whole card. 27 * Because of the lacking offset register we must map the whole card.
28 * We assign each memory window PCMCIA_MEM_WIN_SIZE address space. 28 * We assign each memory window PCMCIA_MEM_WIN_SIZE address space.
29 * Make sure there is (PCMCIA_MEM_WIN_SIZE * PCMCIA_MEM_WIN_NO 29 * Make sure there is (PCMCIA_MEM_WIN_SIZE * PCMCIA_MEM_WIN_NO
30 * * PCMCIA_SOCKETS_NO) bytes at PCMCIA_MEM_WIN_BASE. 30 * * PCMCIA_SOCKETS_NO) bytes at PCMCIA_MEM_WIN_BASE.
31 * The i/o windows are dynamically allocated at PCMCIA_IO_WIN_BASE. 31 * The i/o windows are dynamically allocated at PCMCIA_IO_WIN_BASE.
32 * They are maximum 64KByte each... 32 * They are maximum 64KByte each...
33 */ 33 */
34 34
35 /* #define DEBUG 1 */ 35 /* #define DEBUG 1 */
36 36
37 /* 37 /*
38 * PCMCIA support 38 * PCMCIA support
39 */ 39 */
40 #include <common.h> 40 #include <common.h>
41 #include <command.h> 41 #include <command.h>
42 #include <config.h> 42 #include <config.h>
43 #include <pcmcia.h> 43 #include <pcmcia.h>
44 #include <asm/io.h> 44 #include <asm/io.h>
45 45
46 /* -------------------------------------------------------------------- */ 46 /* -------------------------------------------------------------------- */
47 47
48 #if defined(CONFIG_CMD_PCMCIA) 48 #if defined(CONFIG_CMD_PCMCIA)
49 49
50 extern int pcmcia_on (void); 50 extern int pcmcia_on (void);
51 extern int pcmcia_off (void); 51 extern int pcmcia_off (void);
52 52
53 int do_pinit (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) 53 int do_pinit (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
54 { 54 {
55 int rcode = 0; 55 int rcode = 0;
56 56
57 if (argc != 2) { 57 if (argc != 2) {
58 printf ("Usage: pinit {on | off}\n"); 58 printf ("Usage: pinit {on | off}\n");
59 return 1; 59 return 1;
60 } 60 }
61 if (strcmp(argv[1],"on") == 0) { 61 if (strcmp(argv[1],"on") == 0) {
62 rcode = pcmcia_on (); 62 rcode = pcmcia_on ();
63 } else if (strcmp(argv[1],"off") == 0) { 63 } else if (strcmp(argv[1],"off") == 0) {
64 rcode = pcmcia_off (); 64 rcode = pcmcia_off ();
65 } else { 65 } else {
66 printf ("Usage: pinit {on | off}\n"); 66 printf ("Usage: pinit {on | off}\n");
67 return 1; 67 return 1;
68 } 68 }
69 69
70 return rcode; 70 return rcode;
71 } 71 }
72 72
73 U_BOOT_CMD( 73 U_BOOT_CMD(
74 pinit, 2, 0, do_pinit, 74 pinit, 2, 0, do_pinit,
75 "PCMCIA sub-system", 75 "PCMCIA sub-system",
76 "on - power on PCMCIA socket\n" 76 "on - power on PCMCIA socket\n"
77 "pinit off - power off PCMCIA socket" 77 "pinit off - power off PCMCIA socket"
78 ); 78 );
79 79
80 #endif 80 #endif
81 81
82 /* -------------------------------------------------------------------- */ 82 /* -------------------------------------------------------------------- */
83 83
84 #undef CHECK_IDE_DEVICE 84 #undef CHECK_IDE_DEVICE
85 85
86 #if defined(CONFIG_CMD_IDE) && defined(CONFIG_IDE_8xx_PCCARD) 86 #if defined(CONFIG_IDE) && defined(CONFIG_IDE_8xx_PCCARD)
87 #define CHECK_IDE_DEVICE 87 #define CHECK_IDE_DEVICE
88 #endif 88 #endif
89 89
90 #if defined(CONFIG_PXA_PCMCIA) 90 #if defined(CONFIG_PXA_PCMCIA)
91 #define CHECK_IDE_DEVICE 91 #define CHECK_IDE_DEVICE
92 #endif 92 #endif
93 93
94 #ifdef CHECK_IDE_DEVICE 94 #ifdef CHECK_IDE_DEVICE
95 95
96 int ide_devices_found; 96 int ide_devices_found;
97 static uchar *known_cards[] = { 97 static uchar *known_cards[] = {
98 (uchar *)"ARGOSY PnPIDE D5", 98 (uchar *)"ARGOSY PnPIDE D5",
99 NULL 99 NULL
100 }; 100 };
101 101
102 #define MAX_TUPEL_SZ 512 102 #define MAX_TUPEL_SZ 512
103 #define MAX_FEATURES 4 103 #define MAX_FEATURES 4
104 104
105 #define MAX_IDENT_CHARS 64 105 #define MAX_IDENT_CHARS 64
106 #define MAX_IDENT_FIELDS 4 106 #define MAX_IDENT_FIELDS 4
107 107
108 #define indent "\t " 108 #define indent "\t "
109 109
110 static void print_funcid (int func) 110 static void print_funcid (int func)
111 { 111 {
112 puts (indent); 112 puts (indent);
113 switch (func) { 113 switch (func) {
114 case CISTPL_FUNCID_MULTI: 114 case CISTPL_FUNCID_MULTI:
115 puts (" Multi-Function"); 115 puts (" Multi-Function");
116 break; 116 break;
117 case CISTPL_FUNCID_MEMORY: 117 case CISTPL_FUNCID_MEMORY:
118 puts (" Memory"); 118 puts (" Memory");
119 break; 119 break;
120 case CISTPL_FUNCID_SERIAL: 120 case CISTPL_FUNCID_SERIAL:
121 puts (" Serial Port"); 121 puts (" Serial Port");
122 break; 122 break;
123 case CISTPL_FUNCID_PARALLEL: 123 case CISTPL_FUNCID_PARALLEL:
124 puts (" Parallel Port"); 124 puts (" Parallel Port");
125 break; 125 break;
126 case CISTPL_FUNCID_FIXED: 126 case CISTPL_FUNCID_FIXED:
127 puts (" Fixed Disk"); 127 puts (" Fixed Disk");
128 break; 128 break;
129 case CISTPL_FUNCID_VIDEO: 129 case CISTPL_FUNCID_VIDEO:
130 puts (" Video Adapter"); 130 puts (" Video Adapter");
131 break; 131 break;
132 case CISTPL_FUNCID_NETWORK: 132 case CISTPL_FUNCID_NETWORK:
133 puts (" Network Adapter"); 133 puts (" Network Adapter");
134 break; 134 break;
135 case CISTPL_FUNCID_AIMS: 135 case CISTPL_FUNCID_AIMS:
136 puts (" AIMS Card"); 136 puts (" AIMS Card");
137 break; 137 break;
138 case CISTPL_FUNCID_SCSI: 138 case CISTPL_FUNCID_SCSI:
139 puts (" SCSI Adapter"); 139 puts (" SCSI Adapter");
140 break; 140 break;
141 default: 141 default:
142 puts (" Unknown"); 142 puts (" Unknown");
143 break; 143 break;
144 } 144 }
145 puts (" Card\n"); 145 puts (" Card\n");
146 } 146 }
147 147
148 static void print_fixed (volatile uchar *p) 148 static void print_fixed (volatile uchar *p)
149 { 149 {
150 if (p == NULL) 150 if (p == NULL)
151 return; 151 return;
152 152
153 puts(indent); 153 puts(indent);
154 154
155 switch (*p) { 155 switch (*p) {
156 case CISTPL_FUNCE_IDE_IFACE: 156 case CISTPL_FUNCE_IDE_IFACE:
157 { uchar iface = *(p+2); 157 { uchar iface = *(p+2);
158 158
159 puts ((iface == CISTPL_IDE_INTERFACE) ? " IDE" : " unknown"); 159 puts ((iface == CISTPL_IDE_INTERFACE) ? " IDE" : " unknown");
160 puts (" interface "); 160 puts (" interface ");
161 break; 161 break;
162 } 162 }
163 case CISTPL_FUNCE_IDE_MASTER: 163 case CISTPL_FUNCE_IDE_MASTER:
164 case CISTPL_FUNCE_IDE_SLAVE: 164 case CISTPL_FUNCE_IDE_SLAVE:
165 { uchar f1 = *(p+2); 165 { uchar f1 = *(p+2);
166 uchar f2 = *(p+4); 166 uchar f2 = *(p+4);
167 167
168 puts ((f1 & CISTPL_IDE_SILICON) ? " [silicon]" : " [rotating]"); 168 puts ((f1 & CISTPL_IDE_SILICON) ? " [silicon]" : " [rotating]");
169 169
170 if (f1 & CISTPL_IDE_UNIQUE) 170 if (f1 & CISTPL_IDE_UNIQUE)
171 puts (" [unique]"); 171 puts (" [unique]");
172 172
173 puts ((f1 & CISTPL_IDE_DUAL) ? " [dual]" : " [single]"); 173 puts ((f1 & CISTPL_IDE_DUAL) ? " [dual]" : " [single]");
174 174
175 if (f2 & CISTPL_IDE_HAS_SLEEP) 175 if (f2 & CISTPL_IDE_HAS_SLEEP)
176 puts (" [sleep]"); 176 puts (" [sleep]");
177 177
178 if (f2 & CISTPL_IDE_HAS_STANDBY) 178 if (f2 & CISTPL_IDE_HAS_STANDBY)
179 puts (" [standby]"); 179 puts (" [standby]");
180 180
181 if (f2 & CISTPL_IDE_HAS_IDLE) 181 if (f2 & CISTPL_IDE_HAS_IDLE)
182 puts (" [idle]"); 182 puts (" [idle]");
183 183
184 if (f2 & CISTPL_IDE_LOW_POWER) 184 if (f2 & CISTPL_IDE_LOW_POWER)
185 puts (" [low power]"); 185 puts (" [low power]");
186 186
187 if (f2 & CISTPL_IDE_REG_INHIBIT) 187 if (f2 & CISTPL_IDE_REG_INHIBIT)
188 puts (" [reg inhibit]"); 188 puts (" [reg inhibit]");
189 189
190 if (f2 & CISTPL_IDE_HAS_INDEX) 190 if (f2 & CISTPL_IDE_HAS_INDEX)
191 puts (" [index]"); 191 puts (" [index]");
192 192
193 if (f2 & CISTPL_IDE_IOIS16) 193 if (f2 & CISTPL_IDE_IOIS16)
194 puts (" [IOis16]"); 194 puts (" [IOis16]");
195 195
196 break; 196 break;
197 } 197 }
198 } 198 }
199 putc ('\n'); 199 putc ('\n');
200 } 200 }
201 201
202 static int identify (volatile uchar *p) 202 static int identify (volatile uchar *p)
203 { 203 {
204 uchar id_str[MAX_IDENT_CHARS]; 204 uchar id_str[MAX_IDENT_CHARS];
205 uchar data; 205 uchar data;
206 uchar *t; 206 uchar *t;
207 uchar **card; 207 uchar **card;
208 int i, done; 208 int i, done;
209 209
210 if (p == NULL) 210 if (p == NULL)
211 return (0); /* Don't know */ 211 return (0); /* Don't know */
212 212
213 t = id_str; 213 t = id_str;
214 done =0; 214 done =0;
215 215
216 for (i=0; i<=4 && !done; ++i, p+=2) { 216 for (i=0; i<=4 && !done; ++i, p+=2) {
217 while ((data = *p) != '\0') { 217 while ((data = *p) != '\0') {
218 if (data == 0xFF) { 218 if (data == 0xFF) {
219 done = 1; 219 done = 1;
220 break; 220 break;
221 } 221 }
222 *t++ = data; 222 *t++ = data;
223 if (t == &id_str[MAX_IDENT_CHARS-1]) { 223 if (t == &id_str[MAX_IDENT_CHARS-1]) {
224 done = 1; 224 done = 1;
225 break; 225 break;
226 } 226 }
227 p += 2; 227 p += 2;
228 } 228 }
229 if (!done) 229 if (!done)
230 *t++ = ' '; 230 *t++ = ' ';
231 } 231 }
232 *t = '\0'; 232 *t = '\0';
233 while (--t > id_str) { 233 while (--t > id_str) {
234 if (*t == ' ') 234 if (*t == ' ')
235 *t = '\0'; 235 *t = '\0';
236 else 236 else
237 break; 237 break;
238 } 238 }
239 puts ((char *)id_str); 239 puts ((char *)id_str);
240 putc ('\n'); 240 putc ('\n');
241 241
242 for (card=known_cards; *card; ++card) { 242 for (card=known_cards; *card; ++card) {
243 debug ("## Compare against \"%s\"\n", *card); 243 debug ("## Compare against \"%s\"\n", *card);
244 if (strcmp((char *)*card, (char *)id_str) == 0) { /* found! */ 244 if (strcmp((char *)*card, (char *)id_str) == 0) { /* found! */
245 debug ("## CARD FOUND ##\n"); 245 debug ("## CARD FOUND ##\n");
246 return (1); 246 return (1);
247 } 247 }
248 } 248 }
249 249
250 return (0); /* don't know */ 250 return (0); /* don't know */
251 } 251 }
252 252
253 int check_ide_device (int slot) 253 int check_ide_device (int slot)
254 { 254 {
255 volatile uchar *ident = NULL; 255 volatile uchar *ident = NULL;
256 volatile uchar *feature_p[MAX_FEATURES]; 256 volatile uchar *feature_p[MAX_FEATURES];
257 volatile uchar *p, *start, *addr; 257 volatile uchar *p, *start, *addr;
258 int n_features = 0; 258 int n_features = 0;
259 uchar func_id = ~0; 259 uchar func_id = ~0;
260 uchar code, len; 260 uchar code, len;
261 ushort config_base = 0; 261 ushort config_base = 0;
262 int found = 0; 262 int found = 0;
263 int i; 263 int i;
264 264
265 addr = (volatile uchar *)(CONFIG_SYS_PCMCIA_MEM_ADDR + 265 addr = (volatile uchar *)(CONFIG_SYS_PCMCIA_MEM_ADDR +
266 CONFIG_SYS_PCMCIA_MEM_SIZE * (slot * 4)); 266 CONFIG_SYS_PCMCIA_MEM_SIZE * (slot * 4));
267 debug ("PCMCIA MEM: %08lX\n", (ulong)addr); 267 debug ("PCMCIA MEM: %08lX\n", (ulong)addr);
268 268
269 start = p = (volatile uchar *) addr; 269 start = p = (volatile uchar *) addr;
270 270
271 while ((p - start) < MAX_TUPEL_SZ) { 271 while ((p - start) < MAX_TUPEL_SZ) {
272 272
273 code = *p; p += 2; 273 code = *p; p += 2;
274 274
275 if (code == 0xFF) { /* End of chain */ 275 if (code == 0xFF) { /* End of chain */
276 break; 276 break;
277 } 277 }
278 278
279 len = *p; p += 2; 279 len = *p; p += 2;
280 #if defined(DEBUG) && (DEBUG > 1) 280 #if defined(DEBUG) && (DEBUG > 1)
281 { volatile uchar *q = p; 281 { volatile uchar *q = p;
282 printf ("\nTuple code %02x length %d\n\tData:", 282 printf ("\nTuple code %02x length %d\n\tData:",
283 code, len); 283 code, len);
284 284
285 for (i = 0; i < len; ++i) { 285 for (i = 0; i < len; ++i) {
286 printf (" %02x", *q); 286 printf (" %02x", *q);
287 q+= 2; 287 q+= 2;
288 } 288 }
289 } 289 }
290 #endif /* DEBUG */ 290 #endif /* DEBUG */
291 switch (code) { 291 switch (code) {
292 case CISTPL_VERS_1: 292 case CISTPL_VERS_1:
293 ident = p + 4; 293 ident = p + 4;
294 break; 294 break;
295 case CISTPL_FUNCID: 295 case CISTPL_FUNCID:
296 /* Fix for broken SanDisk which may have 0x80 bit set */ 296 /* Fix for broken SanDisk which may have 0x80 bit set */
297 func_id = *p & 0x7F; 297 func_id = *p & 0x7F;
298 break; 298 break;
299 case CISTPL_FUNCE: 299 case CISTPL_FUNCE:
300 if (n_features < MAX_FEATURES) 300 if (n_features < MAX_FEATURES)
301 feature_p[n_features++] = p; 301 feature_p[n_features++] = p;
302 break; 302 break;
303 case CISTPL_CONFIG: 303 case CISTPL_CONFIG:
304 config_base = (*(p+6) << 8) + (*(p+4)); 304 config_base = (*(p+6) << 8) + (*(p+4));
305 debug ("\n## Config_base = %04x ###\n", config_base); 305 debug ("\n## Config_base = %04x ###\n", config_base);
306 default: 306 default:
307 break; 307 break;
308 } 308 }
309 p += 2 * len; 309 p += 2 * len;
310 } 310 }
311 311
312 found = identify (ident); 312 found = identify (ident);
313 313
314 if (func_id != ((uchar)~0)) { 314 if (func_id != ((uchar)~0)) {
315 print_funcid (func_id); 315 print_funcid (func_id);
316 316
317 if (func_id == CISTPL_FUNCID_FIXED) 317 if (func_id == CISTPL_FUNCID_FIXED)
318 found = 1; 318 found = 1;
319 else 319 else
320 return (1); /* no disk drive */ 320 return (1); /* no disk drive */
321 } 321 }
322 322
323 for (i=0; i<n_features; ++i) { 323 for (i=0; i<n_features; ++i) {
324 print_fixed (feature_p[i]); 324 print_fixed (feature_p[i]);
325 } 325 }
326 326
327 if (!found) { 327 if (!found) {
328 printf ("unknown card type\n"); 328 printf ("unknown card type\n");
329 return (1); 329 return (1);
330 } 330 }
331 331
332 ide_devices_found |= (1 << slot); 332 ide_devices_found |= (1 << slot);
333 333
334 /* set I/O area in config reg -> only valid for ARGOSY D5!!! */ 334 /* set I/O area in config reg -> only valid for ARGOSY D5!!! */
335 *((uchar *)(addr + config_base)) = 1; 335 *((uchar *)(addr + config_base)) = 1;
336 #if 0 336 #if 0
337 printf("\n## Config_base = %04x ###\n", config_base); 337 printf("\n## Config_base = %04x ###\n", config_base);
338 printf("Configuration Option Register: %02x @ %x\n", readb(addr + config_base), addr + config_base); 338 printf("Configuration Option Register: %02x @ %x\n", readb(addr + config_base), addr + config_base);
339 printf("Card Configuration and Status Register: %02x\n", readb(addr + config_base + 2)); 339 printf("Card Configuration and Status Register: %02x\n", readb(addr + config_base + 2));
340 printf("Pin Replacement Register Register: %02x\n", readb(addr + config_base + 4)); 340 printf("Pin Replacement Register Register: %02x\n", readb(addr + config_base + 4));
341 printf("Socket and Copy Register: %02x\n", readb(addr + config_base + 6)); 341 printf("Socket and Copy Register: %02x\n", readb(addr + config_base + 6));
342 #endif 342 #endif
343 return (0); 343 return (0);
344 } 344 }
345 345
346 #endif /* CHECK_IDE_DEVICE */ 346 #endif /* CHECK_IDE_DEVICE */
347 347
1 # 1 #
2 # (C) Copyright 2004-2006 2 # (C) Copyright 2004-2006
3 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. 3 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 # 4 #
5 # SPDX-License-Identifier: GPL-2.0+ 5 # SPDX-License-Identifier: GPL-2.0+
6 # 6 #
7 7
8 # core 8 # core
9 ifndef CONFIG_SPL_BUILD 9 ifndef CONFIG_SPL_BUILD
10 obj-y += init/ 10 obj-y += init/
11 obj-y += main.o 11 obj-y += main.o
12 obj-y += exports.o 12 obj-y += exports.o
13 obj-$(CONFIG_HASH) += hash.o 13 obj-$(CONFIG_HASH) += hash.o
14 obj-$(CONFIG_HUSH_PARSER) += cli_hush.o 14 obj-$(CONFIG_HUSH_PARSER) += cli_hush.o
15 obj-$(CONFIG_AUTOBOOT) += autoboot.o 15 obj-$(CONFIG_AUTOBOOT) += autoboot.o
16 16
17 # This option is not just y/n - it can have a numeric value 17 # This option is not just y/n - it can have a numeric value
18 ifdef CONFIG_BOOT_RETRY_TIME 18 ifdef CONFIG_BOOT_RETRY_TIME
19 obj-y += bootretry.o 19 obj-y += bootretry.o
20 endif 20 endif
21 21
22 # boards 22 # boards
23 obj-y += board_f.o 23 obj-y += board_f.o
24 obj-y += board_r.o 24 obj-y += board_r.o
25 obj-$(CONFIG_DISPLAY_BOARDINFO) += board_info.o 25 obj-$(CONFIG_DISPLAY_BOARDINFO) += board_info.o
26 obj-$(CONFIG_DISPLAY_BOARDINFO_LATE) += board_info.o 26 obj-$(CONFIG_DISPLAY_BOARDINFO_LATE) += board_info.o
27 27
28 obj-$(CONFIG_CMD_BOOTM) += bootm.o bootm_os.o 28 obj-$(CONFIG_CMD_BOOTM) += bootm.o bootm_os.o
29 obj-$(CONFIG_CMD_BOOTZ) += bootm.o bootm_os.o 29 obj-$(CONFIG_CMD_BOOTZ) += bootm.o bootm_os.o
30 obj-$(CONFIG_CMD_BOOTI) += bootm.o bootm_os.o 30 obj-$(CONFIG_CMD_BOOTI) += bootm.o bootm_os.o
31 31
32 # environment 32 # environment
33 obj-y += env_attr.o 33 obj-y += env_attr.o
34 obj-y += env_callback.o 34 obj-y += env_callback.o
35 obj-y += env_flags.o 35 obj-y += env_flags.o
36 obj-$(CONFIG_ENV_IS_IN_DATAFLASH) += env_dataflash.o 36 obj-$(CONFIG_ENV_IS_IN_DATAFLASH) += env_dataflash.o
37 obj-$(CONFIG_ENV_IS_IN_EEPROM) += env_eeprom.o 37 obj-$(CONFIG_ENV_IS_IN_EEPROM) += env_eeprom.o
38 extra-$(CONFIG_ENV_IS_EMBEDDED) += env_embedded.o 38 extra-$(CONFIG_ENV_IS_EMBEDDED) += env_embedded.o
39 obj-$(CONFIG_ENV_IS_IN_EEPROM) += env_embedded.o 39 obj-$(CONFIG_ENV_IS_IN_EEPROM) += env_embedded.o
40 extra-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o 40 extra-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o
41 obj-$(CONFIG_ENV_IS_IN_NVRAM) += env_embedded.o 41 obj-$(CONFIG_ENV_IS_IN_NVRAM) += env_embedded.o
42 obj-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o 42 obj-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
43 obj-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o 43 obj-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o
44 obj-$(CONFIG_ENV_IS_IN_FAT) += env_fat.o 44 obj-$(CONFIG_ENV_IS_IN_FAT) += env_fat.o
45 obj-$(CONFIG_ENV_IS_IN_EXT4) += env_ext4.o 45 obj-$(CONFIG_ENV_IS_IN_EXT4) += env_ext4.o
46 obj-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o 46 obj-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o
47 obj-$(CONFIG_ENV_IS_IN_NVRAM) += env_nvram.o 47 obj-$(CONFIG_ENV_IS_IN_NVRAM) += env_nvram.o
48 obj-$(CONFIG_ENV_IS_IN_ONENAND) += env_onenand.o 48 obj-$(CONFIG_ENV_IS_IN_ONENAND) += env_onenand.o
49 obj-$(CONFIG_ENV_IS_IN_SATA) += env_sata.o 49 obj-$(CONFIG_ENV_IS_IN_SATA) += env_sata.o
50 obj-$(CONFIG_ENV_IS_IN_SPI_FLASH) += env_sf.o 50 obj-$(CONFIG_ENV_IS_IN_SPI_FLASH) += env_sf.o
51 obj-$(CONFIG_ENV_IS_IN_REMOTE) += env_remote.o 51 obj-$(CONFIG_ENV_IS_IN_REMOTE) += env_remote.o
52 obj-$(CONFIG_ENV_IS_IN_UBI) += env_ubi.o 52 obj-$(CONFIG_ENV_IS_IN_UBI) += env_ubi.o
53 obj-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o 53 obj-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o
54 54
55 obj-$(CONFIG_CMD_BEDBUG) += bedbug.o 55 obj-$(CONFIG_CMD_BEDBUG) += bedbug.o
56 obj-$(CONFIG_$(SPL_)OF_LIBFDT) += fdt_support.o 56 obj-$(CONFIG_$(SPL_)OF_LIBFDT) += fdt_support.o
57 57
58 obj-$(CONFIG_MII) += miiphyutil.o 58 obj-$(CONFIG_MII) += miiphyutil.o
59 obj-$(CONFIG_CMD_MII) += miiphyutil.o 59 obj-$(CONFIG_CMD_MII) += miiphyutil.o
60 obj-$(CONFIG_PHYLIB) += miiphyutil.o 60 obj-$(CONFIG_PHYLIB) += miiphyutil.o
61 61
62 ifdef CONFIG_CMD_USB 62 ifdef CONFIG_CMD_USB
63 obj-y += usb.o usb_hub.o 63 obj-y += usb.o usb_hub.o
64 obj-$(CONFIG_USB_STORAGE) += usb_storage.o 64 obj-$(CONFIG_USB_STORAGE) += usb_storage.o
65 endif 65 endif
66 66
67 # others 67 # others
68 obj-$(CONFIG_BOOTSTAGE) += bootstage.o 68 obj-$(CONFIG_BOOTSTAGE) += bootstage.o
69 obj-$(CONFIG_CONSOLE_MUX) += iomux.o 69 obj-$(CONFIG_CONSOLE_MUX) += iomux.o
70 obj-$(CONFIG_MTD_NOR_FLASH) += flash.o 70 obj-$(CONFIG_MTD_NOR_FLASH) += flash.o
71 obj-$(CONFIG_CMD_KGDB) += kgdb.o kgdb_stubs.o 71 obj-$(CONFIG_CMD_KGDB) += kgdb.o kgdb_stubs.o
72 obj-$(CONFIG_I2C_EDID) += edid.o 72 obj-$(CONFIG_I2C_EDID) += edid.o
73 obj-$(CONFIG_KALLSYMS) += kallsyms.o 73 obj-$(CONFIG_KALLSYMS) += kallsyms.o
74 obj-y += splash.o 74 obj-y += splash.o
75 obj-$(CONFIG_SPLASH_SOURCE) += splash_source.o 75 obj-$(CONFIG_SPLASH_SOURCE) += splash_source.o
76 ifndef CONFIG_DM_VIDEO 76 ifndef CONFIG_DM_VIDEO
77 obj-$(CONFIG_LCD) += lcd.o lcd_console.o 77 obj-$(CONFIG_LCD) += lcd.o lcd_console.o
78 endif 78 endif
79 obj-$(CONFIG_LCD_ROTATION) += lcd_console_rotation.o 79 obj-$(CONFIG_LCD_ROTATION) += lcd_console_rotation.o
80 obj-$(CONFIG_LCD_DT_SIMPLEFB) += lcd_simplefb.o 80 obj-$(CONFIG_LCD_DT_SIMPLEFB) += lcd_simplefb.o
81 obj-$(CONFIG_LYNXKDI) += lynxkdi.o 81 obj-$(CONFIG_LYNXKDI) += lynxkdi.o
82 obj-$(CONFIG_MENU) += menu.o 82 obj-$(CONFIG_MENU) += menu.o
83 obj-$(CONFIG_CMD_SATA) += sata.o 83 obj-$(CONFIG_CMD_SATA) += sata.o
84 obj-$(CONFIG_SCSI) += scsi.o 84 obj-$(CONFIG_SCSI) += scsi.o
85 obj-$(CONFIG_UPDATE_TFTP) += update.o 85 obj-$(CONFIG_UPDATE_TFTP) += update.o
86 obj-$(CONFIG_DFU_TFTP) += update.o 86 obj-$(CONFIG_DFU_TFTP) += update.o
87 obj-$(CONFIG_USB_KEYBOARD) += usb_kbd.o 87 obj-$(CONFIG_USB_KEYBOARD) += usb_kbd.o
88 obj-$(CONFIG_CMDLINE) += cli_readline.o cli_simple.o 88 obj-$(CONFIG_CMDLINE) += cli_readline.o cli_simple.o
89 89
90 endif # !CONFIG_SPL_BUILD 90 endif # !CONFIG_SPL_BUILD
91 91
92 ifdef CONFIG_SPL_BUILD 92 ifdef CONFIG_SPL_BUILD
93 obj-$(CONFIG_SPL_DFU_SUPPORT) += dfu.o 93 obj-$(CONFIG_SPL_DFU_SUPPORT) += dfu.o
94 obj-$(CONFIG_SPL_DFU_SUPPORT) += cli_hush.o 94 obj-$(CONFIG_SPL_DFU_SUPPORT) += cli_hush.o
95 obj-$(CONFIG_SPL_HASH_SUPPORT) += hash.o 95 obj-$(CONFIG_SPL_HASH_SUPPORT) += hash.o
96 obj-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o 96 obj-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
97 obj-$(CONFIG_SPL_YMODEM_SUPPORT) += xyzModem.o 97 obj-$(CONFIG_SPL_YMODEM_SUPPORT) += xyzModem.o
98 obj-$(CONFIG_SPL_NET_SUPPORT) += miiphyutil.o 98 obj-$(CONFIG_SPL_NET_SUPPORT) += miiphyutil.o
99 obj-$(CONFIG_SPL_OF_LIBFDT) += fdt_support.o 99 obj-$(CONFIG_SPL_OF_LIBFDT) += fdt_support.o
100 ifdef CONFIG_SPL_USB_HOST_SUPPORT 100 ifdef CONFIG_SPL_USB_HOST_SUPPORT
101 obj-$(CONFIG_SPL_USB_SUPPORT) += usb.o usb_hub.o 101 obj-$(CONFIG_SPL_USB_SUPPORT) += usb.o usb_hub.o
102 obj-$(CONFIG_USB_STORAGE) += usb_storage.o 102 obj-$(CONFIG_USB_STORAGE) += usb_storage.o
103 endif 103 endif
104 # environment 104 # environment
105 ifdef CONFIG_TPL_BUILD 105 ifdef CONFIG_TPL_BUILD
106 obj-$(CONFIG_TPL_ENV_SUPPORT) += env_attr.o 106 obj-$(CONFIG_TPL_ENV_SUPPORT) += env_attr.o
107 obj-$(CONFIG_TPL_ENV_SUPPORT) += env_flags.o 107 obj-$(CONFIG_TPL_ENV_SUPPORT) += env_flags.o
108 obj-$(CONFIG_TPL_ENV_SUPPORT) += env_callback.o 108 obj-$(CONFIG_TPL_ENV_SUPPORT) += env_callback.o
109 else 109 else
110 obj-$(CONFIG_SPL_ENV_SUPPORT) += env_attr.o 110 obj-$(CONFIG_SPL_ENV_SUPPORT) += env_attr.o
111 obj-$(CONFIG_SPL_ENV_SUPPORT) += env_flags.o 111 obj-$(CONFIG_SPL_ENV_SUPPORT) += env_flags.o
112 obj-$(CONFIG_SPL_ENV_SUPPORT) += env_callback.o 112 obj-$(CONFIG_SPL_ENV_SUPPORT) += env_callback.o
113 endif 113 endif
114 ifneq ($(CONFIG_TPL_ENV_SUPPORT)$(CONFIG_SPL_ENV_SUPPORT),) 114 ifneq ($(CONFIG_TPL_ENV_SUPPORT)$(CONFIG_SPL_ENV_SUPPORT),)
115 obj-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o 115 obj-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o
116 obj-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o 116 obj-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o
117 obj-$(CONFIG_ENV_IS_IN_FAT) += env_fat.o 117 obj-$(CONFIG_ENV_IS_IN_FAT) += env_fat.o
118 obj-$(CONFIG_ENV_IS_IN_EXT4) += env_ext4.o 118 obj-$(CONFIG_ENV_IS_IN_EXT4) += env_ext4.o
119 obj-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o 119 obj-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o
120 obj-$(CONFIG_ENV_IS_IN_SPI_FLASH) += env_sf.o 120 obj-$(CONFIG_ENV_IS_IN_SPI_FLASH) += env_sf.o
121 obj-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o 121 obj-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
122 endif 122 endif
123 ifdef CONFIG_SPL_SATA_SUPPORT 123 ifdef CONFIG_SPL_SATA_SUPPORT
124 obj-$(CONFIG_SCSI) += scsi.o 124 obj-$(CONFIG_SCSI) += scsi.o
125 endif 125 endif
126 endif 126 endif
127 #environment 127 #environment
128 obj-y += env_common.o 128 obj-y += env_common.o
129 #others 129 #others
130 obj-$(CONFIG_DDR_SPD) += ddr_spd.o 130 obj-$(CONFIG_DDR_SPD) += ddr_spd.o
131 obj-$(CONFIG_SPD_EEPROM) += ddr_spd.o 131 obj-$(CONFIG_SPD_EEPROM) += ddr_spd.o
132 obj-$(CONFIG_HWCONFIG) += hwconfig.o 132 obj-$(CONFIG_HWCONFIG) += hwconfig.o
133 obj-$(CONFIG_BOUNCE_BUFFER) += bouncebuf.o 133 obj-$(CONFIG_BOUNCE_BUFFER) += bouncebuf.o
134 ifdef CONFIG_SPL_BUILD 134 ifdef CONFIG_SPL_BUILD
135 ifdef CONFIG_TPL_BUILD 135 ifdef CONFIG_TPL_BUILD
136 obj-$(CONFIG_TPL_SERIAL_SUPPORT) += console.o 136 obj-$(CONFIG_TPL_SERIAL_SUPPORT) += console.o
137 else 137 else
138 obj-$(CONFIG_SPL_SERIAL_SUPPORT) += console.o 138 obj-$(CONFIG_SPL_SERIAL_SUPPORT) += console.o
139 endif 139 endif
140 else 140 else
141 obj-y += console.o 141 obj-y += console.o
142 endif 142 endif
143 obj-$(CONFIG_CROS_EC) += cros_ec.o 143 obj-$(CONFIG_CROS_EC) += cros_ec.o
144 obj-y += dlmalloc.o 144 obj-y += dlmalloc.o
145 ifdef CONFIG_SYS_MALLOC_F_LEN 145 ifdef CONFIG_SYS_MALLOC_F_LEN
146 obj-y += malloc_simple.o 146 obj-y += malloc_simple.o
147 endif 147 endif
148 obj-$(CONFIG_CMD_IDE) += ide.o
149 obj-y += image.o 148 obj-y += image.o
150 obj-$(CONFIG_ANDROID_BOOT_IMAGE) += image-android.o 149 obj-$(CONFIG_ANDROID_BOOT_IMAGE) += image-android.o
151 obj-$(CONFIG_$(SPL_)OF_LIBFDT) += image-fdt.o 150 obj-$(CONFIG_$(SPL_)OF_LIBFDT) += image-fdt.o
152 obj-$(CONFIG_$(SPL_)FIT) += image-fit.o 151 obj-$(CONFIG_$(SPL_)FIT) += image-fit.o
153 obj-$(CONFIG_$(SPL_)FIT_SIGNATURE) += image-sig.o 152 obj-$(CONFIG_$(SPL_)FIT_SIGNATURE) += image-sig.o
154 obj-$(CONFIG_IO_TRACE) += iotrace.o 153 obj-$(CONFIG_IO_TRACE) += iotrace.o
155 obj-y += memsize.o 154 obj-y += memsize.o
156 obj-y += stdio.o 155 obj-y += stdio.o
157 156
158 # This option is not just y/n - it can have a numeric value 157 # This option is not just y/n - it can have a numeric value
159 ifdef CONFIG_FASTBOOT_FLASH 158 ifdef CONFIG_FASTBOOT_FLASH
160 obj-y += image-sparse.o 159 obj-y += image-sparse.o
161 ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV 160 ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
162 obj-y += fb_mmc.o 161 obj-y += fb_mmc.o
163 endif 162 endif
164 ifdef CONFIG_FASTBOOT_FLASH_NAND_DEV 163 ifdef CONFIG_FASTBOOT_FLASH_NAND_DEV
165 obj-y += fb_nand.o 164 obj-y += fb_nand.o
166 endif 165 endif
167 endif 166 endif
168 167
169 ifdef CONFIG_CMD_EEPROM_LAYOUT 168 ifdef CONFIG_CMD_EEPROM_LAYOUT
170 obj-y += eeprom/eeprom_field.o eeprom/eeprom_layout.o 169 obj-y += eeprom/eeprom_field.o eeprom/eeprom_layout.o
171 endif 170 endif
172 171
173 obj-y += cli.o 172 obj-y += cli.o
174 obj-$(CONFIG_FSL_DDR_INTERACTIVE) += cli_simple.o cli_readline.o 173 obj-$(CONFIG_FSL_DDR_INTERACTIVE) += cli_simple.o cli_readline.o
175 obj-$(CONFIG_CMD_DFU) += dfu.o 174 obj-$(CONFIG_CMD_DFU) += dfu.o
176 obj-y += command.o 175 obj-y += command.o
177 obj-y += s_record.o 176 obj-y += s_record.o
178 obj-y += xyzModem.o 177 obj-y += xyzModem.o
179 178
180 CFLAGS_env_embedded.o := -Wa,--no-warn -DENV_CRC=$(shell tools/envcrc 2>/dev/null) 179 CFLAGS_env_embedded.o := -Wa,--no-warn -DENV_CRC=$(shell tools/envcrc 2>/dev/null)
181 180
1 /* 1 /*
2 * Copyright (c) 2011 The Chromium OS Authors. 2 * Copyright (c) 2011 The Chromium OS Authors.
3 * (C) Copyright 2002-2006 3 * (C) Copyright 2002-2006
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * 5 *
6 * (C) Copyright 2002 6 * (C) Copyright 2002
7 * Sysgo Real-Time Solutions, GmbH <www.elinos.com> 7 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
8 * Marius Groeger <mgroeger@sysgo.de> 8 * Marius Groeger <mgroeger@sysgo.de>
9 * 9 *
10 * SPDX-License-Identifier: GPL-2.0+ 10 * SPDX-License-Identifier: GPL-2.0+
11 */ 11 */
12 12
13 #include <common.h> 13 #include <common.h>
14 /* TODO: can we just include all these headers whether needed or not? */ 14 /* TODO: can we just include all these headers whether needed or not? */
15 #if defined(CONFIG_CMD_BEDBUG) 15 #if defined(CONFIG_CMD_BEDBUG)
16 #include <bedbug/type.h> 16 #include <bedbug/type.h>
17 #endif 17 #endif
18 #include <command.h> 18 #include <command.h>
19 #include <console.h> 19 #include <console.h>
20 #ifdef CONFIG_HAS_DATAFLASH 20 #ifdef CONFIG_HAS_DATAFLASH
21 #include <dataflash.h> 21 #include <dataflash.h>
22 #endif 22 #endif
23 #include <dm.h> 23 #include <dm.h>
24 #include <environment.h> 24 #include <environment.h>
25 #include <fdtdec.h> 25 #include <fdtdec.h>
26 #if defined(CONFIG_CMD_IDE)
27 #include <ide.h> 26 #include <ide.h>
28 #endif
29 #include <initcall.h> 27 #include <initcall.h>
30 #include <init_helpers.h> 28 #include <init_helpers.h>
31 #ifdef CONFIG_PS2KBD 29 #ifdef CONFIG_PS2KBD
32 #include <keyboard.h> 30 #include <keyboard.h>
33 #endif 31 #endif
34 #if defined(CONFIG_CMD_KGDB) 32 #if defined(CONFIG_CMD_KGDB)
35 #include <kgdb.h> 33 #include <kgdb.h>
36 #endif 34 #endif
37 #include <logbuff.h> 35 #include <logbuff.h>
38 #include <malloc.h> 36 #include <malloc.h>
39 #include <mapmem.h> 37 #include <mapmem.h>
40 #ifdef CONFIG_BITBANGMII 38 #ifdef CONFIG_BITBANGMII
41 #include <miiphy.h> 39 #include <miiphy.h>
42 #endif 40 #endif
43 #include <mmc.h> 41 #include <mmc.h>
44 #include <nand.h> 42 #include <nand.h>
45 #include <onenand_uboot.h> 43 #include <onenand_uboot.h>
46 #include <scsi.h> 44 #include <scsi.h>
47 #include <serial.h> 45 #include <serial.h>
48 #include <spi.h> 46 #include <spi.h>
49 #include <stdio_dev.h> 47 #include <stdio_dev.h>
50 #include <timer.h> 48 #include <timer.h>
51 #include <trace.h> 49 #include <trace.h>
52 #include <watchdog.h> 50 #include <watchdog.h>
53 #ifdef CONFIG_ADDR_MAP 51 #ifdef CONFIG_ADDR_MAP
54 #include <asm/mmu.h> 52 #include <asm/mmu.h>
55 #endif 53 #endif
56 #include <asm/sections.h> 54 #include <asm/sections.h>
57 #include <dm/root.h> 55 #include <dm/root.h>
58 #include <linux/compiler.h> 56 #include <linux/compiler.h>
59 #include <linux/err.h> 57 #include <linux/err.h>
60 #ifdef CONFIG_AVR32 58 #ifdef CONFIG_AVR32
61 #include <asm/arch/mmu.h> 59 #include <asm/arch/mmu.h>
62 #endif 60 #endif
63 #include <efi_loader.h> 61 #include <efi_loader.h>
64 62
65 DECLARE_GLOBAL_DATA_PTR; 63 DECLARE_GLOBAL_DATA_PTR;
66 64
67 ulong monitor_flash_len; 65 ulong monitor_flash_len;
68 66
69 __weak int board_flash_wp_on(void) 67 __weak int board_flash_wp_on(void)
70 { 68 {
71 /* 69 /*
72 * Most flashes can't be detected when write protection is enabled, 70 * Most flashes can't be detected when write protection is enabled,
73 * so provide a way to let U-Boot gracefully ignore write protected 71 * so provide a way to let U-Boot gracefully ignore write protected
74 * devices. 72 * devices.
75 */ 73 */
76 return 0; 74 return 0;
77 } 75 }
78 76
79 __weak void cpu_secondary_init_r(void) 77 __weak void cpu_secondary_init_r(void)
80 { 78 {
81 } 79 }
82 80
83 static int initr_secondary_cpu(void) 81 static int initr_secondary_cpu(void)
84 { 82 {
85 /* 83 /*
86 * after non-volatile devices & environment is setup and cpu code have 84 * after non-volatile devices & environment is setup and cpu code have
87 * another round to deal with any initialization that might require 85 * another round to deal with any initialization that might require
88 * full access to the environment or loading of some image (firmware) 86 * full access to the environment or loading of some image (firmware)
89 * from a non-volatile device 87 * from a non-volatile device
90 */ 88 */
91 /* TODO: maybe define this for all archs? */ 89 /* TODO: maybe define this for all archs? */
92 cpu_secondary_init_r(); 90 cpu_secondary_init_r();
93 91
94 return 0; 92 return 0;
95 } 93 }
96 94
97 static int initr_trace(void) 95 static int initr_trace(void)
98 { 96 {
99 #ifdef CONFIG_TRACE 97 #ifdef CONFIG_TRACE
100 trace_init(gd->trace_buff, CONFIG_TRACE_BUFFER_SIZE); 98 trace_init(gd->trace_buff, CONFIG_TRACE_BUFFER_SIZE);
101 #endif 99 #endif
102 100
103 return 0; 101 return 0;
104 } 102 }
105 103
106 static int initr_reloc(void) 104 static int initr_reloc(void)
107 { 105 {
108 /* tell others: relocation done */ 106 /* tell others: relocation done */
109 gd->flags |= GD_FLG_RELOC | GD_FLG_FULL_MALLOC_INIT; 107 gd->flags |= GD_FLG_RELOC | GD_FLG_FULL_MALLOC_INIT;
110 108
111 return 0; 109 return 0;
112 } 110 }
113 111
114 #ifdef CONFIG_ARM 112 #ifdef CONFIG_ARM
115 /* 113 /*
116 * Some of these functions are needed purely because the functions they 114 * Some of these functions are needed purely because the functions they
117 * call return void. If we change them to return 0, these stubs can go away. 115 * call return void. If we change them to return 0, these stubs can go away.
118 */ 116 */
119 static int initr_caches(void) 117 static int initr_caches(void)
120 { 118 {
121 /* Enable caches */ 119 /* Enable caches */
122 enable_caches(); 120 enable_caches();
123 return 0; 121 return 0;
124 } 122 }
125 #endif 123 #endif
126 124
127 __weak int fixup_cpu(void) 125 __weak int fixup_cpu(void)
128 { 126 {
129 return 0; 127 return 0;
130 } 128 }
131 129
132 static int initr_reloc_global_data(void) 130 static int initr_reloc_global_data(void)
133 { 131 {
134 #ifdef __ARM__ 132 #ifdef __ARM__
135 monitor_flash_len = _end - __image_copy_start; 133 monitor_flash_len = _end - __image_copy_start;
136 #elif defined(CONFIG_NDS32) 134 #elif defined(CONFIG_NDS32)
137 monitor_flash_len = (ulong)&_end - (ulong)&_start; 135 monitor_flash_len = (ulong)&_end - (ulong)&_start;
138 #elif !defined(CONFIG_SANDBOX) && !defined(CONFIG_NIOS2) 136 #elif !defined(CONFIG_SANDBOX) && !defined(CONFIG_NIOS2)
139 monitor_flash_len = (ulong)&__init_end - gd->relocaddr; 137 monitor_flash_len = (ulong)&__init_end - gd->relocaddr;
140 #endif 138 #endif
141 #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx) 139 #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
142 /* 140 /*
143 * The gd->cpu pointer is set to an address in flash before relocation. 141 * The gd->cpu pointer is set to an address in flash before relocation.
144 * We need to update it to point to the same CPU entry in RAM. 142 * We need to update it to point to the same CPU entry in RAM.
145 * TODO: why not just add gd->reloc_ofs? 143 * TODO: why not just add gd->reloc_ofs?
146 */ 144 */
147 gd->arch.cpu += gd->relocaddr - CONFIG_SYS_MONITOR_BASE; 145 gd->arch.cpu += gd->relocaddr - CONFIG_SYS_MONITOR_BASE;
148 146
149 /* 147 /*
150 * If we didn't know the cpu mask & # cores, we can save them of 148 * If we didn't know the cpu mask & # cores, we can save them of
151 * now rather than 'computing' them constantly 149 * now rather than 'computing' them constantly
152 */ 150 */
153 fixup_cpu(); 151 fixup_cpu();
154 #endif 152 #endif
155 #ifdef CONFIG_SYS_EXTRA_ENV_RELOC 153 #ifdef CONFIG_SYS_EXTRA_ENV_RELOC
156 /* 154 /*
157 * Some systems need to relocate the env_addr pointer early because the 155 * Some systems need to relocate the env_addr pointer early because the
158 * location it points to will get invalidated before env_relocate is 156 * location it points to will get invalidated before env_relocate is
159 * called. One example is on systems that might use a L2 or L3 cache 157 * called. One example is on systems that might use a L2 or L3 cache
160 * in SRAM mode and initialize that cache from SRAM mode back to being 158 * in SRAM mode and initialize that cache from SRAM mode back to being
161 * a cache in cpu_init_r. 159 * a cache in cpu_init_r.
162 */ 160 */
163 gd->env_addr += gd->relocaddr - CONFIG_SYS_MONITOR_BASE; 161 gd->env_addr += gd->relocaddr - CONFIG_SYS_MONITOR_BASE;
164 #endif 162 #endif
165 #ifdef CONFIG_OF_EMBED 163 #ifdef CONFIG_OF_EMBED
166 /* 164 /*
167 * The fdt_blob needs to be moved to new relocation address 165 * The fdt_blob needs to be moved to new relocation address
168 * incase of FDT blob is embedded with in image 166 * incase of FDT blob is embedded with in image
169 */ 167 */
170 gd->fdt_blob += gd->reloc_off; 168 gd->fdt_blob += gd->reloc_off;
171 #endif 169 #endif
172 #ifdef CONFIG_EFI_LOADER 170 #ifdef CONFIG_EFI_LOADER
173 efi_runtime_relocate(gd->relocaddr, NULL); 171 efi_runtime_relocate(gd->relocaddr, NULL);
174 #endif 172 #endif
175 173
176 return 0; 174 return 0;
177 } 175 }
178 176
179 static int initr_serial(void) 177 static int initr_serial(void)
180 { 178 {
181 serial_initialize(); 179 serial_initialize();
182 return 0; 180 return 0;
183 } 181 }
184 182
185 #if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_MIPS) 183 #if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_MIPS)
186 static int initr_trap(void) 184 static int initr_trap(void)
187 { 185 {
188 /* 186 /*
189 * Setup trap handlers 187 * Setup trap handlers
190 */ 188 */
191 #if defined(CONFIG_PPC) 189 #if defined(CONFIG_PPC)
192 trap_init(gd->relocaddr); 190 trap_init(gd->relocaddr);
193 #else 191 #else
194 trap_init(CONFIG_SYS_SDRAM_BASE); 192 trap_init(CONFIG_SYS_SDRAM_BASE);
195 #endif 193 #endif
196 return 0; 194 return 0;
197 } 195 }
198 #endif 196 #endif
199 197
200 #ifdef CONFIG_ADDR_MAP 198 #ifdef CONFIG_ADDR_MAP
201 static int initr_addr_map(void) 199 static int initr_addr_map(void)
202 { 200 {
203 init_addr_map(); 201 init_addr_map();
204 202
205 return 0; 203 return 0;
206 } 204 }
207 #endif 205 #endif
208 206
209 #ifdef CONFIG_LOGBUFFER 207 #ifdef CONFIG_LOGBUFFER
210 unsigned long logbuffer_base(void) 208 unsigned long logbuffer_base(void)
211 { 209 {
212 return gd->ram_top - LOGBUFF_LEN; 210 return gd->ram_top - LOGBUFF_LEN;
213 } 211 }
214 212
215 static int initr_logbuffer(void) 213 static int initr_logbuffer(void)
216 { 214 {
217 logbuff_init_ptrs(); 215 logbuff_init_ptrs();
218 return 0; 216 return 0;
219 } 217 }
220 #endif 218 #endif
221 219
222 #ifdef CONFIG_POST 220 #ifdef CONFIG_POST
223 static int initr_post_backlog(void) 221 static int initr_post_backlog(void)
224 { 222 {
225 post_output_backlog(); 223 post_output_backlog();
226 return 0; 224 return 0;
227 } 225 }
228 #endif 226 #endif
229 227
230 #ifdef CONFIG_SYS_DELAYED_ICACHE 228 #ifdef CONFIG_SYS_DELAYED_ICACHE
231 static int initr_icache_enable(void) 229 static int initr_icache_enable(void)
232 { 230 {
233 return 0; 231 return 0;
234 } 232 }
235 #endif 233 #endif
236 234
237 #if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500) 235 #if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500)
238 static int initr_unlock_ram_in_cache(void) 236 static int initr_unlock_ram_in_cache(void)
239 { 237 {
240 unlock_ram_in_cache(); /* it's time to unlock D-cache in e500 */ 238 unlock_ram_in_cache(); /* it's time to unlock D-cache in e500 */
241 return 0; 239 return 0;
242 } 240 }
243 #endif 241 #endif
244 242
245 #ifdef CONFIG_PCI 243 #ifdef CONFIG_PCI
246 static int initr_pci(void) 244 static int initr_pci(void)
247 { 245 {
248 #ifndef CONFIG_DM_PCI 246 #ifndef CONFIG_DM_PCI
249 pci_init(); 247 pci_init();
250 #endif 248 #endif
251 249
252 return 0; 250 return 0;
253 } 251 }
254 #endif 252 #endif
255 253
256 static int initr_barrier(void) 254 static int initr_barrier(void)
257 { 255 {
258 #ifdef CONFIG_PPC 256 #ifdef CONFIG_PPC
259 /* TODO: Can we not use dmb() macros for this? */ 257 /* TODO: Can we not use dmb() macros for this? */
260 asm("sync ; isync"); 258 asm("sync ; isync");
261 #endif 259 #endif
262 return 0; 260 return 0;
263 } 261 }
264 262
265 static int initr_malloc(void) 263 static int initr_malloc(void)
266 { 264 {
267 ulong malloc_start; 265 ulong malloc_start;
268 266
269 #ifdef CONFIG_SYS_MALLOC_F_LEN 267 #ifdef CONFIG_SYS_MALLOC_F_LEN
270 debug("Pre-reloc malloc() used %#lx bytes (%ld KB)\n", gd->malloc_ptr, 268 debug("Pre-reloc malloc() used %#lx bytes (%ld KB)\n", gd->malloc_ptr,
271 gd->malloc_ptr / 1024); 269 gd->malloc_ptr / 1024);
272 #endif 270 #endif
273 /* The malloc area is immediately below the monitor copy in DRAM */ 271 /* The malloc area is immediately below the monitor copy in DRAM */
274 malloc_start = gd->relocaddr - TOTAL_MALLOC_LEN; 272 malloc_start = gd->relocaddr - TOTAL_MALLOC_LEN;
275 mem_malloc_init((ulong)map_sysmem(malloc_start, TOTAL_MALLOC_LEN), 273 mem_malloc_init((ulong)map_sysmem(malloc_start, TOTAL_MALLOC_LEN),
276 TOTAL_MALLOC_LEN); 274 TOTAL_MALLOC_LEN);
277 return 0; 275 return 0;
278 } 276 }
279 277
280 static int initr_console_record(void) 278 static int initr_console_record(void)
281 { 279 {
282 #if defined(CONFIG_CONSOLE_RECORD) 280 #if defined(CONFIG_CONSOLE_RECORD)
283 return console_record_init(); 281 return console_record_init();
284 #else 282 #else
285 return 0; 283 return 0;
286 #endif 284 #endif
287 } 285 }
288 286
289 #ifdef CONFIG_SYS_NONCACHED_MEMORY 287 #ifdef CONFIG_SYS_NONCACHED_MEMORY
290 static int initr_noncached(void) 288 static int initr_noncached(void)
291 { 289 {
292 noncached_init(); 290 noncached_init();
293 return 0; 291 return 0;
294 } 292 }
295 #endif 293 #endif
296 294
297 #ifdef CONFIG_DM 295 #ifdef CONFIG_DM
298 static int initr_dm(void) 296 static int initr_dm(void)
299 { 297 {
300 int ret; 298 int ret;
301 299
302 /* Save the pre-reloc driver model and start a new one */ 300 /* Save the pre-reloc driver model and start a new one */
303 gd->dm_root_f = gd->dm_root; 301 gd->dm_root_f = gd->dm_root;
304 gd->dm_root = NULL; 302 gd->dm_root = NULL;
305 #ifdef CONFIG_TIMER 303 #ifdef CONFIG_TIMER
306 gd->timer = NULL; 304 gd->timer = NULL;
307 #endif 305 #endif
308 ret = dm_init_and_scan(false); 306 ret = dm_init_and_scan(false);
309 if (ret) 307 if (ret)
310 return ret; 308 return ret;
311 #ifdef CONFIG_TIMER_EARLY 309 #ifdef CONFIG_TIMER_EARLY
312 ret = dm_timer_init(); 310 ret = dm_timer_init();
313 if (ret) 311 if (ret)
314 return ret; 312 return ret;
315 #endif 313 #endif
316 314
317 return 0; 315 return 0;
318 } 316 }
319 #endif 317 #endif
320 318
321 static int initr_bootstage(void) 319 static int initr_bootstage(void)
322 { 320 {
323 /* We cannot do this before initr_dm() */ 321 /* We cannot do this before initr_dm() */
324 bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_R, "board_init_r"); 322 bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_R, "board_init_r");
325 323
326 return 0; 324 return 0;
327 } 325 }
328 326
329 __weak int power_init_board(void) 327 __weak int power_init_board(void)
330 { 328 {
331 return 0; 329 return 0;
332 } 330 }
333 331
334 static int initr_announce(void) 332 static int initr_announce(void)
335 { 333 {
336 debug("Now running in RAM - U-Boot at: %08lx\n", gd->relocaddr); 334 debug("Now running in RAM - U-Boot at: %08lx\n", gd->relocaddr);
337 return 0; 335 return 0;
338 } 336 }
339 337
340 #ifdef CONFIG_NEEDS_MANUAL_RELOC 338 #ifdef CONFIG_NEEDS_MANUAL_RELOC
341 static int initr_manual_reloc_cmdtable(void) 339 static int initr_manual_reloc_cmdtable(void)
342 { 340 {
343 fixup_cmdtable(ll_entry_start(cmd_tbl_t, cmd), 341 fixup_cmdtable(ll_entry_start(cmd_tbl_t, cmd),
344 ll_entry_count(cmd_tbl_t, cmd)); 342 ll_entry_count(cmd_tbl_t, cmd));
345 return 0; 343 return 0;
346 } 344 }
347 #endif 345 #endif
348 346
349 #if defined(CONFIG_MTD_NOR_FLASH) 347 #if defined(CONFIG_MTD_NOR_FLASH)
350 static int initr_flash(void) 348 static int initr_flash(void)
351 { 349 {
352 ulong flash_size = 0; 350 ulong flash_size = 0;
353 bd_t *bd = gd->bd; 351 bd_t *bd = gd->bd;
354 352
355 puts("Flash: "); 353 puts("Flash: ");
356 354
357 if (board_flash_wp_on()) 355 if (board_flash_wp_on())
358 printf("Uninitialized - Write Protect On\n"); 356 printf("Uninitialized - Write Protect On\n");
359 else 357 else
360 flash_size = flash_init(); 358 flash_size = flash_init();
361 359
362 print_size(flash_size, ""); 360 print_size(flash_size, "");
363 #ifdef CONFIG_SYS_FLASH_CHECKSUM 361 #ifdef CONFIG_SYS_FLASH_CHECKSUM
364 /* 362 /*
365 * Compute and print flash CRC if flashchecksum is set to 'y' 363 * Compute and print flash CRC if flashchecksum is set to 'y'
366 * 364 *
367 * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX 365 * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX
368 */ 366 */
369 if (getenv_yesno("flashchecksum") == 1) { 367 if (getenv_yesno("flashchecksum") == 1) {
370 printf(" CRC: %08X", crc32(0, 368 printf(" CRC: %08X", crc32(0,
371 (const unsigned char *) CONFIG_SYS_FLASH_BASE, 369 (const unsigned char *) CONFIG_SYS_FLASH_BASE,
372 flash_size)); 370 flash_size));
373 } 371 }
374 #endif /* CONFIG_SYS_FLASH_CHECKSUM */ 372 #endif /* CONFIG_SYS_FLASH_CHECKSUM */
375 putc('\n'); 373 putc('\n');
376 374
377 /* update start of FLASH memory */ 375 /* update start of FLASH memory */
378 #ifdef CONFIG_SYS_FLASH_BASE 376 #ifdef CONFIG_SYS_FLASH_BASE
379 bd->bi_flashstart = CONFIG_SYS_FLASH_BASE; 377 bd->bi_flashstart = CONFIG_SYS_FLASH_BASE;
380 #endif 378 #endif
381 /* size of FLASH memory (final value) */ 379 /* size of FLASH memory (final value) */
382 bd->bi_flashsize = flash_size; 380 bd->bi_flashsize = flash_size;
383 381
384 #if defined(CONFIG_SYS_UPDATE_FLASH_SIZE) 382 #if defined(CONFIG_SYS_UPDATE_FLASH_SIZE)
385 /* Make a update of the Memctrl. */ 383 /* Make a update of the Memctrl. */
386 update_flash_size(flash_size); 384 update_flash_size(flash_size);
387 #endif 385 #endif
388 386
389 387
390 #if defined(CONFIG_OXC) || defined(CONFIG_RMU) 388 #if defined(CONFIG_OXC) || defined(CONFIG_RMU)
391 /* flash mapped at end of memory map */ 389 /* flash mapped at end of memory map */
392 bd->bi_flashoffset = CONFIG_SYS_TEXT_BASE + flash_size; 390 bd->bi_flashoffset = CONFIG_SYS_TEXT_BASE + flash_size;
393 #elif CONFIG_SYS_MONITOR_BASE == CONFIG_SYS_FLASH_BASE 391 #elif CONFIG_SYS_MONITOR_BASE == CONFIG_SYS_FLASH_BASE
394 bd->bi_flashoffset = monitor_flash_len; /* reserved area for monitor */ 392 bd->bi_flashoffset = monitor_flash_len; /* reserved area for monitor */
395 #endif 393 #endif
396 return 0; 394 return 0;
397 } 395 }
398 #endif 396 #endif
399 397
400 #if defined(CONFIG_PPC) && !defined(CONFIG_DM_SPI) 398 #if defined(CONFIG_PPC) && !defined(CONFIG_DM_SPI)
401 static int initr_spi(void) 399 static int initr_spi(void)
402 { 400 {
403 /* PPC does this here */ 401 /* PPC does this here */
404 #ifdef CONFIG_SPI 402 #ifdef CONFIG_SPI
405 #if !defined(CONFIG_ENV_IS_IN_EEPROM) 403 #if !defined(CONFIG_ENV_IS_IN_EEPROM)
406 spi_init_f(); 404 spi_init_f();
407 #endif 405 #endif
408 spi_init_r(); 406 spi_init_r();
409 #endif 407 #endif
410 return 0; 408 return 0;
411 } 409 }
412 #endif 410 #endif
413 411
414 #ifdef CONFIG_CMD_NAND 412 #ifdef CONFIG_CMD_NAND
415 /* go init the NAND */ 413 /* go init the NAND */
416 static int initr_nand(void) 414 static int initr_nand(void)
417 { 415 {
418 puts("NAND: "); 416 puts("NAND: ");
419 nand_init(); 417 nand_init();
420 printf("%lu MiB\n", nand_size() / 1024); 418 printf("%lu MiB\n", nand_size() / 1024);
421 return 0; 419 return 0;
422 } 420 }
423 #endif 421 #endif
424 422
425 #if defined(CONFIG_CMD_ONENAND) 423 #if defined(CONFIG_CMD_ONENAND)
426 /* go init the NAND */ 424 /* go init the NAND */
427 static int initr_onenand(void) 425 static int initr_onenand(void)
428 { 426 {
429 puts("NAND: "); 427 puts("NAND: ");
430 onenand_init(); 428 onenand_init();
431 return 0; 429 return 0;
432 } 430 }
433 #endif 431 #endif
434 432
435 #ifdef CONFIG_MMC 433 #ifdef CONFIG_MMC
436 static int initr_mmc(void) 434 static int initr_mmc(void)
437 { 435 {
438 puts("MMC: "); 436 puts("MMC: ");
439 mmc_initialize(gd->bd); 437 mmc_initialize(gd->bd);
440 return 0; 438 return 0;
441 } 439 }
442 #endif 440 #endif
443 441
444 #ifdef CONFIG_HAS_DATAFLASH 442 #ifdef CONFIG_HAS_DATAFLASH
445 static int initr_dataflash(void) 443 static int initr_dataflash(void)
446 { 444 {
447 AT91F_DataflashInit(); 445 AT91F_DataflashInit();
448 dataflash_print_info(); 446 dataflash_print_info();
449 return 0; 447 return 0;
450 } 448 }
451 #endif 449 #endif
452 450
453 /* 451 /*
454 * Tell if it's OK to load the environment early in boot. 452 * Tell if it's OK to load the environment early in boot.
455 * 453 *
456 * If CONFIG_OF_CONTROL is defined, we'll check with the FDT to see 454 * If CONFIG_OF_CONTROL is defined, we'll check with the FDT to see
457 * if this is OK (defaulting to saying it's OK). 455 * if this is OK (defaulting to saying it's OK).
458 * 456 *
459 * NOTE: Loading the environment early can be a bad idea if security is 457 * NOTE: Loading the environment early can be a bad idea if security is
460 * important, since no verification is done on the environment. 458 * important, since no verification is done on the environment.
461 * 459 *
462 * @return 0 if environment should not be loaded, !=0 if it is ok to load 460 * @return 0 if environment should not be loaded, !=0 if it is ok to load
463 */ 461 */
464 static int should_load_env(void) 462 static int should_load_env(void)
465 { 463 {
466 #ifdef CONFIG_OF_CONTROL 464 #ifdef CONFIG_OF_CONTROL
467 return fdtdec_get_config_int(gd->fdt_blob, "load-environment", 1); 465 return fdtdec_get_config_int(gd->fdt_blob, "load-environment", 1);
468 #elif defined CONFIG_DELAY_ENVIRONMENT 466 #elif defined CONFIG_DELAY_ENVIRONMENT
469 return 0; 467 return 0;
470 #else 468 #else
471 return 1; 469 return 1;
472 #endif 470 #endif
473 } 471 }
474 472
475 static int initr_env(void) 473 static int initr_env(void)
476 { 474 {
477 /* initialize environment */ 475 /* initialize environment */
478 if (should_load_env()) 476 if (should_load_env())
479 env_relocate(); 477 env_relocate();
480 else 478 else
481 set_default_env(NULL); 479 set_default_env(NULL);
482 #ifdef CONFIG_OF_CONTROL 480 #ifdef CONFIG_OF_CONTROL
483 setenv_addr("fdtcontroladdr", gd->fdt_blob); 481 setenv_addr("fdtcontroladdr", gd->fdt_blob);
484 #endif 482 #endif
485 483
486 /* Initialize from environment */ 484 /* Initialize from environment */
487 load_addr = getenv_ulong("loadaddr", 16, load_addr); 485 load_addr = getenv_ulong("loadaddr", 16, load_addr);
488 486
489 return 0; 487 return 0;
490 } 488 }
491 489
492 #ifdef CONFIG_SYS_BOOTPARAMS_LEN 490 #ifdef CONFIG_SYS_BOOTPARAMS_LEN
493 static int initr_malloc_bootparams(void) 491 static int initr_malloc_bootparams(void)
494 { 492 {
495 gd->bd->bi_boot_params = (ulong)malloc(CONFIG_SYS_BOOTPARAMS_LEN); 493 gd->bd->bi_boot_params = (ulong)malloc(CONFIG_SYS_BOOTPARAMS_LEN);
496 if (!gd->bd->bi_boot_params) { 494 if (!gd->bd->bi_boot_params) {
497 puts("WARNING: Cannot allocate space for boot parameters\n"); 495 puts("WARNING: Cannot allocate space for boot parameters\n");
498 return -ENOMEM; 496 return -ENOMEM;
499 } 497 }
500 return 0; 498 return 0;
501 } 499 }
502 #endif 500 #endif
503 501
504 static int initr_jumptable(void) 502 static int initr_jumptable(void)
505 { 503 {
506 jumptable_init(); 504 jumptable_init();
507 return 0; 505 return 0;
508 } 506 }
509 507
510 #if defined(CONFIG_API) 508 #if defined(CONFIG_API)
511 static int initr_api(void) 509 static int initr_api(void)
512 { 510 {
513 /* Initialize API */ 511 /* Initialize API */
514 api_init(); 512 api_init();
515 return 0; 513 return 0;
516 } 514 }
517 #endif 515 #endif
518 516
519 /* enable exceptions */ 517 /* enable exceptions */
520 #if defined(CONFIG_ARM) || defined(CONFIG_AVR32) 518 #if defined(CONFIG_ARM) || defined(CONFIG_AVR32)
521 static int initr_enable_interrupts(void) 519 static int initr_enable_interrupts(void)
522 { 520 {
523 enable_interrupts(); 521 enable_interrupts();
524 return 0; 522 return 0;
525 } 523 }
526 #endif 524 #endif
527 525
528 #ifdef CONFIG_CMD_NET 526 #ifdef CONFIG_CMD_NET
529 static int initr_ethaddr(void) 527 static int initr_ethaddr(void)
530 { 528 {
531 bd_t *bd = gd->bd; 529 bd_t *bd = gd->bd;
532 530
533 /* kept around for legacy kernels only ... ignore the next section */ 531 /* kept around for legacy kernels only ... ignore the next section */
534 eth_getenv_enetaddr("ethaddr", bd->bi_enetaddr); 532 eth_getenv_enetaddr("ethaddr", bd->bi_enetaddr);
535 #ifdef CONFIG_HAS_ETH1 533 #ifdef CONFIG_HAS_ETH1
536 eth_getenv_enetaddr("eth1addr", bd->bi_enet1addr); 534 eth_getenv_enetaddr("eth1addr", bd->bi_enet1addr);
537 #endif 535 #endif
538 #ifdef CONFIG_HAS_ETH2 536 #ifdef CONFIG_HAS_ETH2
539 eth_getenv_enetaddr("eth2addr", bd->bi_enet2addr); 537 eth_getenv_enetaddr("eth2addr", bd->bi_enet2addr);
540 #endif 538 #endif
541 #ifdef CONFIG_HAS_ETH3 539 #ifdef CONFIG_HAS_ETH3
542 eth_getenv_enetaddr("eth3addr", bd->bi_enet3addr); 540 eth_getenv_enetaddr("eth3addr", bd->bi_enet3addr);
543 #endif 541 #endif
544 #ifdef CONFIG_HAS_ETH4 542 #ifdef CONFIG_HAS_ETH4
545 eth_getenv_enetaddr("eth4addr", bd->bi_enet4addr); 543 eth_getenv_enetaddr("eth4addr", bd->bi_enet4addr);
546 #endif 544 #endif
547 #ifdef CONFIG_HAS_ETH5 545 #ifdef CONFIG_HAS_ETH5
548 eth_getenv_enetaddr("eth5addr", bd->bi_enet5addr); 546 eth_getenv_enetaddr("eth5addr", bd->bi_enet5addr);
549 #endif 547 #endif
550 return 0; 548 return 0;
551 } 549 }
552 #endif /* CONFIG_CMD_NET */ 550 #endif /* CONFIG_CMD_NET */
553 551
554 #ifdef CONFIG_CMD_KGDB 552 #ifdef CONFIG_CMD_KGDB
555 static int initr_kgdb(void) 553 static int initr_kgdb(void)
556 { 554 {
557 puts("KGDB: "); 555 puts("KGDB: ");
558 kgdb_init(); 556 kgdb_init();
559 return 0; 557 return 0;
560 } 558 }
561 #endif 559 #endif
562 560
563 #if defined(CONFIG_LED_STATUS) 561 #if defined(CONFIG_LED_STATUS)
564 static int initr_status_led(void) 562 static int initr_status_led(void)
565 { 563 {
566 #if defined(CONFIG_LED_STATUS_BOOT) 564 #if defined(CONFIG_LED_STATUS_BOOT)
567 status_led_set(CONFIG_LED_STATUS_BOOT, CONFIG_LED_STATUS_BLINKING); 565 status_led_set(CONFIG_LED_STATUS_BOOT, CONFIG_LED_STATUS_BLINKING);
568 #else 566 #else
569 status_led_init(); 567 status_led_init();
570 #endif 568 #endif
571 return 0; 569 return 0;
572 } 570 }
573 #endif 571 #endif
574 572
575 #if defined(CONFIG_SCSI) && !defined(CONFIG_DM_SCSI) 573 #if defined(CONFIG_SCSI) && !defined(CONFIG_DM_SCSI)
576 static int initr_scsi(void) 574 static int initr_scsi(void)
577 { 575 {
578 puts("SCSI: "); 576 puts("SCSI: ");
579 scsi_init(); 577 scsi_init();
580 578
581 return 0; 579 return 0;
582 } 580 }
583 #endif 581 #endif
584 582
585 #ifdef CONFIG_BITBANGMII 583 #ifdef CONFIG_BITBANGMII
586 static int initr_bbmii(void) 584 static int initr_bbmii(void)
587 { 585 {
588 bb_miiphy_init(); 586 bb_miiphy_init();
589 return 0; 587 return 0;
590 } 588 }
591 #endif 589 #endif
592 590
593 #ifdef CONFIG_CMD_NET 591 #ifdef CONFIG_CMD_NET
594 static int initr_net(void) 592 static int initr_net(void)
595 { 593 {
596 puts("Net: "); 594 puts("Net: ");
597 eth_initialize(); 595 eth_initialize();
598 #if defined(CONFIG_RESET_PHY_R) 596 #if defined(CONFIG_RESET_PHY_R)
599 debug("Reset Ethernet PHY\n"); 597 debug("Reset Ethernet PHY\n");
600 reset_phy(); 598 reset_phy();
601 #endif 599 #endif
602 return 0; 600 return 0;
603 } 601 }
604 #endif 602 #endif
605 603
606 #ifdef CONFIG_POST 604 #ifdef CONFIG_POST
607 static int initr_post(void) 605 static int initr_post(void)
608 { 606 {
609 post_run(NULL, POST_RAM | post_bootmode_get(0)); 607 post_run(NULL, POST_RAM | post_bootmode_get(0));
610 return 0; 608 return 0;
611 } 609 }
612 #endif 610 #endif
613 611
614 #if defined(CONFIG_CMD_PCMCIA) && !defined(CONFIG_CMD_IDE) 612 #if defined(CONFIG_CMD_PCMCIA) && !defined(CONFIG_IDE)
615 static int initr_pcmcia(void) 613 static int initr_pcmcia(void)
616 { 614 {
617 puts("PCMCIA:"); 615 puts("PCMCIA:");
618 pcmcia_init(); 616 pcmcia_init();
619 return 0; 617 return 0;
620 } 618 }
621 #endif 619 #endif
622 620
623 #if defined(CONFIG_CMD_IDE) 621 #if defined(CONFIG_IDE)
624 static int initr_ide(void) 622 static int initr_ide(void)
625 { 623 {
626 #ifdef CONFIG_IDE_8xx_PCCARD 624 #ifdef CONFIG_IDE_8xx_PCCARD
627 puts("PCMCIA:"); 625 puts("PCMCIA:");
628 #else 626 #else
629 puts("IDE: "); 627 puts("IDE: ");
630 #endif 628 #endif
631 #if defined(CONFIG_START_IDE) 629 #if defined(CONFIG_START_IDE)
632 if (board_start_ide()) 630 if (board_start_ide())
633 ide_init(); 631 ide_init();
634 #else 632 #else
635 ide_init(); 633 ide_init();
636 #endif 634 #endif
637 return 0; 635 return 0;
638 } 636 }
639 #endif 637 #endif
640 638
641 #if defined(CONFIG_PRAM) || defined(CONFIG_LOGBUFFER) 639 #if defined(CONFIG_PRAM) || defined(CONFIG_LOGBUFFER)
642 /* 640 /*
643 * Export available size of memory for Linux, taking into account the 641 * Export available size of memory for Linux, taking into account the
644 * protected RAM at top of memory 642 * protected RAM at top of memory
645 */ 643 */
646 int initr_mem(void) 644 int initr_mem(void)
647 { 645 {
648 ulong pram = 0; 646 ulong pram = 0;
649 char memsz[32]; 647 char memsz[32];
650 648
651 # ifdef CONFIG_PRAM 649 # ifdef CONFIG_PRAM
652 pram = getenv_ulong("pram", 10, CONFIG_PRAM); 650 pram = getenv_ulong("pram", 10, CONFIG_PRAM);
653 # endif 651 # endif
654 # if defined(CONFIG_LOGBUFFER) && !defined(CONFIG_ALT_LB_ADDR) 652 # if defined(CONFIG_LOGBUFFER) && !defined(CONFIG_ALT_LB_ADDR)
655 /* Also take the logbuffer into account (pram is in kB) */ 653 /* Also take the logbuffer into account (pram is in kB) */
656 pram += (LOGBUFF_LEN + LOGBUFF_OVERHEAD) / 1024; 654 pram += (LOGBUFF_LEN + LOGBUFF_OVERHEAD) / 1024;
657 # endif 655 # endif
658 sprintf(memsz, "%ldk", (long int) ((gd->ram_size / 1024) - pram)); 656 sprintf(memsz, "%ldk", (long int) ((gd->ram_size / 1024) - pram));
659 setenv("mem", memsz); 657 setenv("mem", memsz);
660 658
661 return 0; 659 return 0;
662 } 660 }
663 #endif 661 #endif
664 662
665 #ifdef CONFIG_CMD_BEDBUG 663 #ifdef CONFIG_CMD_BEDBUG
666 static int initr_bedbug(void) 664 static int initr_bedbug(void)
667 { 665 {
668 bedbug_init(); 666 bedbug_init();
669 667
670 return 0; 668 return 0;
671 } 669 }
672 #endif 670 #endif
673 671
674 #ifdef CONFIG_PS2KBD 672 #ifdef CONFIG_PS2KBD
675 static int initr_kbd(void) 673 static int initr_kbd(void)
676 { 674 {
677 puts("PS/2: "); 675 puts("PS/2: ");
678 kbd_init(); 676 kbd_init();
679 return 0; 677 return 0;
680 } 678 }
681 #endif 679 #endif
682 680
683 static int run_main_loop(void) 681 static int run_main_loop(void)
684 { 682 {
685 #ifdef CONFIG_SANDBOX 683 #ifdef CONFIG_SANDBOX
686 sandbox_main_loop_init(); 684 sandbox_main_loop_init();
687 #endif 685 #endif
688 /* main_loop() can return to retry autoboot, if so just run it again */ 686 /* main_loop() can return to retry autoboot, if so just run it again */
689 for (;;) 687 for (;;)
690 main_loop(); 688 main_loop();
691 return 0; 689 return 0;
692 } 690 }
693 691
694 /* 692 /*
695 * Over time we hope to remove these functions with code fragments and 693 * Over time we hope to remove these functions with code fragments and
696 * stub funtcions, and instead call the relevant function directly. 694 * stub funtcions, and instead call the relevant function directly.
697 * 695 *
698 * We also hope to remove most of the driver-related init and do it if/when 696 * We also hope to remove most of the driver-related init and do it if/when
699 * the driver is later used. 697 * the driver is later used.
700 * 698 *
701 * TODO: perhaps reset the watchdog in the initcall function after each call? 699 * TODO: perhaps reset the watchdog in the initcall function after each call?
702 */ 700 */
703 static init_fnc_t init_sequence_r[] = { 701 static init_fnc_t init_sequence_r[] = {
704 initr_trace, 702 initr_trace,
705 initr_reloc, 703 initr_reloc,
706 /* TODO: could x86/PPC have this also perhaps? */ 704 /* TODO: could x86/PPC have this also perhaps? */
707 #ifdef CONFIG_ARM 705 #ifdef CONFIG_ARM
708 initr_caches, 706 initr_caches,
709 /* Note: For Freescale LS2 SoCs, new MMU table is created in DDR. 707 /* Note: For Freescale LS2 SoCs, new MMU table is created in DDR.
710 * A temporary mapping of IFC high region is since removed, 708 * A temporary mapping of IFC high region is since removed,
711 * so environmental variables in NOR flash is not availble 709 * so environmental variables in NOR flash is not availble
712 * until board_init() is called below to remap IFC to high 710 * until board_init() is called below to remap IFC to high
713 * region. 711 * region.
714 */ 712 */
715 #endif 713 #endif
716 initr_reloc_global_data, 714 initr_reloc_global_data,
717 #if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500) 715 #if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500)
718 initr_unlock_ram_in_cache, 716 initr_unlock_ram_in_cache,
719 #endif 717 #endif
720 initr_barrier, 718 initr_barrier,
721 initr_malloc, 719 initr_malloc,
722 initr_console_record, 720 initr_console_record,
723 #ifdef CONFIG_SYS_NONCACHED_MEMORY 721 #ifdef CONFIG_SYS_NONCACHED_MEMORY
724 initr_noncached, 722 initr_noncached,
725 #endif 723 #endif
726 bootstage_relocate, 724 bootstage_relocate,
727 #ifdef CONFIG_DM 725 #ifdef CONFIG_DM
728 initr_dm, 726 initr_dm,
729 #endif 727 #endif
730 initr_bootstage, 728 initr_bootstage,
731 #if defined(CONFIG_ARM) || defined(CONFIG_NDS32) 729 #if defined(CONFIG_ARM) || defined(CONFIG_NDS32)
732 board_init, /* Setup chipselects */ 730 board_init, /* Setup chipselects */
733 #endif 731 #endif
734 /* 732 /*
735 * TODO: printing of the clock inforamtion of the board is now 733 * TODO: printing of the clock inforamtion of the board is now
736 * implemented as part of bdinfo command. Currently only support for 734 * implemented as part of bdinfo command. Currently only support for
737 * davinci SOC's is added. Remove this check once all the board 735 * davinci SOC's is added. Remove this check once all the board
738 * implement this. 736 * implement this.
739 */ 737 */
740 #ifdef CONFIG_CLOCKS 738 #ifdef CONFIG_CLOCKS
741 set_cpu_clk_info, /* Setup clock information */ 739 set_cpu_clk_info, /* Setup clock information */
742 #endif 740 #endif
743 #ifdef CONFIG_EFI_LOADER 741 #ifdef CONFIG_EFI_LOADER
744 efi_memory_init, 742 efi_memory_init,
745 #endif 743 #endif
746 stdio_init_tables, 744 stdio_init_tables,
747 initr_serial, 745 initr_serial,
748 initr_announce, 746 initr_announce,
749 INIT_FUNC_WATCHDOG_RESET 747 INIT_FUNC_WATCHDOG_RESET
750 #ifdef CONFIG_NEEDS_MANUAL_RELOC 748 #ifdef CONFIG_NEEDS_MANUAL_RELOC
751 initr_manual_reloc_cmdtable, 749 initr_manual_reloc_cmdtable,
752 #endif 750 #endif
753 #if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_MIPS) 751 #if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_MIPS)
754 initr_trap, 752 initr_trap,
755 #endif 753 #endif
756 #ifdef CONFIG_ADDR_MAP 754 #ifdef CONFIG_ADDR_MAP
757 initr_addr_map, 755 initr_addr_map,
758 #endif 756 #endif
759 #if defined(CONFIG_BOARD_EARLY_INIT_R) 757 #if defined(CONFIG_BOARD_EARLY_INIT_R)
760 board_early_init_r, 758 board_early_init_r,
761 #endif 759 #endif
762 INIT_FUNC_WATCHDOG_RESET 760 INIT_FUNC_WATCHDOG_RESET
763 #ifdef CONFIG_LOGBUFFER 761 #ifdef CONFIG_LOGBUFFER
764 initr_logbuffer, 762 initr_logbuffer,
765 #endif 763 #endif
766 #ifdef CONFIG_POST 764 #ifdef CONFIG_POST
767 initr_post_backlog, 765 initr_post_backlog,
768 #endif 766 #endif
769 INIT_FUNC_WATCHDOG_RESET 767 INIT_FUNC_WATCHDOG_RESET
770 #ifdef CONFIG_SYS_DELAYED_ICACHE 768 #ifdef CONFIG_SYS_DELAYED_ICACHE
771 initr_icache_enable, 769 initr_icache_enable,
772 #endif 770 #endif
773 #if defined(CONFIG_PCI) && defined(CONFIG_SYS_EARLY_PCI_INIT) 771 #if defined(CONFIG_PCI) && defined(CONFIG_SYS_EARLY_PCI_INIT)
774 /* 772 /*
775 * Do early PCI configuration _before_ the flash gets initialised, 773 * Do early PCI configuration _before_ the flash gets initialised,
776 * because PCU ressources are crucial for flash access on some boards. 774 * because PCU ressources are crucial for flash access on some boards.
777 */ 775 */
778 initr_pci, 776 initr_pci,
779 #endif 777 #endif
780 #ifdef CONFIG_ARCH_EARLY_INIT_R 778 #ifdef CONFIG_ARCH_EARLY_INIT_R
781 arch_early_init_r, 779 arch_early_init_r,
782 #endif 780 #endif
783 power_init_board, 781 power_init_board,
784 #ifdef CONFIG_MTD_NOR_FLASH 782 #ifdef CONFIG_MTD_NOR_FLASH
785 initr_flash, 783 initr_flash,
786 #endif 784 #endif
787 INIT_FUNC_WATCHDOG_RESET 785 INIT_FUNC_WATCHDOG_RESET
788 #if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_X86) 786 #if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_X86)
789 /* initialize higher level parts of CPU like time base and timers */ 787 /* initialize higher level parts of CPU like time base and timers */
790 cpu_init_r, 788 cpu_init_r,
791 #endif 789 #endif
792 #ifdef CONFIG_PPC 790 #ifdef CONFIG_PPC
793 initr_spi, 791 initr_spi,
794 #endif 792 #endif
795 #ifdef CONFIG_CMD_NAND 793 #ifdef CONFIG_CMD_NAND
796 initr_nand, 794 initr_nand,
797 #endif 795 #endif
798 #ifdef CONFIG_CMD_ONENAND 796 #ifdef CONFIG_CMD_ONENAND
799 initr_onenand, 797 initr_onenand,
800 #endif 798 #endif
801 #ifdef CONFIG_MMC 799 #ifdef CONFIG_MMC
802 initr_mmc, 800 initr_mmc,
803 #endif 801 #endif
804 #ifdef CONFIG_HAS_DATAFLASH 802 #ifdef CONFIG_HAS_DATAFLASH
805 initr_dataflash, 803 initr_dataflash,
806 #endif 804 #endif
807 initr_env, 805 initr_env,
808 #ifdef CONFIG_SYS_BOOTPARAMS_LEN 806 #ifdef CONFIG_SYS_BOOTPARAMS_LEN
809 initr_malloc_bootparams, 807 initr_malloc_bootparams,
810 #endif 808 #endif
811 INIT_FUNC_WATCHDOG_RESET 809 INIT_FUNC_WATCHDOG_RESET
812 initr_secondary_cpu, 810 initr_secondary_cpu,
813 #if defined(CONFIG_ID_EEPROM) || defined(CONFIG_SYS_I2C_MAC_OFFSET) 811 #if defined(CONFIG_ID_EEPROM) || defined(CONFIG_SYS_I2C_MAC_OFFSET)
814 mac_read_from_eeprom, 812 mac_read_from_eeprom,
815 #endif 813 #endif
816 INIT_FUNC_WATCHDOG_RESET 814 INIT_FUNC_WATCHDOG_RESET
817 #if defined(CONFIG_PCI) && !defined(CONFIG_SYS_EARLY_PCI_INIT) 815 #if defined(CONFIG_PCI) && !defined(CONFIG_SYS_EARLY_PCI_INIT)
818 /* 816 /*
819 * Do pci configuration 817 * Do pci configuration
820 */ 818 */
821 initr_pci, 819 initr_pci,
822 #endif 820 #endif
823 stdio_add_devices, 821 stdio_add_devices,
824 initr_jumptable, 822 initr_jumptable,
825 #ifdef CONFIG_API 823 #ifdef CONFIG_API
826 initr_api, 824 initr_api,
827 #endif 825 #endif
828 console_init_r, /* fully init console as a device */ 826 console_init_r, /* fully init console as a device */
829 #ifdef CONFIG_DISPLAY_BOARDINFO_LATE 827 #ifdef CONFIG_DISPLAY_BOARDINFO_LATE
830 show_board_info, 828 show_board_info,
831 #endif 829 #endif
832 #ifdef CONFIG_ARCH_MISC_INIT 830 #ifdef CONFIG_ARCH_MISC_INIT
833 arch_misc_init, /* miscellaneous arch-dependent init */ 831 arch_misc_init, /* miscellaneous arch-dependent init */
834 #endif 832 #endif
835 #ifdef CONFIG_MISC_INIT_R 833 #ifdef CONFIG_MISC_INIT_R
836 misc_init_r, /* miscellaneous platform-dependent init */ 834 misc_init_r, /* miscellaneous platform-dependent init */
837 #endif 835 #endif
838 INIT_FUNC_WATCHDOG_RESET 836 INIT_FUNC_WATCHDOG_RESET
839 #ifdef CONFIG_CMD_KGDB 837 #ifdef CONFIG_CMD_KGDB
840 initr_kgdb, 838 initr_kgdb,
841 #endif 839 #endif
842 interrupt_init, 840 interrupt_init,
843 #if defined(CONFIG_ARM) || defined(CONFIG_AVR32) 841 #if defined(CONFIG_ARM) || defined(CONFIG_AVR32)
844 initr_enable_interrupts, 842 initr_enable_interrupts,
845 #endif 843 #endif
846 #if defined(CONFIG_MICROBLAZE) || defined(CONFIG_AVR32) || defined(CONFIG_M68K) 844 #if defined(CONFIG_MICROBLAZE) || defined(CONFIG_AVR32) || defined(CONFIG_M68K)
847 timer_init, /* initialize timer */ 845 timer_init, /* initialize timer */
848 #endif 846 #endif
849 #if defined(CONFIG_LED_STATUS) 847 #if defined(CONFIG_LED_STATUS)
850 initr_status_led, 848 initr_status_led,
851 #endif 849 #endif
852 /* PPC has a udelay(20) here dating from 2002. Why? */ 850 /* PPC has a udelay(20) here dating from 2002. Why? */
853 #ifdef CONFIG_CMD_NET 851 #ifdef CONFIG_CMD_NET
854 initr_ethaddr, 852 initr_ethaddr,
855 #endif 853 #endif
856 #ifdef CONFIG_BOARD_LATE_INIT 854 #ifdef CONFIG_BOARD_LATE_INIT
857 board_late_init, 855 board_late_init,
858 #endif 856 #endif
859 #if defined(CONFIG_SCSI) && !defined(CONFIG_DM_SCSI) 857 #if defined(CONFIG_SCSI) && !defined(CONFIG_DM_SCSI)
860 INIT_FUNC_WATCHDOG_RESET 858 INIT_FUNC_WATCHDOG_RESET
861 initr_scsi, 859 initr_scsi,
862 #endif 860 #endif
863 #ifdef CONFIG_BITBANGMII 861 #ifdef CONFIG_BITBANGMII
864 initr_bbmii, 862 initr_bbmii,
865 #endif 863 #endif
866 #ifdef CONFIG_CMD_NET 864 #ifdef CONFIG_CMD_NET
867 INIT_FUNC_WATCHDOG_RESET 865 INIT_FUNC_WATCHDOG_RESET
868 initr_net, 866 initr_net,
869 #endif 867 #endif
870 #ifdef CONFIG_POST 868 #ifdef CONFIG_POST
871 initr_post, 869 initr_post,
872 #endif 870 #endif
873 #if defined(CONFIG_CMD_PCMCIA) && !defined(CONFIG_CMD_IDE) 871 #if defined(CONFIG_CMD_PCMCIA) && !defined(CONFIG_IDE)
874 initr_pcmcia, 872 initr_pcmcia,
875 #endif 873 #endif
876 #if defined(CONFIG_CMD_IDE) 874 #if defined(CONFIG_IDE)
877 initr_ide, 875 initr_ide,
878 #endif 876 #endif
879 #ifdef CONFIG_LAST_STAGE_INIT 877 #ifdef CONFIG_LAST_STAGE_INIT
880 INIT_FUNC_WATCHDOG_RESET 878 INIT_FUNC_WATCHDOG_RESET
881 /* 879 /*
882 * Some parts can be only initialized if all others (like 880 * Some parts can be only initialized if all others (like
883 * Interrupts) are up and running (i.e. the PC-style ISA 881 * Interrupts) are up and running (i.e. the PC-style ISA
884 * keyboard). 882 * keyboard).
885 */ 883 */
886 last_stage_init, 884 last_stage_init,
887 #endif 885 #endif
888 #ifdef CONFIG_CMD_BEDBUG 886 #ifdef CONFIG_CMD_BEDBUG
889 INIT_FUNC_WATCHDOG_RESET 887 INIT_FUNC_WATCHDOG_RESET
890 initr_bedbug, 888 initr_bedbug,
891 #endif 889 #endif
892 #if defined(CONFIG_PRAM) || defined(CONFIG_LOGBUFFER) 890 #if defined(CONFIG_PRAM) || defined(CONFIG_LOGBUFFER)
893 initr_mem, 891 initr_mem,
894 #endif 892 #endif
895 #ifdef CONFIG_PS2KBD 893 #ifdef CONFIG_PS2KBD
896 initr_kbd, 894 initr_kbd,
897 #endif 895 #endif
898 run_main_loop, 896 run_main_loop,
899 }; 897 };
900 898
901 void board_init_r(gd_t *new_gd, ulong dest_addr) 899 void board_init_r(gd_t *new_gd, ulong dest_addr)
902 { 900 {
903 /* 901 /*
904 * Set up the new global data pointer. So far only x86 does this 902 * Set up the new global data pointer. So far only x86 does this
905 * here. 903 * here.
906 * TODO(sjg@chromium.org): Consider doing this for all archs, or 904 * TODO(sjg@chromium.org): Consider doing this for all archs, or
907 * dropping the new_gd parameter. 905 * dropping the new_gd parameter.
908 */ 906 */
909 #if CONFIG_IS_ENABLED(X86_64) 907 #if CONFIG_IS_ENABLED(X86_64)
910 arch_setup_gd(new_gd); 908 arch_setup_gd(new_gd);
911 #endif 909 #endif
912 910
913 #ifdef CONFIG_NEEDS_MANUAL_RELOC 911 #ifdef CONFIG_NEEDS_MANUAL_RELOC
914 int i; 912 int i;
915 #endif 913 #endif
916 914
917 #ifdef CONFIG_AVR32 915 #ifdef CONFIG_AVR32
918 mmu_init_r(dest_addr); 916 mmu_init_r(dest_addr);
919 #endif 917 #endif
920 918
921 #if !defined(CONFIG_X86) && !defined(CONFIG_ARM) && !defined(CONFIG_ARM64) 919 #if !defined(CONFIG_X86) && !defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
922 gd = new_gd; 920 gd = new_gd;
923 #endif 921 #endif
924 922
925 #ifdef CONFIG_NEEDS_MANUAL_RELOC 923 #ifdef CONFIG_NEEDS_MANUAL_RELOC
926 for (i = 0; i < ARRAY_SIZE(init_sequence_r); i++) 924 for (i = 0; i < ARRAY_SIZE(init_sequence_r); i++)
927 init_sequence_r[i] += gd->reloc_off; 925 init_sequence_r[i] += gd->reloc_off;
928 #endif 926 #endif
929 927
930 if (initcall_run_list(init_sequence_r)) 928 if (initcall_run_list(init_sequence_r))
931 hang(); 929 hang();
932 930
933 /* NOTREACHED - run_main_loop() does not return */ 931 /* NOTREACHED - run_main_loop() does not return */
934 hang(); 932 hang();
935 } 933 }
936 934
common/ide.c
1 /* File was deleted
2 * (C) Copyright 2000-2011
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8 #include <common.h>
9 #include <ata.h>
10 #include <dm.h>
11 #include <ide.h>
12 #include <watchdog.h>
13 #include <asm/io.h>
14
15 #ifdef __PPC__
16 # define EIEIO __asm__ volatile ("eieio")
17 # define SYNC __asm__ volatile ("sync")
18 #else
19 # define EIEIO /* nothing */
20 # define SYNC /* nothing */
21 #endif
22
23 /* Current offset for IDE0 / IDE1 bus access */
24 ulong ide_bus_offset[CONFIG_SYS_IDE_MAXBUS] = {
25 #if defined(CONFIG_SYS_ATA_IDE0_OFFSET)
26 CONFIG_SYS_ATA_IDE0_OFFSET,
27 #endif
28 #if defined(CONFIG_SYS_ATA_IDE1_OFFSET) && (CONFIG_SYS_IDE_MAXBUS > 1)
29 CONFIG_SYS_ATA_IDE1_OFFSET,
30 #endif
31 };
32
33 static int ide_bus_ok[CONFIG_SYS_IDE_MAXBUS];
34
35 struct blk_desc ide_dev_desc[CONFIG_SYS_IDE_MAXDEVICE];
36
37 #define IDE_TIME_OUT 2000 /* 2 sec timeout */
38
39 #define ATAPI_TIME_OUT 7000 /* 7 sec timeout (5 sec seems to work...) */
40
41 #define IDE_SPIN_UP_TIME_OUT 5000 /* 5 sec spin-up timeout */
42
43 #ifndef CONFIG_SYS_ATA_PORT_ADDR
44 #define CONFIG_SYS_ATA_PORT_ADDR(port) (port)
45 #endif
46
47 #ifndef CONFIG_IDE_LED /* define LED macros, they are not used anyways */
48 # define DEVICE_LED(x) 0
49 # define LED_IDE1 1
50 # define LED_IDE2 2
51 #endif
52
53 #ifdef CONFIG_IDE_RESET
54 extern void ide_set_reset(int idereset);
55
56 static void ide_reset(void)
57 {
58 int i;
59
60 for (i = 0; i < CONFIG_SYS_IDE_MAXBUS; ++i)
61 ide_bus_ok[i] = 0;
62 for (i = 0; i < CONFIG_SYS_IDE_MAXDEVICE; ++i)
63 ide_dev_desc[i].type = DEV_TYPE_UNKNOWN;
64
65 ide_set_reset(1); /* assert reset */
66
67 /* the reset signal shall be asserted for et least 25 us */
68 udelay(25);
69
70 WATCHDOG_RESET();
71
72 /* de-assert RESET signal */
73 ide_set_reset(0);
74
75 /* wait 250 ms */
76 for (i = 0; i < 250; ++i)
77 udelay(1000);
78 }
79 #else
80 #define ide_reset() /* dummy */
81 #endif /* CONFIG_IDE_RESET */
82
83 /*
84 * Wait until Busy bit is off, or timeout (in ms)
85 * Return last status
86 */
87 static uchar ide_wait(int dev, ulong t)
88 {
89 ulong delay = 10 * t; /* poll every 100 us */
90 uchar c;
91
92 while ((c = ide_inb(dev, ATA_STATUS)) & ATA_STAT_BUSY) {
93 udelay(100);
94 if (delay-- == 0)
95 break;
96 }
97 return c;
98 }
99
100 /*
101 * copy src to dest, skipping leading and trailing blanks and null
102 * terminate the string
103 * "len" is the size of available memory including the terminating '\0'
104 */
105 static void ident_cpy(unsigned char *dst, unsigned char *src,
106 unsigned int len)
107 {
108 unsigned char *end, *last;
109
110 last = dst;
111 end = src + len - 1;
112
113 /* reserve space for '\0' */
114 if (len < 2)
115 goto OUT;
116
117 /* skip leading white space */
118 while ((*src) && (src < end) && (*src == ' '))
119 ++src;
120
121 /* copy string, omitting trailing white space */
122 while ((*src) && (src < end)) {
123 *dst++ = *src;
124 if (*src++ != ' ')
125 last = dst;
126 }
127 OUT:
128 *last = '\0';
129 }
130
131 #ifdef CONFIG_ATAPI
132 /****************************************************************************
133 * ATAPI Support
134 */
135
136 #if defined(CONFIG_IDE_SWAP_IO)
137 /* since ATAPI may use commands with not 4 bytes alligned length
138 * we have our own transfer functions, 2 bytes alligned */
139 __weak void ide_output_data_shorts(int dev, ushort *sect_buf, int shorts)
140 {
141 ushort *dbuf;
142 volatile ushort *pbuf;
143
144 pbuf = (ushort *)(ATA_CURR_BASE(dev) + ATA_DATA_REG);
145 dbuf = (ushort *)sect_buf;
146
147 debug("in output data shorts base for read is %lx\n",
148 (unsigned long) pbuf);
149
150 while (shorts--) {
151 EIEIO;
152 *pbuf = *dbuf++;
153 }
154 }
155
156 __weak void ide_input_data_shorts(int dev, ushort *sect_buf, int shorts)
157 {
158 ushort *dbuf;
159 volatile ushort *pbuf;
160
161 pbuf = (ushort *)(ATA_CURR_BASE(dev) + ATA_DATA_REG);
162 dbuf = (ushort *)sect_buf;
163
164 debug("in input data shorts base for read is %lx\n",
165 (unsigned long) pbuf);
166
167 while (shorts--) {
168 EIEIO;
169 *dbuf++ = *pbuf;
170 }
171 }
172
173 #else /* ! CONFIG_IDE_SWAP_IO */
174 __weak void ide_output_data_shorts(int dev, ushort *sect_buf, int shorts)
175 {
176 outsw(ATA_CURR_BASE(dev) + ATA_DATA_REG, sect_buf, shorts);
177 }
178
179 __weak void ide_input_data_shorts(int dev, ushort *sect_buf, int shorts)
180 {
181 insw(ATA_CURR_BASE(dev) + ATA_DATA_REG, sect_buf, shorts);
182 }
183
184 #endif /* CONFIG_IDE_SWAP_IO */
185
186 /*
187 * Wait until (Status & mask) == res, or timeout (in ms)
188 * Return last status
189 * This is used since some ATAPI CD ROMs clears their Busy Bit first
190 * and then they set their DRQ Bit
191 */
192 static uchar atapi_wait_mask(int dev, ulong t, uchar mask, uchar res)
193 {
194 ulong delay = 10 * t; /* poll every 100 us */
195 uchar c;
196
197 /* prevents to read the status before valid */
198 c = ide_inb(dev, ATA_DEV_CTL);
199
200 while (((c = ide_inb(dev, ATA_STATUS)) & mask) != res) {
201 /* break if error occurs (doesn't make sense to wait more) */
202 if ((c & ATA_STAT_ERR) == ATA_STAT_ERR)
203 break;
204 udelay(100);
205 if (delay-- == 0)
206 break;
207 }
208 return c;
209 }
210
211 /*
212 * issue an atapi command
213 */
214 unsigned char atapi_issue(int device, unsigned char *ccb, int ccblen,
215 unsigned char *buffer, int buflen)
216 {
217 unsigned char c, err, mask, res;
218 int n;
219
220 ide_led(DEVICE_LED(device), 1); /* LED on */
221
222 /* Select device
223 */
224 mask = ATA_STAT_BUSY | ATA_STAT_DRQ;
225 res = 0;
226 ide_outb(device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device));
227 c = atapi_wait_mask(device, ATAPI_TIME_OUT, mask, res);
228 if ((c & mask) != res) {
229 printf("ATAPI_ISSUE: device %d not ready status %X\n", device,
230 c);
231 err = 0xFF;
232 goto AI_OUT;
233 }
234 /* write taskfile */
235 ide_outb(device, ATA_ERROR_REG, 0); /* no DMA, no overlaped */
236 ide_outb(device, ATA_SECT_CNT, 0);
237 ide_outb(device, ATA_SECT_NUM, 0);
238 ide_outb(device, ATA_CYL_LOW, (unsigned char) (buflen & 0xFF));
239 ide_outb(device, ATA_CYL_HIGH,
240 (unsigned char) ((buflen >> 8) & 0xFF));
241 ide_outb(device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device));
242
243 ide_outb(device, ATA_COMMAND, ATAPI_CMD_PACKET);
244 udelay(50);
245
246 mask = ATA_STAT_DRQ | ATA_STAT_BUSY | ATA_STAT_ERR;
247 res = ATA_STAT_DRQ;
248 c = atapi_wait_mask(device, ATAPI_TIME_OUT, mask, res);
249
250 if ((c & mask) != res) { /* DRQ must be 1, BSY 0 */
251 printf("ATAPI_ISSUE: Error (no IRQ) before sending ccb dev %d status 0x%02x\n",
252 device, c);
253 err = 0xFF;
254 goto AI_OUT;
255 }
256
257 /* write command block */
258 ide_output_data_shorts(device, (unsigned short *)ccb, ccblen / 2);
259
260 /* ATAPI Command written wait for completition */
261 udelay(5000); /* device must set bsy */
262
263 mask = ATA_STAT_DRQ | ATA_STAT_BUSY | ATA_STAT_ERR;
264 /*
265 * if no data wait for DRQ = 0 BSY = 0
266 * if data wait for DRQ = 1 BSY = 0
267 */
268 res = 0;
269 if (buflen)
270 res = ATA_STAT_DRQ;
271 c = atapi_wait_mask(device, ATAPI_TIME_OUT, mask, res);
272 if ((c & mask) != res) {
273 if (c & ATA_STAT_ERR) {
274 err = (ide_inb(device, ATA_ERROR_REG)) >> 4;
275 debug("atapi_issue 1 returned sense key %X status %02X\n",
276 err, c);
277 } else {
278 printf("ATAPI_ISSUE: (no DRQ) after sending ccb (%x) status 0x%02x\n",
279 ccb[0], c);
280 err = 0xFF;
281 }
282 goto AI_OUT;
283 }
284 n = ide_inb(device, ATA_CYL_HIGH);
285 n <<= 8;
286 n += ide_inb(device, ATA_CYL_LOW);
287 if (n > buflen) {
288 printf("ERROR, transfer bytes %d requested only %d\n", n,
289 buflen);
290 err = 0xff;
291 goto AI_OUT;
292 }
293 if ((n == 0) && (buflen < 0)) {
294 printf("ERROR, transfer bytes %d requested %d\n", n, buflen);
295 err = 0xff;
296 goto AI_OUT;
297 }
298 if (n != buflen) {
299 debug("WARNING, transfer bytes %d not equal with requested %d\n",
300 n, buflen);
301 }
302 if (n != 0) { /* data transfer */
303 debug("ATAPI_ISSUE: %d Bytes to transfer\n", n);
304 /* we transfer shorts */
305 n >>= 1;
306 /* ok now decide if it is an in or output */
307 if ((ide_inb(device, ATA_SECT_CNT) & 0x02) == 0) {
308 debug("Write to device\n");
309 ide_output_data_shorts(device, (unsigned short *)buffer,
310 n);
311 } else {
312 debug("Read from device @ %p shorts %d\n", buffer, n);
313 ide_input_data_shorts(device, (unsigned short *)buffer,
314 n);
315 }
316 }
317 udelay(5000); /* seems that some CD ROMs need this... */
318 mask = ATA_STAT_BUSY | ATA_STAT_ERR;
319 res = 0;
320 c = atapi_wait_mask(device, ATAPI_TIME_OUT, mask, res);
321 if ((c & ATA_STAT_ERR) == ATA_STAT_ERR) {
322 err = (ide_inb(device, ATA_ERROR_REG) >> 4);
323 debug("atapi_issue 2 returned sense key %X status %X\n", err,
324 c);
325 } else {
326 err = 0;
327 }
328 AI_OUT:
329 ide_led(DEVICE_LED(device), 0); /* LED off */
330 return err;
331 }
332
333 /*
334 * sending the command to atapi_issue. If an status other than good
335 * returns, an request_sense will be issued
336 */
337
338 #define ATAPI_DRIVE_NOT_READY 100
339 #define ATAPI_UNIT_ATTN 10
340
341 unsigned char atapi_issue_autoreq(int device,
342 unsigned char *ccb,
343 int ccblen,
344 unsigned char *buffer, int buflen)
345 {
346 unsigned char sense_data[18], sense_ccb[12];
347 unsigned char res, key, asc, ascq;
348 int notready, unitattn;
349
350 unitattn = ATAPI_UNIT_ATTN;
351 notready = ATAPI_DRIVE_NOT_READY;
352
353 retry:
354 res = atapi_issue(device, ccb, ccblen, buffer, buflen);
355 if (res == 0)
356 return 0; /* Ok */
357
358 if (res == 0xFF)
359 return 0xFF; /* error */
360
361 debug("(auto_req)atapi_issue returned sense key %X\n", res);
362
363 memset(sense_ccb, 0, sizeof(sense_ccb));
364 memset(sense_data, 0, sizeof(sense_data));
365 sense_ccb[0] = ATAPI_CMD_REQ_SENSE;
366 sense_ccb[4] = 18; /* allocation Length */
367
368 res = atapi_issue(device, sense_ccb, 12, sense_data, 18);
369 key = (sense_data[2] & 0xF);
370 asc = (sense_data[12]);
371 ascq = (sense_data[13]);
372
373 debug("ATAPI_CMD_REQ_SENSE returned %x\n", res);
374 debug(" Sense page: %02X key %02X ASC %02X ASCQ %02X\n",
375 sense_data[0], key, asc, ascq);
376
377 if ((key == 0))
378 return 0; /* ok device ready */
379
380 if ((key == 6) || (asc == 0x29) || (asc == 0x28)) { /* Unit Attention */
381 if (unitattn-- > 0) {
382 udelay(200 * 1000);
383 goto retry;
384 }
385 printf("Unit Attention, tried %d\n", ATAPI_UNIT_ATTN);
386 goto error;
387 }
388 if ((asc == 0x4) && (ascq == 0x1)) {
389 /* not ready, but will be ready soon */
390 if (notready-- > 0) {
391 udelay(200 * 1000);
392 goto retry;
393 }
394 printf("Drive not ready, tried %d times\n",
395 ATAPI_DRIVE_NOT_READY);
396 goto error;
397 }
398 if (asc == 0x3a) {
399 debug("Media not present\n");
400 goto error;
401 }
402
403 printf("ERROR: Unknown Sense key %02X ASC %02X ASCQ %02X\n", key, asc,
404 ascq);
405 error:
406 debug("ERROR Sense key %02X ASC %02X ASCQ %02X\n", key, asc, ascq);
407 return 0xFF;
408 }
409
410 /*
411 * atapi_read:
412 * we transfer only one block per command, since the multiple DRQ per
413 * command is not yet implemented
414 */
415 #define ATAPI_READ_MAX_BYTES 2048 /* we read max 2kbytes */
416 #define ATAPI_READ_BLOCK_SIZE 2048 /* assuming CD part */
417 #define ATAPI_READ_MAX_BLOCK (ATAPI_READ_MAX_BYTES/ATAPI_READ_BLOCK_SIZE)
418
419 ulong atapi_read(struct blk_desc *block_dev, lbaint_t blknr, lbaint_t blkcnt,
420 void *buffer)
421 {
422 int device = block_dev->devnum;
423 ulong n = 0;
424 unsigned char ccb[12]; /* Command descriptor block */
425 ulong cnt;
426
427 debug("atapi_read dev %d start " LBAF " blocks " LBAF
428 " buffer at %lX\n", device, blknr, blkcnt, (ulong) buffer);
429
430 do {
431 if (blkcnt > ATAPI_READ_MAX_BLOCK)
432 cnt = ATAPI_READ_MAX_BLOCK;
433 else
434 cnt = blkcnt;
435
436 ccb[0] = ATAPI_CMD_READ_12;
437 ccb[1] = 0; /* reserved */
438 ccb[2] = (unsigned char) (blknr >> 24) & 0xFF; /* MSB Block */
439 ccb[3] = (unsigned char) (blknr >> 16) & 0xFF; /* */
440 ccb[4] = (unsigned char) (blknr >> 8) & 0xFF;
441 ccb[5] = (unsigned char) blknr & 0xFF; /* LSB Block */
442 ccb[6] = (unsigned char) (cnt >> 24) & 0xFF; /* MSB Block cnt */
443 ccb[7] = (unsigned char) (cnt >> 16) & 0xFF;
444 ccb[8] = (unsigned char) (cnt >> 8) & 0xFF;
445 ccb[9] = (unsigned char) cnt & 0xFF; /* LSB Block */
446 ccb[10] = 0; /* reserved */
447 ccb[11] = 0; /* reserved */
448
449 if (atapi_issue_autoreq(device, ccb, 12,
450 (unsigned char *)buffer,
451 cnt * ATAPI_READ_BLOCK_SIZE)
452 == 0xFF) {
453 return n;
454 }
455 n += cnt;
456 blkcnt -= cnt;
457 blknr += cnt;
458 buffer += (cnt * ATAPI_READ_BLOCK_SIZE);
459 } while (blkcnt > 0);
460 return n;
461 }
462
463 static void atapi_inquiry(struct blk_desc *dev_desc)
464 {
465 unsigned char ccb[12]; /* Command descriptor block */
466 unsigned char iobuf[64]; /* temp buf */
467 unsigned char c;
468 int device;
469
470 device = dev_desc->devnum;
471 dev_desc->type = DEV_TYPE_UNKNOWN; /* not yet valid */
472 dev_desc->block_read = atapi_read;
473
474 memset(ccb, 0, sizeof(ccb));
475 memset(iobuf, 0, sizeof(iobuf));
476
477 ccb[0] = ATAPI_CMD_INQUIRY;
478 ccb[4] = 40; /* allocation Legnth */
479 c = atapi_issue_autoreq(device, ccb, 12, (unsigned char *)iobuf, 40);
480
481 debug("ATAPI_CMD_INQUIRY returned %x\n", c);
482 if (c != 0)
483 return;
484
485 /* copy device ident strings */
486 ident_cpy((unsigned char *)dev_desc->vendor, &iobuf[8], 8);
487 ident_cpy((unsigned char *)dev_desc->product, &iobuf[16], 16);
488 ident_cpy((unsigned char *)dev_desc->revision, &iobuf[32], 5);
489
490 dev_desc->lun = 0;
491 dev_desc->lba = 0;
492 dev_desc->blksz = 0;
493 dev_desc->log2blksz = LOG2_INVALID(typeof(dev_desc->log2blksz));
494 dev_desc->type = iobuf[0] & 0x1f;
495
496 if ((iobuf[1] & 0x80) == 0x80)
497 dev_desc->removable = 1;
498 else
499 dev_desc->removable = 0;
500
501 memset(ccb, 0, sizeof(ccb));
502 memset(iobuf, 0, sizeof(iobuf));
503 ccb[0] = ATAPI_CMD_START_STOP;
504 ccb[4] = 0x03; /* start */
505
506 c = atapi_issue_autoreq(device, ccb, 12, (unsigned char *)iobuf, 0);
507
508 debug("ATAPI_CMD_START_STOP returned %x\n", c);
509 if (c != 0)
510 return;
511
512 memset(ccb, 0, sizeof(ccb));
513 memset(iobuf, 0, sizeof(iobuf));
514 c = atapi_issue_autoreq(device, ccb, 12, (unsigned char *)iobuf, 0);
515
516 debug("ATAPI_CMD_UNIT_TEST_READY returned %x\n", c);
517 if (c != 0)
518 return;
519
520 memset(ccb, 0, sizeof(ccb));
521 memset(iobuf, 0, sizeof(iobuf));
522 ccb[0] = ATAPI_CMD_READ_CAP;
523 c = atapi_issue_autoreq(device, ccb, 12, (unsigned char *)iobuf, 8);
524 debug("ATAPI_CMD_READ_CAP returned %x\n", c);
525 if (c != 0)
526 return;
527
528 debug("Read Cap: LBA %02X%02X%02X%02X blksize %02X%02X%02X%02X\n",
529 iobuf[0], iobuf[1], iobuf[2], iobuf[3],
530 iobuf[4], iobuf[5], iobuf[6], iobuf[7]);
531
532 dev_desc->lba = ((unsigned long) iobuf[0] << 24) +
533 ((unsigned long) iobuf[1] << 16) +
534 ((unsigned long) iobuf[2] << 8) + ((unsigned long) iobuf[3]);
535 dev_desc->blksz = ((unsigned long) iobuf[4] << 24) +
536 ((unsigned long) iobuf[5] << 16) +
537 ((unsigned long) iobuf[6] << 8) + ((unsigned long) iobuf[7]);
538 dev_desc->log2blksz = LOG2(dev_desc->blksz);
539 #ifdef CONFIG_LBA48
540 /* ATAPI devices cannot use 48bit addressing (ATA/ATAPI v7) */
541 dev_desc->lba48 = 0;
542 #endif
543 return;
544 }
545
546 #endif /* CONFIG_ATAPI */
547
548 static void ide_ident(struct blk_desc *dev_desc)
549 {
550 unsigned char c;
551 hd_driveid_t iop;
552
553 #ifdef CONFIG_ATAPI
554 int retries = 0;
555 #endif
556 int device;
557
558 device = dev_desc->devnum;
559 printf(" Device %d: ", device);
560
561 ide_led(DEVICE_LED(device), 1); /* LED on */
562 /* Select device
563 */
564 ide_outb(device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device));
565 dev_desc->if_type = IF_TYPE_IDE;
566 #ifdef CONFIG_ATAPI
567
568 retries = 0;
569
570 /* Warning: This will be tricky to read */
571 while (retries <= 1) {
572 /* check signature */
573 if ((ide_inb(device, ATA_SECT_CNT) == 0x01) &&
574 (ide_inb(device, ATA_SECT_NUM) == 0x01) &&
575 (ide_inb(device, ATA_CYL_LOW) == 0x14) &&
576 (ide_inb(device, ATA_CYL_HIGH) == 0xEB)) {
577 /* ATAPI Signature found */
578 dev_desc->if_type = IF_TYPE_ATAPI;
579 /*
580 * Start Ident Command
581 */
582 ide_outb(device, ATA_COMMAND, ATAPI_CMD_IDENT);
583 /*
584 * Wait for completion - ATAPI devices need more time
585 * to become ready
586 */
587 c = ide_wait(device, ATAPI_TIME_OUT);
588 } else
589 #endif
590 {
591 /*
592 * Start Ident Command
593 */
594 ide_outb(device, ATA_COMMAND, ATA_CMD_IDENT);
595
596 /*
597 * Wait for completion
598 */
599 c = ide_wait(device, IDE_TIME_OUT);
600 }
601 ide_led(DEVICE_LED(device), 0); /* LED off */
602
603 if (((c & ATA_STAT_DRQ) == 0) ||
604 ((c & (ATA_STAT_FAULT | ATA_STAT_ERR)) != 0)) {
605 #ifdef CONFIG_ATAPI
606 {
607 /*
608 * Need to soft reset the device
609 * in case it's an ATAPI...
610 */
611 debug("Retrying...\n");
612 ide_outb(device, ATA_DEV_HD,
613 ATA_LBA | ATA_DEVICE(device));
614 udelay(100000);
615 ide_outb(device, ATA_COMMAND, 0x08);
616 udelay(500000); /* 500 ms */
617 }
618 /*
619 * Select device
620 */
621 ide_outb(device, ATA_DEV_HD,
622 ATA_LBA | ATA_DEVICE(device));
623 retries++;
624 #else
625 return;
626 #endif
627 }
628 #ifdef CONFIG_ATAPI
629 else
630 break;
631 } /* see above - ugly to read */
632
633 if (retries == 2) /* Not found */
634 return;
635 #endif
636
637 ide_input_swap_data(device, (ulong *)&iop, ATA_SECTORWORDS);
638
639 ident_cpy((unsigned char *)dev_desc->revision, iop.fw_rev,
640 sizeof(dev_desc->revision));
641 ident_cpy((unsigned char *)dev_desc->vendor, iop.model,
642 sizeof(dev_desc->vendor));
643 ident_cpy((unsigned char *)dev_desc->product, iop.serial_no,
644 sizeof(dev_desc->product));
645 #ifdef __LITTLE_ENDIAN
646 /*
647 * firmware revision, model, and serial number have Big Endian Byte
648 * order in Word. Convert all three to little endian.
649 *
650 * See CF+ and CompactFlash Specification Revision 2.0:
651 * 6.2.1.6: Identify Drive, Table 39 for more details
652 */
653
654 strswab(dev_desc->revision);
655 strswab(dev_desc->vendor);
656 strswab(dev_desc->product);
657 #endif /* __LITTLE_ENDIAN */
658
659 if ((iop.config & 0x0080) == 0x0080)
660 dev_desc->removable = 1;
661 else
662 dev_desc->removable = 0;
663
664 #ifdef CONFIG_ATAPI
665 if (dev_desc->if_type == IF_TYPE_ATAPI) {
666 atapi_inquiry(dev_desc);
667 return;
668 }
669 #endif /* CONFIG_ATAPI */
670
671 #ifdef __BIG_ENDIAN
672 /* swap shorts */
673 dev_desc->lba = (iop.lba_capacity << 16) | (iop.lba_capacity >> 16);
674 #else /* ! __BIG_ENDIAN */
675 /*
676 * do not swap shorts on little endian
677 *
678 * See CF+ and CompactFlash Specification Revision 2.0:
679 * 6.2.1.6: Identfy Drive, Table 39, Word Address 57-58 for details.
680 */
681 dev_desc->lba = iop.lba_capacity;
682 #endif /* __BIG_ENDIAN */
683
684 #ifdef CONFIG_LBA48
685 if (iop.command_set_2 & 0x0400) { /* LBA 48 support */
686 dev_desc->lba48 = 1;
687 dev_desc->lba = (unsigned long long) iop.lba48_capacity[0] |
688 ((unsigned long long) iop.lba48_capacity[1] << 16) |
689 ((unsigned long long) iop.lba48_capacity[2] << 32) |
690 ((unsigned long long) iop.lba48_capacity[3] << 48);
691 } else {
692 dev_desc->lba48 = 0;
693 }
694 #endif /* CONFIG_LBA48 */
695 /* assuming HD */
696 dev_desc->type = DEV_TYPE_HARDDISK;
697 dev_desc->blksz = ATA_BLOCKSIZE;
698 dev_desc->log2blksz = LOG2(dev_desc->blksz);
699 dev_desc->lun = 0; /* just to fill something in... */
700
701 #if 0 /* only used to test the powersaving mode,
702 * if enabled, the drive goes after 5 sec
703 * in standby mode */
704 ide_outb(device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device));
705 c = ide_wait(device, IDE_TIME_OUT);
706 ide_outb(device, ATA_SECT_CNT, 1);
707 ide_outb(device, ATA_LBA_LOW, 0);
708 ide_outb(device, ATA_LBA_MID, 0);
709 ide_outb(device, ATA_LBA_HIGH, 0);
710 ide_outb(device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device));
711 ide_outb(device, ATA_COMMAND, 0xe3);
712 udelay(50);
713 c = ide_wait(device, IDE_TIME_OUT); /* can't take over 500 ms */
714 #endif
715 }
716
717 __weak void ide_led(uchar led, uchar status)
718 {
719 #if defined(CONFIG_IDE_LED) && defined(PER8_BASE) /* required by LED_PORT */
720 static uchar led_buffer; /* Buffer for current LED status */
721
722 uchar *led_port = LED_PORT;
723
724 if (status) /* switch LED on */
725 led_buffer |= led;
726 else /* switch LED off */
727 led_buffer &= ~led;
728
729 *led_port = led_buffer;
730 #endif
731 }
732
733 __weak void ide_outb(int dev, int port, unsigned char val)
734 {
735 debug("ide_outb (dev= %d, port= 0x%x, val= 0x%02x) : @ 0x%08lx\n",
736 dev, port, val,
737 (ATA_CURR_BASE(dev) + CONFIG_SYS_ATA_PORT_ADDR(port)));
738
739 #if defined(CONFIG_IDE_AHB)
740 if (port) {
741 /* write command */
742 ide_write_register(dev, port, val);
743 } else {
744 /* write data */
745 outb(val, (ATA_CURR_BASE(dev)));
746 }
747 #else
748 outb(val, (ATA_CURR_BASE(dev) + CONFIG_SYS_ATA_PORT_ADDR(port)));
749 #endif
750 }
751
752 __weak unsigned char ide_inb(int dev, int port)
753 {
754 uchar val;
755
756 #if defined(CONFIG_IDE_AHB)
757 val = ide_read_register(dev, port);
758 #else
759 val = inb((ATA_CURR_BASE(dev) + CONFIG_SYS_ATA_PORT_ADDR(port)));
760 #endif
761
762 debug("ide_inb (dev= %d, port= 0x%x) : @ 0x%08lx -> 0x%02x\n",
763 dev, port,
764 (ATA_CURR_BASE(dev) + CONFIG_SYS_ATA_PORT_ADDR(port)), val);
765 return val;
766 }
767
768 void ide_init(void)
769 {
770 unsigned char c;
771 int i, bus;
772
773 #ifdef CONFIG_IDE_8xx_PCCARD
774 extern int ide_devices_found; /* Initialized in check_ide_device() */
775 #endif /* CONFIG_IDE_8xx_PCCARD */
776
777 #ifdef CONFIG_IDE_PREINIT
778 WATCHDOG_RESET();
779
780 if (ide_preinit()) {
781 puts("ide_preinit failed\n");
782 return;
783 }
784 #endif /* CONFIG_IDE_PREINIT */
785
786 WATCHDOG_RESET();
787
788 /*
789 * Reset the IDE just to be sure.
790 * Light LED's to show
791 */
792 ide_led((LED_IDE1 | LED_IDE2), 1); /* LED's on */
793
794 /* ATAPI Drives seems to need a proper IDE Reset */
795 ide_reset();
796
797 #ifdef CONFIG_IDE_INIT_POSTRESET
798 WATCHDOG_RESET();
799
800 if (ide_init_postreset()) {
801 puts("ide_preinit_postreset failed\n");
802 return;
803 }
804 #endif /* CONFIG_IDE_INIT_POSTRESET */
805
806 /*
807 * Wait for IDE to get ready.
808 * According to spec, this can take up to 31 seconds!
809 */
810 for (bus = 0; bus < CONFIG_SYS_IDE_MAXBUS; ++bus) {
811 int dev =
812 bus * (CONFIG_SYS_IDE_MAXDEVICE /
813 CONFIG_SYS_IDE_MAXBUS);
814
815 #ifdef CONFIG_IDE_8xx_PCCARD
816 /* Skip non-ide devices from probing */
817 if ((ide_devices_found & (1 << bus)) == 0) {
818 ide_led((LED_IDE1 | LED_IDE2), 0); /* LED's off */
819 continue;
820 }
821 #endif
822 printf("Bus %d: ", bus);
823
824 ide_bus_ok[bus] = 0;
825
826 /* Select device
827 */
828 udelay(100000); /* 100 ms */
829 ide_outb(dev, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(dev));
830 udelay(100000); /* 100 ms */
831 i = 0;
832 do {
833 udelay(10000); /* 10 ms */
834
835 c = ide_inb(dev, ATA_STATUS);
836 i++;
837 if (i > (ATA_RESET_TIME * 100)) {
838 puts("** Timeout **\n");
839 /* LED's off */
840 ide_led((LED_IDE1 | LED_IDE2), 0);
841 return;
842 }
843 if ((i >= 100) && ((i % 100) == 0))
844 putc('.');
845
846 } while (c & ATA_STAT_BUSY);
847
848 if (c & (ATA_STAT_BUSY | ATA_STAT_FAULT)) {
849 puts("not available ");
850 debug("Status = 0x%02X ", c);
851 #ifndef CONFIG_ATAPI /* ATAPI Devices do not set DRDY */
852 } else if ((c & ATA_STAT_READY) == 0) {
853 puts("not available ");
854 debug("Status = 0x%02X ", c);
855 #endif
856 } else {
857 puts("OK ");
858 ide_bus_ok[bus] = 1;
859 }
860 WATCHDOG_RESET();
861 }
862
863 putc('\n');
864
865 ide_led((LED_IDE1 | LED_IDE2), 0); /* LED's off */
866
867 for (i = 0; i < CONFIG_SYS_IDE_MAXDEVICE; ++i) {
868 int led = (IDE_BUS(i) == 0) ? LED_IDE1 : LED_IDE2;
869 ide_dev_desc[i].type = DEV_TYPE_UNKNOWN;
870 ide_dev_desc[i].if_type = IF_TYPE_IDE;
871 ide_dev_desc[i].devnum = i;
872 ide_dev_desc[i].part_type = PART_TYPE_UNKNOWN;
873 ide_dev_desc[i].blksz = 0;
874 ide_dev_desc[i].log2blksz =
875 LOG2_INVALID(typeof(ide_dev_desc[i].log2blksz));
876 ide_dev_desc[i].lba = 0;
877 #ifndef CONFIG_BLK
878 ide_dev_desc[i].block_read = ide_read;
879 ide_dev_desc[i].block_write = ide_write;
880 #endif
881 if (!ide_bus_ok[IDE_BUS(i)])
882 continue;
883 ide_led(led, 1); /* LED on */
884 ide_ident(&ide_dev_desc[i]);
885 ide_led(led, 0); /* LED off */
886 dev_print(&ide_dev_desc[i]);
887
888 if ((ide_dev_desc[i].lba > 0) && (ide_dev_desc[i].blksz > 0)) {
889 /* initialize partition type */
890 part_init(&ide_dev_desc[i]);
891 }
892 }
893 WATCHDOG_RESET();
894 }
895
896 /* We only need to swap data if we are running on a big endian cpu. */
897 #if defined(__LITTLE_ENDIAN)
898 __weak void ide_input_swap_data(int dev, ulong *sect_buf, int words)
899 {
900 ide_input_data(dev, sect_buf, words);
901 }
902 #else
903 __weak void ide_input_swap_data(int dev, ulong *sect_buf, int words)
904 {
905 volatile ushort *pbuf =
906 (ushort *)(ATA_CURR_BASE(dev) + ATA_DATA_REG);
907 ushort *dbuf = (ushort *)sect_buf;
908
909 debug("in input swap data base for read is %lx\n",
910 (unsigned long) pbuf);
911
912 while (words--) {
913 #ifdef __MIPS__
914 *dbuf++ = swab16p((u16 *)pbuf);
915 *dbuf++ = swab16p((u16 *)pbuf);
916 #else
917 *dbuf++ = ld_le16(pbuf);
918 *dbuf++ = ld_le16(pbuf);
919 #endif /* !MIPS */
920 }
921 }
922 #endif /* __LITTLE_ENDIAN */
923
924
925 #if defined(CONFIG_IDE_SWAP_IO)
926 __weak void ide_output_data(int dev, const ulong *sect_buf, int words)
927 {
928 ushort *dbuf;
929 volatile ushort *pbuf;
930
931 pbuf = (ushort *)(ATA_CURR_BASE(dev) + ATA_DATA_REG);
932 dbuf = (ushort *)sect_buf;
933 while (words--) {
934 EIEIO;
935 *pbuf = *dbuf++;
936 EIEIO;
937 *pbuf = *dbuf++;
938 }
939 }
940 #else /* ! CONFIG_IDE_SWAP_IO */
941 __weak void ide_output_data(int dev, const ulong *sect_buf, int words)
942 {
943 #if defined(CONFIG_IDE_AHB)
944 ide_write_data(dev, sect_buf, words);
945 #else
946 outsw(ATA_CURR_BASE(dev) + ATA_DATA_REG, sect_buf, words << 1);
947 #endif
948 }
949 #endif /* CONFIG_IDE_SWAP_IO */
950
951 #if defined(CONFIG_IDE_SWAP_IO)
952 __weak void ide_input_data(int dev, ulong *sect_buf, int words)
953 {
954 ushort *dbuf;
955 volatile ushort *pbuf;
956
957 pbuf = (ushort *)(ATA_CURR_BASE(dev) + ATA_DATA_REG);
958 dbuf = (ushort *)sect_buf;
959
960 debug("in input data base for read is %lx\n", (unsigned long) pbuf);
961
962 while (words--) {
963 EIEIO;
964 *dbuf++ = *pbuf;
965 EIEIO;
966 *dbuf++ = *pbuf;
967 }
968 }
969 #else /* ! CONFIG_IDE_SWAP_IO */
970 __weak void ide_input_data(int dev, ulong *sect_buf, int words)
971 {
972 #if defined(CONFIG_IDE_AHB)
973 ide_read_data(dev, sect_buf, words);
974 #else
975 insw(ATA_CURR_BASE(dev) + ATA_DATA_REG, sect_buf, words << 1);
976 #endif
977 }
978
979 #endif /* CONFIG_IDE_SWAP_IO */
980
981 #ifdef CONFIG_BLK
982 ulong ide_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt,
983 void *buffer)
984 #else
985 ulong ide_read(struct blk_desc *block_dev, lbaint_t blknr, lbaint_t blkcnt,
986 void *buffer)
987 #endif
988 {
989 #ifdef CONFIG_BLK
990 struct blk_desc *block_dev = dev_get_uclass_platdata(dev);
991 #endif
992 int device = block_dev->devnum;
993 ulong n = 0;
994 unsigned char c;
995 unsigned char pwrsave = 0; /* power save */
996
997 #ifdef CONFIG_LBA48
998 unsigned char lba48 = 0;
999
1000 if (blknr & 0x0000fffff0000000ULL) {
1001 /* more than 28 bits used, use 48bit mode */
1002 lba48 = 1;
1003 }
1004 #endif
1005 debug("ide_read dev %d start " LBAF ", blocks " LBAF " buffer at %lX\n",
1006 device, blknr, blkcnt, (ulong) buffer);
1007
1008 ide_led(DEVICE_LED(device), 1); /* LED on */
1009
1010 /* Select device
1011 */
1012 ide_outb(device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device));
1013 c = ide_wait(device, IDE_TIME_OUT);
1014
1015 if (c & ATA_STAT_BUSY) {
1016 printf("IDE read: device %d not ready\n", device);
1017 goto IDE_READ_E;
1018 }
1019
1020 /* first check if the drive is in Powersaving mode, if yes,
1021 * increase the timeout value */
1022 ide_outb(device, ATA_COMMAND, ATA_CMD_CHK_PWR);
1023 udelay(50);
1024
1025 c = ide_wait(device, IDE_TIME_OUT); /* can't take over 500 ms */
1026
1027 if (c & ATA_STAT_BUSY) {
1028 printf("IDE read: device %d not ready\n", device);
1029 goto IDE_READ_E;
1030 }
1031 if ((c & ATA_STAT_ERR) == ATA_STAT_ERR) {
1032 printf("No Powersaving mode %X\n", c);
1033 } else {
1034 c = ide_inb(device, ATA_SECT_CNT);
1035 debug("Powersaving %02X\n", c);
1036 if (c == 0)
1037 pwrsave = 1;
1038 }
1039
1040
1041 while (blkcnt-- > 0) {
1042 c = ide_wait(device, IDE_TIME_OUT);
1043
1044 if (c & ATA_STAT_BUSY) {
1045 printf("IDE read: device %d not ready\n", device);
1046 break;
1047 }
1048 #ifdef CONFIG_LBA48
1049 if (lba48) {
1050 /* write high bits */
1051 ide_outb(device, ATA_SECT_CNT, 0);
1052 ide_outb(device, ATA_LBA_LOW, (blknr >> 24) & 0xFF);
1053 #ifdef CONFIG_SYS_64BIT_LBA
1054 ide_outb(device, ATA_LBA_MID, (blknr >> 32) & 0xFF);
1055 ide_outb(device, ATA_LBA_HIGH, (blknr >> 40) & 0xFF);
1056 #else
1057 ide_outb(device, ATA_LBA_MID, 0);
1058 ide_outb(device, ATA_LBA_HIGH, 0);
1059 #endif
1060 }
1061 #endif
1062 ide_outb(device, ATA_SECT_CNT, 1);
1063 ide_outb(device, ATA_LBA_LOW, (blknr >> 0) & 0xFF);
1064 ide_outb(device, ATA_LBA_MID, (blknr >> 8) & 0xFF);
1065 ide_outb(device, ATA_LBA_HIGH, (blknr >> 16) & 0xFF);
1066
1067 #ifdef CONFIG_LBA48
1068 if (lba48) {
1069 ide_outb(device, ATA_DEV_HD,
1070 ATA_LBA | ATA_DEVICE(device));
1071 ide_outb(device, ATA_COMMAND, ATA_CMD_READ_EXT);
1072
1073 } else
1074 #endif
1075 {
1076 ide_outb(device, ATA_DEV_HD, ATA_LBA |
1077 ATA_DEVICE(device) | ((blknr >> 24) & 0xF));
1078 ide_outb(device, ATA_COMMAND, ATA_CMD_READ);
1079 }
1080
1081 udelay(50);
1082
1083 if (pwrsave) {
1084 /* may take up to 4 sec */
1085 c = ide_wait(device, IDE_SPIN_UP_TIME_OUT);
1086 pwrsave = 0;
1087 } else {
1088 /* can't take over 500 ms */
1089 c = ide_wait(device, IDE_TIME_OUT);
1090 }
1091
1092 if ((c & (ATA_STAT_DRQ | ATA_STAT_BUSY | ATA_STAT_ERR)) !=
1093 ATA_STAT_DRQ) {
1094 printf("Error (no IRQ) dev %d blk " LBAF
1095 ": status %#02x\n", device, blknr, c);
1096 break;
1097 }
1098
1099 ide_input_data(device, buffer, ATA_SECTORWORDS);
1100 (void) ide_inb(device, ATA_STATUS); /* clear IRQ */
1101
1102 ++n;
1103 ++blknr;
1104 buffer += ATA_BLOCKSIZE;
1105 }
1106 IDE_READ_E:
1107 ide_led(DEVICE_LED(device), 0); /* LED off */
1108 return n;
1109 }
1110
1111 #ifdef CONFIG_BLK
1112 ulong ide_write(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt,
1113 const void *buffer)
1114 #else
1115 ulong ide_write(struct blk_desc *block_dev, lbaint_t blknr, lbaint_t blkcnt,
1116 const void *buffer)
1117 #endif
1118 {
1119 #ifdef CONFIG_BLK
1120 struct blk_desc *block_dev = dev_get_uclass_platdata(dev);
1121 #endif
1122 int device = block_dev->devnum;
1123 ulong n = 0;
1124 unsigned char c;
1125
1126 #ifdef CONFIG_LBA48
1127 unsigned char lba48 = 0;
1128
1129 if (blknr & 0x0000fffff0000000ULL) {
1130 /* more than 28 bits used, use 48bit mode */
1131 lba48 = 1;
1132 }
1133 #endif
1134
1135 ide_led(DEVICE_LED(device), 1); /* LED on */
1136
1137 /* Select device
1138 */
1139 ide_outb(device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device));
1140
1141 while (blkcnt-- > 0) {
1142 c = ide_wait(device, IDE_TIME_OUT);
1143
1144 if (c & ATA_STAT_BUSY) {
1145 printf("IDE read: device %d not ready\n", device);
1146 goto WR_OUT;
1147 }
1148 #ifdef CONFIG_LBA48
1149 if (lba48) {
1150 /* write high bits */
1151 ide_outb(device, ATA_SECT_CNT, 0);
1152 ide_outb(device, ATA_LBA_LOW, (blknr >> 24) & 0xFF);
1153 #ifdef CONFIG_SYS_64BIT_LBA
1154 ide_outb(device, ATA_LBA_MID, (blknr >> 32) & 0xFF);
1155 ide_outb(device, ATA_LBA_HIGH, (blknr >> 40) & 0xFF);
1156 #else
1157 ide_outb(device, ATA_LBA_MID, 0);
1158 ide_outb(device, ATA_LBA_HIGH, 0);
1159 #endif
1160 }
1161 #endif
1162 ide_outb(device, ATA_SECT_CNT, 1);
1163 ide_outb(device, ATA_LBA_LOW, (blknr >> 0) & 0xFF);
1164 ide_outb(device, ATA_LBA_MID, (blknr >> 8) & 0xFF);
1165 ide_outb(device, ATA_LBA_HIGH, (blknr >> 16) & 0xFF);
1166
1167 #ifdef CONFIG_LBA48
1168 if (lba48) {
1169 ide_outb(device, ATA_DEV_HD,
1170 ATA_LBA | ATA_DEVICE(device));
1171 ide_outb(device, ATA_COMMAND, ATA_CMD_WRITE_EXT);
1172
1173 } else
1174 #endif
1175 {
1176 ide_outb(device, ATA_DEV_HD, ATA_LBA |
1177 ATA_DEVICE(device) | ((blknr >> 24) & 0xF));
1178 ide_outb(device, ATA_COMMAND, ATA_CMD_WRITE);
1179 }
1180
1181 udelay(50);
1182
1183 /* can't take over 500 ms */
1184 c = ide_wait(device, IDE_TIME_OUT);
1185
1186 if ((c & (ATA_STAT_DRQ | ATA_STAT_BUSY | ATA_STAT_ERR)) !=
1187 ATA_STAT_DRQ) {
1188 printf("Error (no IRQ) dev %d blk " LBAF
1189 ": status %#02x\n", device, blknr, c);
1190 goto WR_OUT;
1191 }
1192
1193 ide_output_data(device, buffer, ATA_SECTORWORDS);
1194 c = ide_inb(device, ATA_STATUS); /* clear IRQ */
1195 ++n;
1196 ++blknr;
1197 buffer += ATA_BLOCKSIZE;
1198 }
1199 WR_OUT:
1200 ide_led(DEVICE_LED(device), 0); /* LED off */
1201 return n;
1202 }
1203
1204 #if defined(CONFIG_OF_IDE_FIXUP)
1205 int ide_device_present(int dev)
1206 {
1207 if (dev >= CONFIG_SYS_IDE_MAXBUS)
1208 return 0;
1209 return ide_dev_desc[dev].type == DEV_TYPE_UNKNOWN ? 0 : 1;
1210 }
1211 #endif
1212
1213 #ifdef CONFIG_BLK
1214 static const struct blk_ops ide_blk_ops = {
1215 .read = ide_read,
1216 .write = ide_write,
1217 };
1218
1219 U_BOOT_DRIVER(ide_blk) = {
1220 .name = "ide_blk",
1221 .id = UCLASS_BLK,
1222 .ops = &ide_blk_ops,
1223 };
1224 #else
1225 U_BOOT_LEGACY_BLK(ide) = {
1226 .if_typename = "ide",
1227 .if_type = IF_TYPE_IDE,
1228 .max_devs = CONFIG_SYS_IDE_MAXDEVICE,
1229 .desc = ide_dev_desc,
1230 };
1231 #endif
1232 1 /*
drivers/block/Kconfig
1 config BLK 1 config BLK
2 bool "Support block devices" 2 bool "Support block devices"
3 depends on DM 3 depends on DM
4 default y if DM_MMC 4 default y if DM_MMC
5 help 5 help
6 Enable support for block devices, such as SCSI, MMC and USB 6 Enable support for block devices, such as SCSI, MMC and USB
7 flash sticks. These provide a block-level interface which permits 7 flash sticks. These provide a block-level interface which permits
8 reading, writing and (in some cases) erasing blocks. Block 8 reading, writing and (in some cases) erasing blocks. Block
9 devices often have a partition table which allows the device to 9 devices often have a partition table which allows the device to
10 be partitioned into several areas, called 'partitions' in U-Boot. 10 be partitioned into several areas, called 'partitions' in U-Boot.
11 A filesystem can be placed in each partition. 11 A filesystem can be placed in each partition.
12 12
13 config AHCI 13 config AHCI
14 bool "Support SATA controllers with driver model" 14 bool "Support SATA controllers with driver model"
15 depends on DM 15 depends on DM
16 help 16 help
17 This enables a uclass for disk controllers in U-Boot. Various driver 17 This enables a uclass for disk controllers in U-Boot. Various driver
18 types can use this, such as AHCI/SATA. It does not provide any standard 18 types can use this, such as AHCI/SATA. It does not provide any standard
19 operations at present. The block device interface has not been converted 19 operations at present. The block device interface has not been converted
20 to driver model. 20 to driver model.
21 21
22 config DM_SCSI 22 config DM_SCSI
23 bool "Support SCSI controllers with driver model" 23 bool "Support SCSI controllers with driver model"
24 depends on BLK 24 depends on BLK
25 help 25 help
26 This option enables the SCSI (Small Computer System Interface) uclass 26 This option enables the SCSI (Small Computer System Interface) uclass
27 which supports SCSI and SATA HDDs. For every device configuration 27 which supports SCSI and SATA HDDs. For every device configuration
28 (IDs/LUNs) a block device is created with RAW read/write and 28 (IDs/LUNs) a block device is created with RAW read/write and
29 filesystem support. 29 filesystem support.
30 30
31 config BLOCK_CACHE 31 config BLOCK_CACHE
32 bool "Use block device cache" 32 bool "Use block device cache"
33 default n 33 default n
34 help 34 help
35 This option enables a disk-block cache for all block devices. 35 This option enables a disk-block cache for all block devices.
36 This is most useful when accessing filesystems under U-Boot since 36 This is most useful when accessing filesystems under U-Boot since
37 it will prevent repeated reads from directory structures and other 37 it will prevent repeated reads from directory structures and other
38 filesystem data structures. 38 filesystem data structures.
39 39
40 menu "SATA/SCSI device support" 40 menu "SATA/SCSI device support"
41 41
42 config SATA_CEVA 42 config SATA_CEVA
43 bool "Ceva Sata controller" 43 bool "Ceva Sata controller"
44 depends on AHCI 44 depends on AHCI
45 depends on DM_SCSI 45 depends on DM_SCSI
46 help 46 help
47 This option enables Ceva Sata controller hard IP available on Xilinx 47 This option enables Ceva Sata controller hard IP available on Xilinx
48 ZynqMP. Support up to 2 external devices. Complient with SATA 3.1 and 48 ZynqMP. Support up to 2 external devices. Complient with SATA 3.1 and
49 AHCI 1.3 specifications with hot-plug detect feature. 49 AHCI 1.3 specifications with hot-plug detect feature.
50 50
51 51
52 config DWC_AHCI 52 config DWC_AHCI
53 bool "Enable Synopsys DWC AHCI driver support" 53 bool "Enable Synopsys DWC AHCI driver support"
54 select SCSI_AHCI 54 select SCSI_AHCI
55 select PHY 55 select PHY
56 depends on DM_SCSI 56 depends on DM_SCSI
57 help 57 help
58 Enable this driver to support Sata devices through 58 Enable this driver to support Sata devices through
59 Synopsys DWC AHCI module. 59 Synopsys DWC AHCI module.
60 60
61 endmenu 61 endmenu
62
63 config IDE
64 bool "Support IDE controllers"
65 help
66 Enables support for IDE (Integrated Drive Electronics) hard drives.
67 This allows access to raw blocks and filesystems on an IDE drive
68 from U-Boot. See also CMD_IDE which provides an 'ide' command for
69 performing various IDE operations.
62 70
drivers/block/Makefile
1 # 1 #
2 # (C) Copyright 2000-2007 2 # (C) Copyright 2000-2007
3 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. 3 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 # 4 #
5 # SPDX-License-Identifier: GPL-2.0+ 5 # SPDX-License-Identifier: GPL-2.0+
6 # 6 #
7 7
8 obj-$(CONFIG_BLK) += blk-uclass.o 8 obj-$(CONFIG_BLK) += blk-uclass.o
9 9
10 ifndef CONFIG_BLK 10 ifndef CONFIG_BLK
11 obj-y += blk_legacy.o 11 obj-y += blk_legacy.o
12 endif 12 endif
13 13
14 obj-$(CONFIG_DWC_AHCI) += dwc_ahci.o 14 obj-$(CONFIG_DWC_AHCI) += dwc_ahci.o
15 obj-$(CONFIG_AHCI) += ahci-uclass.o 15 obj-$(CONFIG_AHCI) += ahci-uclass.o
16 obj-$(CONFIG_DM_SCSI) += scsi-uclass.o 16 obj-$(CONFIG_DM_SCSI) += scsi-uclass.o
17 obj-$(CONFIG_SCSI_AHCI) += ahci.o 17 obj-$(CONFIG_SCSI_AHCI) += ahci.o
18 obj-$(CONFIG_DWC_AHSATA) += dwc_ahsata.o 18 obj-$(CONFIG_DWC_AHSATA) += dwc_ahsata.o
19 obj-$(CONFIG_FSL_SATA) += fsl_sata.o 19 obj-$(CONFIG_FSL_SATA) += fsl_sata.o
20 obj-$(CONFIG_IDE) += ide.o
20 obj-$(CONFIG_IDE_FTIDE020) += ftide020.o 21 obj-$(CONFIG_IDE_FTIDE020) += ftide020.o
21 obj-$(CONFIG_LIBATA) += libata.o 22 obj-$(CONFIG_LIBATA) += libata.o
22 obj-$(CONFIG_MVSATA_IDE) += mvsata_ide.o 23 obj-$(CONFIG_MVSATA_IDE) += mvsata_ide.o
23 obj-$(CONFIG_MX51_PATA) += mxc_ata.o 24 obj-$(CONFIG_MX51_PATA) += mxc_ata.o
24 obj-$(CONFIG_SATA_CEVA) += sata_ceva.o 25 obj-$(CONFIG_SATA_CEVA) += sata_ceva.o
25 obj-$(CONFIG_SATA_DWC) += sata_dwc.o 26 obj-$(CONFIG_SATA_DWC) += sata_dwc.o
26 obj-$(CONFIG_SATA_MV) += sata_mv.o 27 obj-$(CONFIG_SATA_MV) += sata_mv.o
27 obj-$(CONFIG_SATA_SIL3114) += sata_sil3114.o 28 obj-$(CONFIG_SATA_SIL3114) += sata_sil3114.o
28 obj-$(CONFIG_SATA_SIL) += sata_sil.o 29 obj-$(CONFIG_SATA_SIL) += sata_sil.o
29 obj-$(CONFIG_IDE_SIL680) += sil680.o 30 obj-$(CONFIG_IDE_SIL680) += sil680.o
30 obj-$(CONFIG_SANDBOX) += sandbox.o sandbox_scsi.o sata_sandbox.o 31 obj-$(CONFIG_SANDBOX) += sandbox.o sandbox_scsi.o sata_sandbox.o
31 obj-$(CONFIG_SCSI_SYM53C8XX) += sym53c8xx.o 32 obj-$(CONFIG_SCSI_SYM53C8XX) += sym53c8xx.o
32 obj-$(CONFIG_SYSTEMACE) += systemace.o 33 obj-$(CONFIG_SYSTEMACE) += systemace.o
33 obj-$(CONFIG_BLOCK_CACHE) += blkcache.o 34 obj-$(CONFIG_BLOCK_CACHE) += blkcache.o
34 35
File was created 1 /*
2 * (C) Copyright 2000-2011
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8 #include <common.h>
9 #include <ata.h>
10 #include <dm.h>
11 #include <ide.h>
12 #include <watchdog.h>
13 #include <asm/io.h>
14
15 #ifdef __PPC__
16 # define EIEIO __asm__ volatile ("eieio")
17 # define SYNC __asm__ volatile ("sync")
18 #else
19 # define EIEIO /* nothing */
20 # define SYNC /* nothing */
21 #endif
22
23 /* Current offset for IDE0 / IDE1 bus access */
24 ulong ide_bus_offset[CONFIG_SYS_IDE_MAXBUS] = {
25 #if defined(CONFIG_SYS_ATA_IDE0_OFFSET)
26 CONFIG_SYS_ATA_IDE0_OFFSET,
27 #endif
28 #if defined(CONFIG_SYS_ATA_IDE1_OFFSET) && (CONFIG_SYS_IDE_MAXBUS > 1)
29 CONFIG_SYS_ATA_IDE1_OFFSET,
30 #endif
31 };
32
33 static int ide_bus_ok[CONFIG_SYS_IDE_MAXBUS];
34
35 struct blk_desc ide_dev_desc[CONFIG_SYS_IDE_MAXDEVICE];
36
37 #define IDE_TIME_OUT 2000 /* 2 sec timeout */
38
39 #define ATAPI_TIME_OUT 7000 /* 7 sec timeout (5 sec seems to work...) */
40
41 #define IDE_SPIN_UP_TIME_OUT 5000 /* 5 sec spin-up timeout */
42
43 #ifndef CONFIG_SYS_ATA_PORT_ADDR
44 #define CONFIG_SYS_ATA_PORT_ADDR(port) (port)
45 #endif
46
47 #ifndef CONFIG_IDE_LED /* define LED macros, they are not used anyways */
48 # define DEVICE_LED(x) 0
49 # define LED_IDE1 1
50 # define LED_IDE2 2
51 #endif
52
53 #ifdef CONFIG_IDE_RESET
54 extern void ide_set_reset(int idereset);
55
56 static void ide_reset(void)
57 {
58 int i;
59
60 for (i = 0; i < CONFIG_SYS_IDE_MAXBUS; ++i)
61 ide_bus_ok[i] = 0;
62 for (i = 0; i < CONFIG_SYS_IDE_MAXDEVICE; ++i)
63 ide_dev_desc[i].type = DEV_TYPE_UNKNOWN;
64
65 ide_set_reset(1); /* assert reset */
66
67 /* the reset signal shall be asserted for et least 25 us */
68 udelay(25);
69
70 WATCHDOG_RESET();
71
72 /* de-assert RESET signal */
73 ide_set_reset(0);
74
75 /* wait 250 ms */
76 for (i = 0; i < 250; ++i)
77 udelay(1000);
78 }
79 #else
80 #define ide_reset() /* dummy */
81 #endif /* CONFIG_IDE_RESET */
82
83 /*
84 * Wait until Busy bit is off, or timeout (in ms)
85 * Return last status
86 */
87 static uchar ide_wait(int dev, ulong t)
88 {
89 ulong delay = 10 * t; /* poll every 100 us */
90 uchar c;
91
92 while ((c = ide_inb(dev, ATA_STATUS)) & ATA_STAT_BUSY) {
93 udelay(100);
94 if (delay-- == 0)
95 break;
96 }
97 return c;
98 }
99
100 /*
101 * copy src to dest, skipping leading and trailing blanks and null
102 * terminate the string
103 * "len" is the size of available memory including the terminating '\0'
104 */
105 static void ident_cpy(unsigned char *dst, unsigned char *src,
106 unsigned int len)
107 {
108 unsigned char *end, *last;
109
110 last = dst;
111 end = src + len - 1;
112
113 /* reserve space for '\0' */
114 if (len < 2)
115 goto OUT;
116
117 /* skip leading white space */
118 while ((*src) && (src < end) && (*src == ' '))
119 ++src;
120
121 /* copy string, omitting trailing white space */
122 while ((*src) && (src < end)) {
123 *dst++ = *src;
124 if (*src++ != ' ')
125 last = dst;
126 }
127 OUT:
128 *last = '\0';
129 }
130
131 #ifdef CONFIG_ATAPI
132 /****************************************************************************
133 * ATAPI Support
134 */
135
136 #if defined(CONFIG_IDE_SWAP_IO)
137 /* since ATAPI may use commands with not 4 bytes alligned length
138 * we have our own transfer functions, 2 bytes alligned */
139 __weak void ide_output_data_shorts(int dev, ushort *sect_buf, int shorts)
140 {
141 ushort *dbuf;
142 volatile ushort *pbuf;
143
144 pbuf = (ushort *)(ATA_CURR_BASE(dev) + ATA_DATA_REG);
145 dbuf = (ushort *)sect_buf;
146
147 debug("in output data shorts base for read is %lx\n",
148 (unsigned long) pbuf);
149
150 while (shorts--) {
151 EIEIO;
152 *pbuf = *dbuf++;
153 }
154 }
155
156 __weak void ide_input_data_shorts(int dev, ushort *sect_buf, int shorts)
157 {
158 ushort *dbuf;
159 volatile ushort *pbuf;
160
161 pbuf = (ushort *)(ATA_CURR_BASE(dev) + ATA_DATA_REG);
162 dbuf = (ushort *)sect_buf;
163
164 debug("in input data shorts base for read is %lx\n",
165 (unsigned long) pbuf);
166
167 while (shorts--) {
168 EIEIO;
169 *dbuf++ = *pbuf;
170 }
171 }
172
173 #else /* ! CONFIG_IDE_SWAP_IO */
174 __weak void ide_output_data_shorts(int dev, ushort *sect_buf, int shorts)
175 {
176 outsw(ATA_CURR_BASE(dev) + ATA_DATA_REG, sect_buf, shorts);
177 }
178
179 __weak void ide_input_data_shorts(int dev, ushort *sect_buf, int shorts)
180 {
181 insw(ATA_CURR_BASE(dev) + ATA_DATA_REG, sect_buf, shorts);
182 }
183
184 #endif /* CONFIG_IDE_SWAP_IO */
185
186 /*
187 * Wait until (Status & mask) == res, or timeout (in ms)
188 * Return last status
189 * This is used since some ATAPI CD ROMs clears their Busy Bit first
190 * and then they set their DRQ Bit
191 */
192 static uchar atapi_wait_mask(int dev, ulong t, uchar mask, uchar res)
193 {
194 ulong delay = 10 * t; /* poll every 100 us */
195 uchar c;
196
197 /* prevents to read the status before valid */
198 c = ide_inb(dev, ATA_DEV_CTL);
199
200 while (((c = ide_inb(dev, ATA_STATUS)) & mask) != res) {
201 /* break if error occurs (doesn't make sense to wait more) */
202 if ((c & ATA_STAT_ERR) == ATA_STAT_ERR)
203 break;
204 udelay(100);
205 if (delay-- == 0)
206 break;
207 }
208 return c;
209 }
210
211 /*
212 * issue an atapi command
213 */
214 unsigned char atapi_issue(int device, unsigned char *ccb, int ccblen,
215 unsigned char *buffer, int buflen)
216 {
217 unsigned char c, err, mask, res;
218 int n;
219
220 ide_led(DEVICE_LED(device), 1); /* LED on */
221
222 /* Select device
223 */
224 mask = ATA_STAT_BUSY | ATA_STAT_DRQ;
225 res = 0;
226 ide_outb(device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device));
227 c = atapi_wait_mask(device, ATAPI_TIME_OUT, mask, res);
228 if ((c & mask) != res) {
229 printf("ATAPI_ISSUE: device %d not ready status %X\n", device,
230 c);
231 err = 0xFF;
232 goto AI_OUT;
233 }
234 /* write taskfile */
235 ide_outb(device, ATA_ERROR_REG, 0); /* no DMA, no overlaped */
236 ide_outb(device, ATA_SECT_CNT, 0);
237 ide_outb(device, ATA_SECT_NUM, 0);
238 ide_outb(device, ATA_CYL_LOW, (unsigned char) (buflen & 0xFF));
239 ide_outb(device, ATA_CYL_HIGH,
240 (unsigned char) ((buflen >> 8) & 0xFF));
241 ide_outb(device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device));
242
243 ide_outb(device, ATA_COMMAND, ATAPI_CMD_PACKET);
244 udelay(50);
245
246 mask = ATA_STAT_DRQ | ATA_STAT_BUSY | ATA_STAT_ERR;
247 res = ATA_STAT_DRQ;
248 c = atapi_wait_mask(device, ATAPI_TIME_OUT, mask, res);
249
250 if ((c & mask) != res) { /* DRQ must be 1, BSY 0 */
251 printf("ATAPI_ISSUE: Error (no IRQ) before sending ccb dev %d status 0x%02x\n",
252 device, c);
253 err = 0xFF;
254 goto AI_OUT;
255 }
256
257 /* write command block */
258 ide_output_data_shorts(device, (unsigned short *)ccb, ccblen / 2);
259
260 /* ATAPI Command written wait for completition */
261 udelay(5000); /* device must set bsy */
262
263 mask = ATA_STAT_DRQ | ATA_STAT_BUSY | ATA_STAT_ERR;
264 /*
265 * if no data wait for DRQ = 0 BSY = 0
266 * if data wait for DRQ = 1 BSY = 0
267 */
268 res = 0;
269 if (buflen)
270 res = ATA_STAT_DRQ;
271 c = atapi_wait_mask(device, ATAPI_TIME_OUT, mask, res);
272 if ((c & mask) != res) {
273 if (c & ATA_STAT_ERR) {
274 err = (ide_inb(device, ATA_ERROR_REG)) >> 4;
275 debug("atapi_issue 1 returned sense key %X status %02X\n",
276 err, c);
277 } else {
278 printf("ATAPI_ISSUE: (no DRQ) after sending ccb (%x) status 0x%02x\n",
279 ccb[0], c);
280 err = 0xFF;
281 }
282 goto AI_OUT;
283 }
284 n = ide_inb(device, ATA_CYL_HIGH);
285 n <<= 8;
286 n += ide_inb(device, ATA_CYL_LOW);
287 if (n > buflen) {
288 printf("ERROR, transfer bytes %d requested only %d\n", n,
289 buflen);
290 err = 0xff;
291 goto AI_OUT;
292 }
293 if ((n == 0) && (buflen < 0)) {
294 printf("ERROR, transfer bytes %d requested %d\n", n, buflen);
295 err = 0xff;
296 goto AI_OUT;
297 }
298 if (n != buflen) {
299 debug("WARNING, transfer bytes %d not equal with requested %d\n",
300 n, buflen);
301 }
302 if (n != 0) { /* data transfer */
303 debug("ATAPI_ISSUE: %d Bytes to transfer\n", n);
304 /* we transfer shorts */
305 n >>= 1;
306 /* ok now decide if it is an in or output */
307 if ((ide_inb(device, ATA_SECT_CNT) & 0x02) == 0) {
308 debug("Write to device\n");
309 ide_output_data_shorts(device, (unsigned short *)buffer,
310 n);
311 } else {
312 debug("Read from device @ %p shorts %d\n", buffer, n);
313 ide_input_data_shorts(device, (unsigned short *)buffer,
314 n);
315 }
316 }
317 udelay(5000); /* seems that some CD ROMs need this... */
318 mask = ATA_STAT_BUSY | ATA_STAT_ERR;
319 res = 0;
320 c = atapi_wait_mask(device, ATAPI_TIME_OUT, mask, res);
321 if ((c & ATA_STAT_ERR) == ATA_STAT_ERR) {
322 err = (ide_inb(device, ATA_ERROR_REG) >> 4);
323 debug("atapi_issue 2 returned sense key %X status %X\n", err,
324 c);
325 } else {
326 err = 0;
327 }
328 AI_OUT:
329 ide_led(DEVICE_LED(device), 0); /* LED off */
330 return err;
331 }
332
333 /*
334 * sending the command to atapi_issue. If an status other than good
335 * returns, an request_sense will be issued
336 */
337
338 #define ATAPI_DRIVE_NOT_READY 100
339 #define ATAPI_UNIT_ATTN 10
340
341 unsigned char atapi_issue_autoreq(int device,
342 unsigned char *ccb,
343 int ccblen,
344 unsigned char *buffer, int buflen)
345 {
346 unsigned char sense_data[18], sense_ccb[12];
347 unsigned char res, key, asc, ascq;
348 int notready, unitattn;
349
350 unitattn = ATAPI_UNIT_ATTN;
351 notready = ATAPI_DRIVE_NOT_READY;
352
353 retry:
354 res = atapi_issue(device, ccb, ccblen, buffer, buflen);
355 if (res == 0)
356 return 0; /* Ok */
357
358 if (res == 0xFF)
359 return 0xFF; /* error */
360
361 debug("(auto_req)atapi_issue returned sense key %X\n", res);
362
363 memset(sense_ccb, 0, sizeof(sense_ccb));
364 memset(sense_data, 0, sizeof(sense_data));
365 sense_ccb[0] = ATAPI_CMD_REQ_SENSE;
366 sense_ccb[4] = 18; /* allocation Length */
367
368 res = atapi_issue(device, sense_ccb, 12, sense_data, 18);
369 key = (sense_data[2] & 0xF);
370 asc = (sense_data[12]);
371 ascq = (sense_data[13]);
372
373 debug("ATAPI_CMD_REQ_SENSE returned %x\n", res);
374 debug(" Sense page: %02X key %02X ASC %02X ASCQ %02X\n",
375 sense_data[0], key, asc, ascq);
376
377 if ((key == 0))
378 return 0; /* ok device ready */
379
380 if ((key == 6) || (asc == 0x29) || (asc == 0x28)) { /* Unit Attention */
381 if (unitattn-- > 0) {
382 udelay(200 * 1000);
383 goto retry;
384 }
385 printf("Unit Attention, tried %d\n", ATAPI_UNIT_ATTN);
386 goto error;
387 }
388 if ((asc == 0x4) && (ascq == 0x1)) {
389 /* not ready, but will be ready soon */
390 if (notready-- > 0) {
391 udelay(200 * 1000);
392 goto retry;
393 }
394 printf("Drive not ready, tried %d times\n",
395 ATAPI_DRIVE_NOT_READY);
396 goto error;
397 }
398 if (asc == 0x3a) {
399 debug("Media not present\n");
400 goto error;
401 }
402
403 printf("ERROR: Unknown Sense key %02X ASC %02X ASCQ %02X\n", key, asc,
404 ascq);
405 error:
406 debug("ERROR Sense key %02X ASC %02X ASCQ %02X\n", key, asc, ascq);
407 return 0xFF;
408 }
409
410 /*
411 * atapi_read:
412 * we transfer only one block per command, since the multiple DRQ per
413 * command is not yet implemented
414 */
415 #define ATAPI_READ_MAX_BYTES 2048 /* we read max 2kbytes */
416 #define ATAPI_READ_BLOCK_SIZE 2048 /* assuming CD part */
417 #define ATAPI_READ_MAX_BLOCK (ATAPI_READ_MAX_BYTES/ATAPI_READ_BLOCK_SIZE)
418
419 ulong atapi_read(struct blk_desc *block_dev, lbaint_t blknr, lbaint_t blkcnt,
420 void *buffer)
421 {
422 int device = block_dev->devnum;
423 ulong n = 0;
424 unsigned char ccb[12]; /* Command descriptor block */
425 ulong cnt;
426
427 debug("atapi_read dev %d start " LBAF " blocks " LBAF
428 " buffer at %lX\n", device, blknr, blkcnt, (ulong) buffer);
429
430 do {
431 if (blkcnt > ATAPI_READ_MAX_BLOCK)
432 cnt = ATAPI_READ_MAX_BLOCK;
433 else
434 cnt = blkcnt;
435
436 ccb[0] = ATAPI_CMD_READ_12;
437 ccb[1] = 0; /* reserved */
438 ccb[2] = (unsigned char) (blknr >> 24) & 0xFF; /* MSB Block */
439 ccb[3] = (unsigned char) (blknr >> 16) & 0xFF; /* */
440 ccb[4] = (unsigned char) (blknr >> 8) & 0xFF;
441 ccb[5] = (unsigned char) blknr & 0xFF; /* LSB Block */
442 ccb[6] = (unsigned char) (cnt >> 24) & 0xFF; /* MSB Block cnt */
443 ccb[7] = (unsigned char) (cnt >> 16) & 0xFF;
444 ccb[8] = (unsigned char) (cnt >> 8) & 0xFF;
445 ccb[9] = (unsigned char) cnt & 0xFF; /* LSB Block */
446 ccb[10] = 0; /* reserved */
447 ccb[11] = 0; /* reserved */
448
449 if (atapi_issue_autoreq(device, ccb, 12,
450 (unsigned char *)buffer,
451 cnt * ATAPI_READ_BLOCK_SIZE)
452 == 0xFF) {
453 return n;
454 }
455 n += cnt;
456 blkcnt -= cnt;
457 blknr += cnt;
458 buffer += (cnt * ATAPI_READ_BLOCK_SIZE);
459 } while (blkcnt > 0);
460 return n;
461 }
462
463 static void atapi_inquiry(struct blk_desc *dev_desc)
464 {
465 unsigned char ccb[12]; /* Command descriptor block */
466 unsigned char iobuf[64]; /* temp buf */
467 unsigned char c;
468 int device;
469
470 device = dev_desc->devnum;
471 dev_desc->type = DEV_TYPE_UNKNOWN; /* not yet valid */
472 dev_desc->block_read = atapi_read;
473
474 memset(ccb, 0, sizeof(ccb));
475 memset(iobuf, 0, sizeof(iobuf));
476
477 ccb[0] = ATAPI_CMD_INQUIRY;
478 ccb[4] = 40; /* allocation Legnth */
479 c = atapi_issue_autoreq(device, ccb, 12, (unsigned char *)iobuf, 40);
480
481 debug("ATAPI_CMD_INQUIRY returned %x\n", c);
482 if (c != 0)
483 return;
484
485 /* copy device ident strings */
486 ident_cpy((unsigned char *)dev_desc->vendor, &iobuf[8], 8);
487 ident_cpy((unsigned char *)dev_desc->product, &iobuf[16], 16);
488 ident_cpy((unsigned char *)dev_desc->revision, &iobuf[32], 5);
489
490 dev_desc->lun = 0;
491 dev_desc->lba = 0;
492 dev_desc->blksz = 0;
493 dev_desc->log2blksz = LOG2_INVALID(typeof(dev_desc->log2blksz));
494 dev_desc->type = iobuf[0] & 0x1f;
495
496 if ((iobuf[1] & 0x80) == 0x80)
497 dev_desc->removable = 1;
498 else
499 dev_desc->removable = 0;
500
501 memset(ccb, 0, sizeof(ccb));
502 memset(iobuf, 0, sizeof(iobuf));
503 ccb[0] = ATAPI_CMD_START_STOP;
504 ccb[4] = 0x03; /* start */
505
506 c = atapi_issue_autoreq(device, ccb, 12, (unsigned char *)iobuf, 0);
507
508 debug("ATAPI_CMD_START_STOP returned %x\n", c);
509 if (c != 0)
510 return;
511
512 memset(ccb, 0, sizeof(ccb));
513 memset(iobuf, 0, sizeof(iobuf));
514 c = atapi_issue_autoreq(device, ccb, 12, (unsigned char *)iobuf, 0);
515
516 debug("ATAPI_CMD_UNIT_TEST_READY returned %x\n", c);
517 if (c != 0)
518 return;
519
520 memset(ccb, 0, sizeof(ccb));
521 memset(iobuf, 0, sizeof(iobuf));
522 ccb[0] = ATAPI_CMD_READ_CAP;
523 c = atapi_issue_autoreq(device, ccb, 12, (unsigned char *)iobuf, 8);
524 debug("ATAPI_CMD_READ_CAP returned %x\n", c);
525 if (c != 0)
526 return;
527
528 debug("Read Cap: LBA %02X%02X%02X%02X blksize %02X%02X%02X%02X\n",
529 iobuf[0], iobuf[1], iobuf[2], iobuf[3],
530 iobuf[4], iobuf[5], iobuf[6], iobuf[7]);
531
532 dev_desc->lba = ((unsigned long) iobuf[0] << 24) +
533 ((unsigned long) iobuf[1] << 16) +
534 ((unsigned long) iobuf[2] << 8) + ((unsigned long) iobuf[3]);
535 dev_desc->blksz = ((unsigned long) iobuf[4] << 24) +
536 ((unsigned long) iobuf[5] << 16) +
537 ((unsigned long) iobuf[6] << 8) + ((unsigned long) iobuf[7]);
538 dev_desc->log2blksz = LOG2(dev_desc->blksz);
539 #ifdef CONFIG_LBA48
540 /* ATAPI devices cannot use 48bit addressing (ATA/ATAPI v7) */
541 dev_desc->lba48 = 0;
542 #endif
543 return;
544 }
545
546 #endif /* CONFIG_ATAPI */
547
548 static void ide_ident(struct blk_desc *dev_desc)
549 {
550 unsigned char c;
551 hd_driveid_t iop;
552
553 #ifdef CONFIG_ATAPI
554 int retries = 0;
555 #endif
556 int device;
557
558 device = dev_desc->devnum;
559 printf(" Device %d: ", device);
560
561 ide_led(DEVICE_LED(device), 1); /* LED on */
562 /* Select device
563 */
564 ide_outb(device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device));
565 dev_desc->if_type = IF_TYPE_IDE;
566 #ifdef CONFIG_ATAPI
567
568 retries = 0;
569
570 /* Warning: This will be tricky to read */
571 while (retries <= 1) {
572 /* check signature */
573 if ((ide_inb(device, ATA_SECT_CNT) == 0x01) &&
574 (ide_inb(device, ATA_SECT_NUM) == 0x01) &&
575 (ide_inb(device, ATA_CYL_LOW) == 0x14) &&
576 (ide_inb(device, ATA_CYL_HIGH) == 0xEB)) {
577 /* ATAPI Signature found */
578 dev_desc->if_type = IF_TYPE_ATAPI;
579 /*
580 * Start Ident Command
581 */
582 ide_outb(device, ATA_COMMAND, ATAPI_CMD_IDENT);
583 /*
584 * Wait for completion - ATAPI devices need more time
585 * to become ready
586 */
587 c = ide_wait(device, ATAPI_TIME_OUT);
588 } else
589 #endif
590 {
591 /*
592 * Start Ident Command
593 */
594 ide_outb(device, ATA_COMMAND, ATA_CMD_IDENT);
595
596 /*
597 * Wait for completion
598 */
599 c = ide_wait(device, IDE_TIME_OUT);
600 }
601 ide_led(DEVICE_LED(device), 0); /* LED off */
602
603 if (((c & ATA_STAT_DRQ) == 0) ||
604 ((c & (ATA_STAT_FAULT | ATA_STAT_ERR)) != 0)) {
605 #ifdef CONFIG_ATAPI
606 {
607 /*
608 * Need to soft reset the device
609 * in case it's an ATAPI...
610 */
611 debug("Retrying...\n");
612 ide_outb(device, ATA_DEV_HD,
613 ATA_LBA | ATA_DEVICE(device));
614 udelay(100000);
615 ide_outb(device, ATA_COMMAND, 0x08);
616 udelay(500000); /* 500 ms */
617 }
618 /*
619 * Select device
620 */
621 ide_outb(device, ATA_DEV_HD,
622 ATA_LBA | ATA_DEVICE(device));
623 retries++;
624 #else
625 return;
626 #endif
627 }
628 #ifdef CONFIG_ATAPI
629 else
630 break;
631 } /* see above - ugly to read */
632
633 if (retries == 2) /* Not found */
634 return;
635 #endif
636
637 ide_input_swap_data(device, (ulong *)&iop, ATA_SECTORWORDS);
638
639 ident_cpy((unsigned char *)dev_desc->revision, iop.fw_rev,
640 sizeof(dev_desc->revision));
641 ident_cpy((unsigned char *)dev_desc->vendor, iop.model,
642 sizeof(dev_desc->vendor));
643 ident_cpy((unsigned char *)dev_desc->product, iop.serial_no,
644 sizeof(dev_desc->product));
645 #ifdef __LITTLE_ENDIAN
646 /*
647 * firmware revision, model, and serial number have Big Endian Byte
648 * order in Word. Convert all three to little endian.
649 *
650 * See CF+ and CompactFlash Specification Revision 2.0:
651 * 6.2.1.6: Identify Drive, Table 39 for more details
652 */
653
654 strswab(dev_desc->revision);
655 strswab(dev_desc->vendor);
656 strswab(dev_desc->product);
657 #endif /* __LITTLE_ENDIAN */
658
659 if ((iop.config & 0x0080) == 0x0080)
660 dev_desc->removable = 1;
661 else
662 dev_desc->removable = 0;
663
664 #ifdef CONFIG_ATAPI
665 if (dev_desc->if_type == IF_TYPE_ATAPI) {
666 atapi_inquiry(dev_desc);
667 return;
668 }
669 #endif /* CONFIG_ATAPI */
670
671 #ifdef __BIG_ENDIAN
672 /* swap shorts */
673 dev_desc->lba = (iop.lba_capacity << 16) | (iop.lba_capacity >> 16);
674 #else /* ! __BIG_ENDIAN */
675 /*
676 * do not swap shorts on little endian
677 *
678 * See CF+ and CompactFlash Specification Revision 2.0:
679 * 6.2.1.6: Identfy Drive, Table 39, Word Address 57-58 for details.
680 */
681 dev_desc->lba = iop.lba_capacity;
682 #endif /* __BIG_ENDIAN */
683
684 #ifdef CONFIG_LBA48
685 if (iop.command_set_2 & 0x0400) { /* LBA 48 support */
686 dev_desc->lba48 = 1;
687 dev_desc->lba = (unsigned long long) iop.lba48_capacity[0] |
688 ((unsigned long long) iop.lba48_capacity[1] << 16) |
689 ((unsigned long long) iop.lba48_capacity[2] << 32) |
690 ((unsigned long long) iop.lba48_capacity[3] << 48);
691 } else {
692 dev_desc->lba48 = 0;
693 }
694 #endif /* CONFIG_LBA48 */
695 /* assuming HD */
696 dev_desc->type = DEV_TYPE_HARDDISK;
697 dev_desc->blksz = ATA_BLOCKSIZE;
698 dev_desc->log2blksz = LOG2(dev_desc->blksz);
699 dev_desc->lun = 0; /* just to fill something in... */
700
701 #if 0 /* only used to test the powersaving mode,
702 * if enabled, the drive goes after 5 sec
703 * in standby mode */
704 ide_outb(device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device));
705 c = ide_wait(device, IDE_TIME_OUT);
706 ide_outb(device, ATA_SECT_CNT, 1);
707 ide_outb(device, ATA_LBA_LOW, 0);
708 ide_outb(device, ATA_LBA_MID, 0);
709 ide_outb(device, ATA_LBA_HIGH, 0);
710 ide_outb(device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device));
711 ide_outb(device, ATA_COMMAND, 0xe3);
712 udelay(50);
713 c = ide_wait(device, IDE_TIME_OUT); /* can't take over 500 ms */
714 #endif
715 }
716
717 __weak void ide_led(uchar led, uchar status)
718 {
719 #if defined(CONFIG_IDE_LED) && defined(PER8_BASE) /* required by LED_PORT */
720 static uchar led_buffer; /* Buffer for current LED status */
721
722 uchar *led_port = LED_PORT;
723
724 if (status) /* switch LED on */
725 led_buffer |= led;
726 else /* switch LED off */
727 led_buffer &= ~led;
728
729 *led_port = led_buffer;
730 #endif
731 }
732
733 __weak void ide_outb(int dev, int port, unsigned char val)
734 {
735 debug("ide_outb (dev= %d, port= 0x%x, val= 0x%02x) : @ 0x%08lx\n",
736 dev, port, val,
737 (ATA_CURR_BASE(dev) + CONFIG_SYS_ATA_PORT_ADDR(port)));
738
739 #if defined(CONFIG_IDE_AHB)
740 if (port) {
741 /* write command */
742 ide_write_register(dev, port, val);
743 } else {
744 /* write data */
745 outb(val, (ATA_CURR_BASE(dev)));
746 }
747 #else
748 outb(val, (ATA_CURR_BASE(dev) + CONFIG_SYS_ATA_PORT_ADDR(port)));
749 #endif
750 }
751
752 __weak unsigned char ide_inb(int dev, int port)
753 {
754 uchar val;
755
756 #if defined(CONFIG_IDE_AHB)
757 val = ide_read_register(dev, port);
758 #else
759 val = inb((ATA_CURR_BASE(dev) + CONFIG_SYS_ATA_PORT_ADDR(port)));
760 #endif
761
762 debug("ide_inb (dev= %d, port= 0x%x) : @ 0x%08lx -> 0x%02x\n",
763 dev, port,
764 (ATA_CURR_BASE(dev) + CONFIG_SYS_ATA_PORT_ADDR(port)), val);
765 return val;
766 }
767
768 void ide_init(void)
769 {
770 unsigned char c;
771 int i, bus;
772
773 #ifdef CONFIG_IDE_8xx_PCCARD
774 extern int ide_devices_found; /* Initialized in check_ide_device() */
775 #endif /* CONFIG_IDE_8xx_PCCARD */
776
777 #ifdef CONFIG_IDE_PREINIT
778 WATCHDOG_RESET();
779
780 if (ide_preinit()) {
781 puts("ide_preinit failed\n");
782 return;
783 }
784 #endif /* CONFIG_IDE_PREINIT */
785
786 WATCHDOG_RESET();
787
788 /*
789 * Reset the IDE just to be sure.
790 * Light LED's to show
791 */
792 ide_led((LED_IDE1 | LED_IDE2), 1); /* LED's on */
793
794 /* ATAPI Drives seems to need a proper IDE Reset */
795 ide_reset();
796
797 #ifdef CONFIG_IDE_INIT_POSTRESET
798 WATCHDOG_RESET();
799
800 if (ide_init_postreset()) {
801 puts("ide_preinit_postreset failed\n");
802 return;
803 }
804 #endif /* CONFIG_IDE_INIT_POSTRESET */
805
806 /*
807 * Wait for IDE to get ready.
808 * According to spec, this can take up to 31 seconds!
809 */
810 for (bus = 0; bus < CONFIG_SYS_IDE_MAXBUS; ++bus) {
811 int dev =
812 bus * (CONFIG_SYS_IDE_MAXDEVICE /
813 CONFIG_SYS_IDE_MAXBUS);
814
815 #ifdef CONFIG_IDE_8xx_PCCARD
816 /* Skip non-ide devices from probing */
817 if ((ide_devices_found & (1 << bus)) == 0) {
818 ide_led((LED_IDE1 | LED_IDE2), 0); /* LED's off */
819 continue;
820 }
821 #endif
822 printf("Bus %d: ", bus);
823
824 ide_bus_ok[bus] = 0;
825
826 /* Select device
827 */
828 udelay(100000); /* 100 ms */
829 ide_outb(dev, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(dev));
830 udelay(100000); /* 100 ms */
831 i = 0;
832 do {
833 udelay(10000); /* 10 ms */
834
835 c = ide_inb(dev, ATA_STATUS);
836 i++;
837 if (i > (ATA_RESET_TIME * 100)) {
838 puts("** Timeout **\n");
839 /* LED's off */
840 ide_led((LED_IDE1 | LED_IDE2), 0);
841 return;
842 }
843 if ((i >= 100) && ((i % 100) == 0))
844 putc('.');
845
846 } while (c & ATA_STAT_BUSY);
847
848 if (c & (ATA_STAT_BUSY | ATA_STAT_FAULT)) {
849 puts("not available ");
850 debug("Status = 0x%02X ", c);
851 #ifndef CONFIG_ATAPI /* ATAPI Devices do not set DRDY */
852 } else if ((c & ATA_STAT_READY) == 0) {
853 puts("not available ");
854 debug("Status = 0x%02X ", c);
855 #endif
856 } else {
857 puts("OK ");
858 ide_bus_ok[bus] = 1;
859 }
860 WATCHDOG_RESET();
861 }
862
863 putc('\n');
864
865 ide_led((LED_IDE1 | LED_IDE2), 0); /* LED's off */
866
867 for (i = 0; i < CONFIG_SYS_IDE_MAXDEVICE; ++i) {
868 int led = (IDE_BUS(i) == 0) ? LED_IDE1 : LED_IDE2;
869 ide_dev_desc[i].type = DEV_TYPE_UNKNOWN;
870 ide_dev_desc[i].if_type = IF_TYPE_IDE;
871 ide_dev_desc[i].devnum = i;
872 ide_dev_desc[i].part_type = PART_TYPE_UNKNOWN;
873 ide_dev_desc[i].blksz = 0;
874 ide_dev_desc[i].log2blksz =
875 LOG2_INVALID(typeof(ide_dev_desc[i].log2blksz));
876 ide_dev_desc[i].lba = 0;
877 #ifndef CONFIG_BLK
878 ide_dev_desc[i].block_read = ide_read;
879 ide_dev_desc[i].block_write = ide_write;
880 #endif
881 if (!ide_bus_ok[IDE_BUS(i)])
882 continue;
883 ide_led(led, 1); /* LED on */
884 ide_ident(&ide_dev_desc[i]);
885 ide_led(led, 0); /* LED off */
886 dev_print(&ide_dev_desc[i]);
887
888 if ((ide_dev_desc[i].lba > 0) && (ide_dev_desc[i].blksz > 0)) {
889 /* initialize partition type */
890 part_init(&ide_dev_desc[i]);
891 }
892 }
893 WATCHDOG_RESET();
894 }
895
896 /* We only need to swap data if we are running on a big endian cpu. */
897 #if defined(__LITTLE_ENDIAN)
898 __weak void ide_input_swap_data(int dev, ulong *sect_buf, int words)
899 {
900 ide_input_data(dev, sect_buf, words);
901 }
902 #else
903 __weak void ide_input_swap_data(int dev, ulong *sect_buf, int words)
904 {
905 volatile ushort *pbuf =
906 (ushort *)(ATA_CURR_BASE(dev) + ATA_DATA_REG);
907 ushort *dbuf = (ushort *)sect_buf;
908
909 debug("in input swap data base for read is %lx\n",
910 (unsigned long) pbuf);
911
912 while (words--) {
913 #ifdef __MIPS__
914 *dbuf++ = swab16p((u16 *)pbuf);
915 *dbuf++ = swab16p((u16 *)pbuf);
916 #else
917 *dbuf++ = ld_le16(pbuf);
918 *dbuf++ = ld_le16(pbuf);
919 #endif /* !MIPS */
920 }
921 }
922 #endif /* __LITTLE_ENDIAN */
923
924
925 #if defined(CONFIG_IDE_SWAP_IO)
926 __weak void ide_output_data(int dev, const ulong *sect_buf, int words)
927 {
928 ushort *dbuf;
929 volatile ushort *pbuf;
930
931 pbuf = (ushort *)(ATA_CURR_BASE(dev) + ATA_DATA_REG);
932 dbuf = (ushort *)sect_buf;
933 while (words--) {
934 EIEIO;
935 *pbuf = *dbuf++;
936 EIEIO;
937 *pbuf = *dbuf++;
938 }
939 }
940 #else /* ! CONFIG_IDE_SWAP_IO */
941 __weak void ide_output_data(int dev, const ulong *sect_buf, int words)
942 {
943 #if defined(CONFIG_IDE_AHB)
944 ide_write_data(dev, sect_buf, words);
945 #else
946 outsw(ATA_CURR_BASE(dev) + ATA_DATA_REG, sect_buf, words << 1);
947 #endif
948 }
949 #endif /* CONFIG_IDE_SWAP_IO */
950
951 #if defined(CONFIG_IDE_SWAP_IO)
952 __weak void ide_input_data(int dev, ulong *sect_buf, int words)
953 {
954 ushort *dbuf;
955 volatile ushort *pbuf;
956
957 pbuf = (ushort *)(ATA_CURR_BASE(dev) + ATA_DATA_REG);
958 dbuf = (ushort *)sect_buf;
959
960 debug("in input data base for read is %lx\n", (unsigned long) pbuf);
961
962 while (words--) {
963 EIEIO;
964 *dbuf++ = *pbuf;
965 EIEIO;
966 *dbuf++ = *pbuf;
967 }
968 }
969 #else /* ! CONFIG_IDE_SWAP_IO */
970 __weak void ide_input_data(int dev, ulong *sect_buf, int words)
971 {
972 #if defined(CONFIG_IDE_AHB)
973 ide_read_data(dev, sect_buf, words);
974 #else
975 insw(ATA_CURR_BASE(dev) + ATA_DATA_REG, sect_buf, words << 1);
976 #endif
977 }
978
979 #endif /* CONFIG_IDE_SWAP_IO */
980
981 #ifdef CONFIG_BLK
982 ulong ide_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt,
983 void *buffer)
984 #else
985 ulong ide_read(struct blk_desc *block_dev, lbaint_t blknr, lbaint_t blkcnt,
986 void *buffer)
987 #endif
988 {
989 #ifdef CONFIG_BLK
990 struct blk_desc *block_dev = dev_get_uclass_platdata(dev);
991 #endif
992 int device = block_dev->devnum;
993 ulong n = 0;
994 unsigned char c;
995 unsigned char pwrsave = 0; /* power save */
996
997 #ifdef CONFIG_LBA48
998 unsigned char lba48 = 0;
999
1000 if (blknr & 0x0000fffff0000000ULL) {
1001 /* more than 28 bits used, use 48bit mode */
1002 lba48 = 1;
1003 }
1004 #endif
1005 debug("ide_read dev %d start " LBAF ", blocks " LBAF " buffer at %lX\n",
1006 device, blknr, blkcnt, (ulong) buffer);
1007
1008 ide_led(DEVICE_LED(device), 1); /* LED on */
1009
1010 /* Select device
1011 */
1012 ide_outb(device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device));
1013 c = ide_wait(device, IDE_TIME_OUT);
1014
1015 if (c & ATA_STAT_BUSY) {
1016 printf("IDE read: device %d not ready\n", device);
1017 goto IDE_READ_E;
1018 }
1019
1020 /* first check if the drive is in Powersaving mode, if yes,
1021 * increase the timeout value */
1022 ide_outb(device, ATA_COMMAND, ATA_CMD_CHK_PWR);
1023 udelay(50);
1024
1025 c = ide_wait(device, IDE_TIME_OUT); /* can't take over 500 ms */
1026
1027 if (c & ATA_STAT_BUSY) {
1028 printf("IDE read: device %d not ready\n", device);
1029 goto IDE_READ_E;
1030 }
1031 if ((c & ATA_STAT_ERR) == ATA_STAT_ERR) {
1032 printf("No Powersaving mode %X\n", c);
1033 } else {
1034 c = ide_inb(device, ATA_SECT_CNT);
1035 debug("Powersaving %02X\n", c);
1036 if (c == 0)
1037 pwrsave = 1;
1038 }
1039
1040
1041 while (blkcnt-- > 0) {
1042 c = ide_wait(device, IDE_TIME_OUT);
1043
1044 if (c & ATA_STAT_BUSY) {
1045 printf("IDE read: device %d not ready\n", device);
1046 break;
1047 }
1048 #ifdef CONFIG_LBA48
1049 if (lba48) {
1050 /* write high bits */
1051 ide_outb(device, ATA_SECT_CNT, 0);
1052 ide_outb(device, ATA_LBA_LOW, (blknr >> 24) & 0xFF);
1053 #ifdef CONFIG_SYS_64BIT_LBA
1054 ide_outb(device, ATA_LBA_MID, (blknr >> 32) & 0xFF);
1055 ide_outb(device, ATA_LBA_HIGH, (blknr >> 40) & 0xFF);
1056 #else
1057 ide_outb(device, ATA_LBA_MID, 0);
1058 ide_outb(device, ATA_LBA_HIGH, 0);
1059 #endif
1060 }
1061 #endif
1062 ide_outb(device, ATA_SECT_CNT, 1);
1063 ide_outb(device, ATA_LBA_LOW, (blknr >> 0) & 0xFF);
1064 ide_outb(device, ATA_LBA_MID, (blknr >> 8) & 0xFF);
1065 ide_outb(device, ATA_LBA_HIGH, (blknr >> 16) & 0xFF);
1066
1067 #ifdef CONFIG_LBA48
1068 if (lba48) {
1069 ide_outb(device, ATA_DEV_HD,
1070 ATA_LBA | ATA_DEVICE(device));
1071 ide_outb(device, ATA_COMMAND, ATA_CMD_READ_EXT);
1072
1073 } else
1074 #endif
1075 {
1076 ide_outb(device, ATA_DEV_HD, ATA_LBA |
1077 ATA_DEVICE(device) | ((blknr >> 24) & 0xF));
1078 ide_outb(device, ATA_COMMAND, ATA_CMD_READ);
1079 }
1080
1081 udelay(50);
1082
1083 if (pwrsave) {
1084 /* may take up to 4 sec */
1085 c = ide_wait(device, IDE_SPIN_UP_TIME_OUT);
1086 pwrsave = 0;
1087 } else {
1088 /* can't take over 500 ms */
1089 c = ide_wait(device, IDE_TIME_OUT);
1090 }
1091
1092 if ((c & (ATA_STAT_DRQ | ATA_STAT_BUSY | ATA_STAT_ERR)) !=
1093 ATA_STAT_DRQ) {
1094 printf("Error (no IRQ) dev %d blk " LBAF
1095 ": status %#02x\n", device, blknr, c);
1096 break;
1097 }
1098
1099 ide_input_data(device, buffer, ATA_SECTORWORDS);
1100 (void) ide_inb(device, ATA_STATUS); /* clear IRQ */
1101
1102 ++n;
1103 ++blknr;
1104 buffer += ATA_BLOCKSIZE;
1105 }
1106 IDE_READ_E:
1107 ide_led(DEVICE_LED(device), 0); /* LED off */
1108 return n;
1109 }
1110
1111 #ifdef CONFIG_BLK
1112 ulong ide_write(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt,
1113 const void *buffer)
1114 #else
1115 ulong ide_write(struct blk_desc *block_dev, lbaint_t blknr, lbaint_t blkcnt,
1116 const void *buffer)
1117 #endif
1118 {
1119 #ifdef CONFIG_BLK
1120 struct blk_desc *block_dev = dev_get_uclass_platdata(dev);
1121 #endif
1122 int device = block_dev->devnum;
1123 ulong n = 0;
1124 unsigned char c;
1125
1126 #ifdef CONFIG_LBA48
1127 unsigned char lba48 = 0;
1128
1129 if (blknr & 0x0000fffff0000000ULL) {
1130 /* more than 28 bits used, use 48bit mode */
1131 lba48 = 1;
1132 }
1133 #endif
1134
1135 ide_led(DEVICE_LED(device), 1); /* LED on */
1136
1137 /* Select device
1138 */
1139 ide_outb(device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device));
1140
1141 while (blkcnt-- > 0) {
1142 c = ide_wait(device, IDE_TIME_OUT);
1143
1144 if (c & ATA_STAT_BUSY) {
1145 printf("IDE read: device %d not ready\n", device);
1146 goto WR_OUT;
1147 }
1148 #ifdef CONFIG_LBA48
1149 if (lba48) {
1150 /* write high bits */
1151 ide_outb(device, ATA_SECT_CNT, 0);
1152 ide_outb(device, ATA_LBA_LOW, (blknr >> 24) & 0xFF);
1153 #ifdef CONFIG_SYS_64BIT_LBA
1154 ide_outb(device, ATA_LBA_MID, (blknr >> 32) & 0xFF);
1155 ide_outb(device, ATA_LBA_HIGH, (blknr >> 40) & 0xFF);
1156 #else
1157 ide_outb(device, ATA_LBA_MID, 0);
1158 ide_outb(device, ATA_LBA_HIGH, 0);
1159 #endif
1160 }
1161 #endif
1162 ide_outb(device, ATA_SECT_CNT, 1);
1163 ide_outb(device, ATA_LBA_LOW, (blknr >> 0) & 0xFF);
1164 ide_outb(device, ATA_LBA_MID, (blknr >> 8) & 0xFF);
1165 ide_outb(device, ATA_LBA_HIGH, (blknr >> 16) & 0xFF);
1166
1167 #ifdef CONFIG_LBA48
1168 if (lba48) {
1169 ide_outb(device, ATA_DEV_HD,
1170 ATA_LBA | ATA_DEVICE(device));
1171 ide_outb(device, ATA_COMMAND, ATA_CMD_WRITE_EXT);
1172
1173 } else
1174 #endif
1175 {
1176 ide_outb(device, ATA_DEV_HD, ATA_LBA |
1177 ATA_DEVICE(device) | ((blknr >> 24) & 0xF));
1178 ide_outb(device, ATA_COMMAND, ATA_CMD_WRITE);
1179 }
1180
1181 udelay(50);
1182
1183 /* can't take over 500 ms */
1184 c = ide_wait(device, IDE_TIME_OUT);
1185
1186 if ((c & (ATA_STAT_DRQ | ATA_STAT_BUSY | ATA_STAT_ERR)) !=
1187 ATA_STAT_DRQ) {
1188 printf("Error (no IRQ) dev %d blk " LBAF
1189 ": status %#02x\n", device, blknr, c);
1190 goto WR_OUT;
1191 }
1192
1193 ide_output_data(device, buffer, ATA_SECTORWORDS);
1194 c = ide_inb(device, ATA_STATUS); /* clear IRQ */
1195 ++n;
1196 ++blknr;
1197 buffer += ATA_BLOCKSIZE;
1198 }
1199 WR_OUT:
1200 ide_led(DEVICE_LED(device), 0); /* LED off */
1201 return n;
1202 }
1203
1204 #if defined(CONFIG_OF_IDE_FIXUP)
1205 int ide_device_present(int dev)
1206 {
1207 if (dev >= CONFIG_SYS_IDE_MAXBUS)
1208 return 0;
1209 return ide_dev_desc[dev].type == DEV_TYPE_UNKNOWN ? 0 : 1;
1210 }
1211 #endif
1212
1213 #ifdef CONFIG_BLK
1214 static const struct blk_ops ide_blk_ops = {
1215 .read = ide_read,
1216 .write = ide_write,
1217 };
1218
1219 U_BOOT_DRIVER(ide_blk) = {
1220 .name = "ide_blk",
1221 .id = UCLASS_BLK,
1222 .ops = &ide_blk_ops,
1223 };
1224 #else
1225 U_BOOT_LEGACY_BLK(ide) = {
1226 .if_typename = "ide",
1227 .if_type = IF_TYPE_IDE,
1228 .max_devs = CONFIG_SYS_IDE_MAXDEVICE,
1229 .desc = ide_dev_desc,
1230 };
1231 #endif
1232
drivers/block/sil680.c
1 /* 1 /*
2 * (C) Copyright 2007 2 * (C) Copyright 2007
3 * Gary Jennejohn, DENX Software Engineering, garyj@denx.de. 3 * Gary Jennejohn, DENX Software Engineering, garyj@denx.de.
4 * 4 *
5 * SPDX-License-Identifier: GPL-2.0+ 5 * SPDX-License-Identifier: GPL-2.0+
6 */ 6 */
7 /* sil680.c - ide support functions for the Sil0680A controller */ 7 /* sil680.c - ide support functions for the Sil0680A controller */
8 8
9 /* 9 /*
10 * The following parameters must be defined in the configuration file 10 * The following parameters must be defined in the configuration file
11 * of the target board: 11 * of the target board:
12 * 12 *
13 * #define CONFIG_IDE_SIL680 13 * #define CONFIG_IDE_SIL680
14 * 14 *
15 * #define CONFIG_PCI_PNP 15 * #define CONFIG_PCI_PNP
16 * NOTE it may also be necessary to define this if the default of 8 is 16 * NOTE it may also be necessary to define this if the default of 8 is
17 * incorrect for the target board (e.g. the sequoia board requires 0). 17 * incorrect for the target board (e.g. the sequoia board requires 0).
18 * #define CONFIG_SYS_PCI_CACHE_LINE_SIZE 0 18 * #define CONFIG_SYS_PCI_CACHE_LINE_SIZE 0
19 * 19 *
20 * #define CONFIG_CMD_IDE 20 * #define CONFIG_IDE
21 * #undef CONFIG_IDE_8xx_DIRECT 21 * #undef CONFIG_IDE_8xx_DIRECT
22 * #undef CONFIG_IDE_LED 22 * #undef CONFIG_IDE_LED
23 * #undef CONFIG_IDE_RESET 23 * #undef CONFIG_IDE_RESET
24 * #define CONFIG_IDE_PREINIT 24 * #define CONFIG_IDE_PREINIT
25 * #define CONFIG_SYS_IDE_MAXBUS 2 - modify to suit 25 * #define CONFIG_SYS_IDE_MAXBUS 2 - modify to suit
26 * #define CONFIG_SYS_IDE_MAXDEVICE (CONFIG_SYS_IDE_MAXBUS*2) - modify to suit 26 * #define CONFIG_SYS_IDE_MAXDEVICE (CONFIG_SYS_IDE_MAXBUS*2) - modify to suit
27 * #define CONFIG_SYS_ATA_BASE_ADDR 0 27 * #define CONFIG_SYS_ATA_BASE_ADDR 0
28 * #define CONFIG_SYS_ATA_IDE0_OFFSET 0 28 * #define CONFIG_SYS_ATA_IDE0_OFFSET 0
29 * #define CONFIG_SYS_ATA_IDE1_OFFSET 0 29 * #define CONFIG_SYS_ATA_IDE1_OFFSET 0
30 * #define CONFIG_SYS_ATA_DATA_OFFSET 0 30 * #define CONFIG_SYS_ATA_DATA_OFFSET 0
31 * #define CONFIG_SYS_ATA_REG_OFFSET 0 31 * #define CONFIG_SYS_ATA_REG_OFFSET 0
32 * #define CONFIG_SYS_ATA_ALT_OFFSET 0x0004 32 * #define CONFIG_SYS_ATA_ALT_OFFSET 0x0004
33 * 33 *
34 * The mapping for PCI IO-space. 34 * The mapping for PCI IO-space.
35 * NOTE this is the value for the sequoia board. Modify to suit. 35 * NOTE this is the value for the sequoia board. Modify to suit.
36 * #define CONFIG_SYS_PCI0_IO_SPACE 0xE8000000 36 * #define CONFIG_SYS_PCI0_IO_SPACE 0xE8000000
37 */ 37 */
38 38
39 #include <common.h> 39 #include <common.h>
40 #include <ata.h> 40 #include <ata.h>
41 #include <ide.h> 41 #include <ide.h>
42 #include <pci.h> 42 #include <pci.h>
43 43
44 extern ulong ide_bus_offset[CONFIG_SYS_IDE_MAXBUS]; 44 extern ulong ide_bus_offset[CONFIG_SYS_IDE_MAXBUS];
45 45
46 int ide_preinit (void) 46 int ide_preinit (void)
47 { 47 {
48 int status; 48 int status;
49 pci_dev_t devbusfn; 49 pci_dev_t devbusfn;
50 int l; 50 int l;
51 51
52 status = 1; 52 status = 1;
53 for (l = 0; l < CONFIG_SYS_IDE_MAXBUS; l++) { 53 for (l = 0; l < CONFIG_SYS_IDE_MAXBUS; l++) {
54 ide_bus_offset[l] = -ATA_STATUS; 54 ide_bus_offset[l] = -ATA_STATUS;
55 } 55 }
56 devbusfn = pci_find_device (0x1095, 0x0680, 0); 56 devbusfn = pci_find_device (0x1095, 0x0680, 0);
57 if (devbusfn != -1) { 57 if (devbusfn != -1) {
58 status = 0; 58 status = 0;
59 59
60 pci_read_config_dword (devbusfn, PCI_BASE_ADDRESS_0, 60 pci_read_config_dword (devbusfn, PCI_BASE_ADDRESS_0,
61 (u32 *) &ide_bus_offset[0]); 61 (u32 *) &ide_bus_offset[0]);
62 ide_bus_offset[0] &= 0xfffffff8; 62 ide_bus_offset[0] &= 0xfffffff8;
63 ide_bus_offset[0] += CONFIG_SYS_PCI0_IO_SPACE; 63 ide_bus_offset[0] += CONFIG_SYS_PCI0_IO_SPACE;
64 pci_read_config_dword (devbusfn, PCI_BASE_ADDRESS_2, 64 pci_read_config_dword (devbusfn, PCI_BASE_ADDRESS_2,
65 (u32 *) &ide_bus_offset[1]); 65 (u32 *) &ide_bus_offset[1]);
66 ide_bus_offset[1] &= 0xfffffff8; 66 ide_bus_offset[1] &= 0xfffffff8;
67 ide_bus_offset[1] += CONFIG_SYS_PCI0_IO_SPACE; 67 ide_bus_offset[1] += CONFIG_SYS_PCI0_IO_SPACE;
68 /* init various things - taken from the Linux driver */ 68 /* init various things - taken from the Linux driver */
69 /* set PIO mode */ 69 /* set PIO mode */
70 pci_write_config_byte(devbusfn, 0x80, 0x00); 70 pci_write_config_byte(devbusfn, 0x80, 0x00);
71 pci_write_config_byte(devbusfn, 0x84, 0x00); 71 pci_write_config_byte(devbusfn, 0x84, 0x00);
72 /* IDE0 */ 72 /* IDE0 */
73 pci_write_config_byte(devbusfn, 0xA1, 0x02); 73 pci_write_config_byte(devbusfn, 0xA1, 0x02);
74 pci_write_config_word(devbusfn, 0xA2, 0x328A); 74 pci_write_config_word(devbusfn, 0xA2, 0x328A);
75 pci_write_config_dword(devbusfn, 0xA4, 0x62DD62DD); 75 pci_write_config_dword(devbusfn, 0xA4, 0x62DD62DD);
76 pci_write_config_dword(devbusfn, 0xA8, 0x43924392); 76 pci_write_config_dword(devbusfn, 0xA8, 0x43924392);
77 pci_write_config_dword(devbusfn, 0xAC, 0x40094009); 77 pci_write_config_dword(devbusfn, 0xAC, 0x40094009);
78 /* IDE1 */ 78 /* IDE1 */
79 pci_write_config_byte(devbusfn, 0xB1, 0x02); 79 pci_write_config_byte(devbusfn, 0xB1, 0x02);
80 pci_write_config_word(devbusfn, 0xB2, 0x328A); 80 pci_write_config_word(devbusfn, 0xB2, 0x328A);
81 pci_write_config_dword(devbusfn, 0xB4, 0x62DD62DD); 81 pci_write_config_dword(devbusfn, 0xB4, 0x62DD62DD);
82 pci_write_config_dword(devbusfn, 0xB8, 0x43924392); 82 pci_write_config_dword(devbusfn, 0xB8, 0x43924392);
83 pci_write_config_dword(devbusfn, 0xBC, 0x40094009); 83 pci_write_config_dword(devbusfn, 0xBC, 0x40094009);
84 } 84 }
85 return (status); 85 return (status);
86 } 86 }
87 87
88 void ide_set_reset (int flag) { 88 void ide_set_reset (int flag) {
89 return; 89 return;
90 } 90 }
91 91
drivers/pcmcia/marubun_pcmcia.c
1 /* 1 /*
2 * Marubun MR-SHPC-01 PCMCIA controller device driver 2 * Marubun MR-SHPC-01 PCMCIA controller device driver
3 * 3 *
4 * (c) 2007 Nobuhiro Iwamatsu <iwamatsu@nigauri.org> 4 * (c) 2007 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
5 * 5 *
6 * SPDX-License-Identifier: GPL-2.0+ 6 * SPDX-License-Identifier: GPL-2.0+
7 */ 7 */
8 8
9 #include <common.h> 9 #include <common.h>
10 #include <config.h> 10 #include <config.h>
11 #include <pcmcia.h> 11 #include <pcmcia.h>
12 #include <asm/io.h> 12 #include <asm/io.h>
13 13
14 #undef CONFIG_PCMCIA 14 #undef CONFIG_PCMCIA
15 15
16 #if defined(CONFIG_CMD_PCMCIA) 16 #if defined(CONFIG_CMD_PCMCIA)
17 #define CONFIG_PCMCIA 17 #define CONFIG_PCMCIA
18 #endif 18 #endif
19 19
20 #if defined(CONFIG_CMD_IDE) 20 #if defined(CONFIG_IDE)
21 #define CONFIG_PCMCIA 21 #define CONFIG_PCMCIA
22 #endif 22 #endif
23 23
24 #if defined(CONFIG_PCMCIA) 24 #if defined(CONFIG_PCMCIA)
25 25
26 /* MR-SHPC-01 register */ 26 /* MR-SHPC-01 register */
27 #define MRSHPC_MODE (CONFIG_SYS_MARUBUN_MRSHPC + 4) 27 #define MRSHPC_MODE (CONFIG_SYS_MARUBUN_MRSHPC + 4)
28 #define MRSHPC_OPTION (CONFIG_SYS_MARUBUN_MRSHPC + 6) 28 #define MRSHPC_OPTION (CONFIG_SYS_MARUBUN_MRSHPC + 6)
29 #define MRSHPC_CSR (CONFIG_SYS_MARUBUN_MRSHPC + 8) 29 #define MRSHPC_CSR (CONFIG_SYS_MARUBUN_MRSHPC + 8)
30 #define MRSHPC_ISR (CONFIG_SYS_MARUBUN_MRSHPC + 10) 30 #define MRSHPC_ISR (CONFIG_SYS_MARUBUN_MRSHPC + 10)
31 #define MRSHPC_ICR (CONFIG_SYS_MARUBUN_MRSHPC + 12) 31 #define MRSHPC_ICR (CONFIG_SYS_MARUBUN_MRSHPC + 12)
32 #define MRSHPC_CPWCR (CONFIG_SYS_MARUBUN_MRSHPC + 14) 32 #define MRSHPC_CPWCR (CONFIG_SYS_MARUBUN_MRSHPC + 14)
33 #define MRSHPC_MW0CR1 (CONFIG_SYS_MARUBUN_MRSHPC + 16) 33 #define MRSHPC_MW0CR1 (CONFIG_SYS_MARUBUN_MRSHPC + 16)
34 #define MRSHPC_MW1CR1 (CONFIG_SYS_MARUBUN_MRSHPC + 18) 34 #define MRSHPC_MW1CR1 (CONFIG_SYS_MARUBUN_MRSHPC + 18)
35 #define MRSHPC_IOWCR1 (CONFIG_SYS_MARUBUN_MRSHPC + 20) 35 #define MRSHPC_IOWCR1 (CONFIG_SYS_MARUBUN_MRSHPC + 20)
36 #define MRSHPC_MW0CR2 (CONFIG_SYS_MARUBUN_MRSHPC + 22) 36 #define MRSHPC_MW0CR2 (CONFIG_SYS_MARUBUN_MRSHPC + 22)
37 #define MRSHPC_MW1CR2 (CONFIG_SYS_MARUBUN_MRSHPC + 24) 37 #define MRSHPC_MW1CR2 (CONFIG_SYS_MARUBUN_MRSHPC + 24)
38 #define MRSHPC_IOWCR2 (CONFIG_SYS_MARUBUN_MRSHPC + 26) 38 #define MRSHPC_IOWCR2 (CONFIG_SYS_MARUBUN_MRSHPC + 26)
39 #define MRSHPC_CDCR (CONFIG_SYS_MARUBUN_MRSHPC + 28) 39 #define MRSHPC_CDCR (CONFIG_SYS_MARUBUN_MRSHPC + 28)
40 #define MRSHPC_PCIC_INFO (CONFIG_SYS_MARUBUN_MRSHPC + 30) 40 #define MRSHPC_PCIC_INFO (CONFIG_SYS_MARUBUN_MRSHPC + 30)
41 41
42 int pcmcia_on (void) 42 int pcmcia_on (void)
43 { 43 {
44 printf("Enable PCMCIA " PCMCIA_SLOT_MSG "\n"); 44 printf("Enable PCMCIA " PCMCIA_SLOT_MSG "\n");
45 45
46 /* Init */ 46 /* Init */
47 outw( 0x0000 , MRSHPC_MODE ); 47 outw( 0x0000 , MRSHPC_MODE );
48 48
49 if ((inw(MRSHPC_CSR) & 0x000c) == 0){ /* if card detect is true */ 49 if ((inw(MRSHPC_CSR) & 0x000c) == 0){ /* if card detect is true */
50 if ((inw(MRSHPC_CSR) & 0x0080) == 0){ 50 if ((inw(MRSHPC_CSR) & 0x0080) == 0){
51 outw(0x0674 ,MRSHPC_CPWCR); /* Card Vcc is 3.3v? */ 51 outw(0x0674 ,MRSHPC_CPWCR); /* Card Vcc is 3.3v? */
52 }else{ 52 }else{
53 outw(0x0678 ,MRSHPC_CPWCR); /* Card Vcc is 5V */ 53 outw(0x0678 ,MRSHPC_CPWCR); /* Card Vcc is 5V */
54 } 54 }
55 udelay( 100000 ); /* wait for power on */ 55 udelay( 100000 ); /* wait for power on */
56 }else{ 56 }else{
57 return 1; 57 return 1;
58 } 58 }
59 /* 59 /*
60 * PC-Card window open 60 * PC-Card window open
61 * flag == COMMON/ATTRIBUTE/IO 61 * flag == COMMON/ATTRIBUTE/IO
62 */ 62 */
63 /* common window open */ 63 /* common window open */
64 outw(0x8a84,MRSHPC_MW0CR1); /* window 0xb8400000 */ 64 outw(0x8a84,MRSHPC_MW0CR1); /* window 0xb8400000 */
65 if ((inw(MRSHPC_CSR) & 0x4000) != 0) 65 if ((inw(MRSHPC_CSR) & 0x4000) != 0)
66 outw(0x0b00,MRSHPC_MW0CR2); /* common mode & bus width 16bit SWAP = 1 */ 66 outw(0x0b00,MRSHPC_MW0CR2); /* common mode & bus width 16bit SWAP = 1 */
67 else 67 else
68 outw(0x0300,MRSHPC_MW0CR2); /* common mode & bus width 16bit SWAP = 0 */ 68 outw(0x0300,MRSHPC_MW0CR2); /* common mode & bus width 16bit SWAP = 0 */
69 69
70 /* attribute window open */ 70 /* attribute window open */
71 outw(0x8a85,MRSHPC_MW1CR1); /* window 0xb8500000 */ 71 outw(0x8a85,MRSHPC_MW1CR1); /* window 0xb8500000 */
72 if ((inw(MRSHPC_CSR) & 0x4000) != 0) 72 if ((inw(MRSHPC_CSR) & 0x4000) != 0)
73 outw(0x0a00,MRSHPC_MW1CR2); /* attribute mode & bus width 16bit SWAP = 1 */ 73 outw(0x0a00,MRSHPC_MW1CR2); /* attribute mode & bus width 16bit SWAP = 1 */
74 else 74 else
75 outw(0x0200,MRSHPC_MW1CR2); /* attribute mode & bus width 16bit SWAP = 0 */ 75 outw(0x0200,MRSHPC_MW1CR2); /* attribute mode & bus width 16bit SWAP = 0 */
76 76
77 /* I/O window open */ 77 /* I/O window open */
78 outw(0x8a86,MRSHPC_IOWCR1); /* I/O window 0xb8600000 */ 78 outw(0x8a86,MRSHPC_IOWCR1); /* I/O window 0xb8600000 */
79 outw(0x0008,MRSHPC_CDCR); /* I/O card mode */ 79 outw(0x0008,MRSHPC_CDCR); /* I/O card mode */
80 if ((inw(MRSHPC_CSR) & 0x4000) != 0) 80 if ((inw(MRSHPC_CSR) & 0x4000) != 0)
81 outw(0x0a00,MRSHPC_IOWCR2); /* bus width 16bit SWAP = 1 */ 81 outw(0x0a00,MRSHPC_IOWCR2); /* bus width 16bit SWAP = 1 */
82 else 82 else
83 outw(0x0200,MRSHPC_IOWCR2); /* bus width 16bit SWAP = 0 */ 83 outw(0x0200,MRSHPC_IOWCR2); /* bus width 16bit SWAP = 0 */
84 84
85 outw(0x0000,MRSHPC_ISR); 85 outw(0x0000,MRSHPC_ISR);
86 outw(0x2000,MRSHPC_ICR); 86 outw(0x2000,MRSHPC_ICR);
87 outb(0x00,(CONFIG_SYS_MARUBUN_MW2 + 0x206)); 87 outb(0x00,(CONFIG_SYS_MARUBUN_MW2 + 0x206));
88 outb(0x42,(CONFIG_SYS_MARUBUN_MW2 + 0x200)); 88 outb(0x42,(CONFIG_SYS_MARUBUN_MW2 + 0x200));
89 89
90 return 0; 90 return 0;
91 } 91 }
92 92
93 int pcmcia_off (void) 93 int pcmcia_off (void)
94 { 94 {
95 printf ("Disable PCMCIA " PCMCIA_SLOT_MSG "\n"); 95 printf ("Disable PCMCIA " PCMCIA_SLOT_MSG "\n");
96 96
97 return 0; 97 return 0;
98 } 98 }
99 99
100 #endif /* CONFIG_PCMCIA */ 100 #endif /* CONFIG_PCMCIA */
101 101
drivers/pcmcia/mpc8xx_pcmcia.c
1 #include <common.h> 1 #include <common.h>
2 #include <mpc8xx.h> 2 #include <mpc8xx.h>
3 #include <pcmcia.h> 3 #include <pcmcia.h>
4 #include <linux/compiler.h> 4 #include <linux/compiler.h>
5 5
6 #undef CONFIG_PCMCIA 6 #undef CONFIG_PCMCIA
7 7
8 #if defined(CONFIG_CMD_PCMCIA) 8 #if defined(CONFIG_CMD_PCMCIA)
9 #define CONFIG_PCMCIA 9 #define CONFIG_PCMCIA
10 #endif 10 #endif
11 11
12 #if defined(CONFIG_CMD_IDE) && defined(CONFIG_IDE_8xx_PCCARD) 12 #if defined(CONFIG_IDE) && defined(CONFIG_IDE_8xx_PCCARD)
13 #define CONFIG_PCMCIA 13 #define CONFIG_PCMCIA
14 #endif 14 #endif
15 15
16 #if defined(CONFIG_PCMCIA) 16 #if defined(CONFIG_PCMCIA)
17 17
18 #if defined(CONFIG_IDE_8xx_PCCARD) 18 #if defined(CONFIG_IDE_8xx_PCCARD)
19 extern int check_ide_device (int slot); 19 extern int check_ide_device (int slot);
20 #endif 20 #endif
21 21
22 extern int pcmcia_hardware_enable (int slot); 22 extern int pcmcia_hardware_enable (int slot);
23 extern int pcmcia_voltage_set(int slot, int vcc, int vpp); 23 extern int pcmcia_voltage_set(int slot, int vcc, int vpp);
24 24
25 #if defined(CONFIG_CMD_PCMCIA) 25 #if defined(CONFIG_CMD_PCMCIA)
26 extern int pcmcia_hardware_disable(int slot); 26 extern int pcmcia_hardware_disable(int slot);
27 #endif 27 #endif
28 28
29 static u_int m8xx_get_graycode(u_int size); 29 static u_int m8xx_get_graycode(u_int size);
30 #if 0 /* Disabled */ 30 #if 0 /* Disabled */
31 static u_int m8xx_get_speed(u_int ns, u_int is_io); 31 static u_int m8xx_get_speed(u_int ns, u_int is_io);
32 #endif 32 #endif
33 33
34 /* look up table for pgcrx registers */ 34 /* look up table for pgcrx registers */
35 u_int *pcmcia_pgcrx[2] = { 35 u_int *pcmcia_pgcrx[2] = {
36 &((immap_t *)CONFIG_SYS_IMMR)->im_pcmcia.pcmc_pgcra, 36 &((immap_t *)CONFIG_SYS_IMMR)->im_pcmcia.pcmc_pgcra,
37 &((immap_t *)CONFIG_SYS_IMMR)->im_pcmcia.pcmc_pgcrb, 37 &((immap_t *)CONFIG_SYS_IMMR)->im_pcmcia.pcmc_pgcrb,
38 }; 38 };
39 39
40 /* 40 /*
41 * Search this table to see if the windowsize is 41 * Search this table to see if the windowsize is
42 * supported... 42 * supported...
43 */ 43 */
44 44
45 #define M8XX_SIZES_NO 32 45 #define M8XX_SIZES_NO 32
46 46
47 static const u_int m8xx_size_to_gray[M8XX_SIZES_NO] = 47 static const u_int m8xx_size_to_gray[M8XX_SIZES_NO] =
48 { 0x00000001, 0x00000002, 0x00000008, 0x00000004, 48 { 0x00000001, 0x00000002, 0x00000008, 0x00000004,
49 0x00000080, 0x00000040, 0x00000010, 0x00000020, 49 0x00000080, 0x00000040, 0x00000010, 0x00000020,
50 0x00008000, 0x00004000, 0x00001000, 0x00002000, 50 0x00008000, 0x00004000, 0x00001000, 0x00002000,
51 0x00000100, 0x00000200, 0x00000800, 0x00000400, 51 0x00000100, 0x00000200, 0x00000800, 0x00000400,
52 52
53 0x0fffffff, 0xffffffff, 0xffffffff, 0xffffffff, 53 0x0fffffff, 0xffffffff, 0xffffffff, 0xffffffff,
54 0x01000000, 0x02000000, 0xffffffff, 0x04000000, 54 0x01000000, 0x02000000, 0xffffffff, 0x04000000,
55 0x00010000, 0x00020000, 0x00080000, 0x00040000, 55 0x00010000, 0x00020000, 0x00080000, 0x00040000,
56 0x00800000, 0x00400000, 0x00100000, 0x00200000 }; 56 0x00800000, 0x00400000, 0x00100000, 0x00200000 };
57 57
58 58
59 /* -------------------------------------------------------------------- */ 59 /* -------------------------------------------------------------------- */
60 60
61 #define CONFIG_SYS_PCMCIA_TIMING ( PCMCIA_SHT(2) \ 61 #define CONFIG_SYS_PCMCIA_TIMING ( PCMCIA_SHT(2) \
62 | PCMCIA_SST(4) \ 62 | PCMCIA_SST(4) \
63 | PCMCIA_SL(9)) 63 | PCMCIA_SL(9))
64 64
65 /* -------------------------------------------------------------------- */ 65 /* -------------------------------------------------------------------- */
66 66
67 int pcmcia_on (void) 67 int pcmcia_on (void)
68 { 68 {
69 u_long reg, base; 69 u_long reg, base;
70 pcmcia_win_t *win; 70 pcmcia_win_t *win;
71 u_int rc, slot; 71 u_int rc, slot;
72 __maybe_unused u_int slotbit; 72 __maybe_unused u_int slotbit;
73 int i; 73 int i;
74 74
75 debug ("Enable PCMCIA " PCMCIA_SLOT_MSG "\n"); 75 debug ("Enable PCMCIA " PCMCIA_SLOT_MSG "\n");
76 76
77 /* intialize the fixed memory windows */ 77 /* intialize the fixed memory windows */
78 win = (pcmcia_win_t *)(&((immap_t *)CONFIG_SYS_IMMR)->im_pcmcia.pcmc_pbr0); 78 win = (pcmcia_win_t *)(&((immap_t *)CONFIG_SYS_IMMR)->im_pcmcia.pcmc_pbr0);
79 base = CONFIG_SYS_PCMCIA_MEM_ADDR; 79 base = CONFIG_SYS_PCMCIA_MEM_ADDR;
80 80
81 if((reg = m8xx_get_graycode(CONFIG_SYS_PCMCIA_MEM_SIZE)) == -1) { 81 if((reg = m8xx_get_graycode(CONFIG_SYS_PCMCIA_MEM_SIZE)) == -1) {
82 printf ("Cannot set window size to 0x%08x\n", 82 printf ("Cannot set window size to 0x%08x\n",
83 CONFIG_SYS_PCMCIA_MEM_SIZE); 83 CONFIG_SYS_PCMCIA_MEM_SIZE);
84 return (1); 84 return (1);
85 } 85 }
86 86
87 slotbit = PCMCIA_SLOT_x; 87 slotbit = PCMCIA_SLOT_x;
88 for (i=0; i<PCMCIA_MEM_WIN_NO; ++i) { 88 for (i=0; i<PCMCIA_MEM_WIN_NO; ++i) {
89 win->br = base; 89 win->br = base;
90 90
91 #if (PCMCIA_SOCKETS_NO == 2) 91 #if (PCMCIA_SOCKETS_NO == 2)
92 if (i == 4) /* Another slot starting from win 4 */ 92 if (i == 4) /* Another slot starting from win 4 */
93 slotbit = (slotbit ? PCMCIA_PSLOT_A : PCMCIA_PSLOT_B); 93 slotbit = (slotbit ? PCMCIA_PSLOT_A : PCMCIA_PSLOT_B);
94 #endif 94 #endif
95 switch (i) { 95 switch (i) {
96 #ifdef CONFIG_IDE_8xx_PCCARD 96 #ifdef CONFIG_IDE_8xx_PCCARD
97 case 4: 97 case 4:
98 case 0: { /* map attribute memory */ 98 case 0: { /* map attribute memory */
99 win->or = ( PCMCIA_BSIZE_64M 99 win->or = ( PCMCIA_BSIZE_64M
100 | PCMCIA_PPS_8 100 | PCMCIA_PPS_8
101 | PCMCIA_PRS_ATTR 101 | PCMCIA_PRS_ATTR
102 | slotbit 102 | slotbit
103 | PCMCIA_PV 103 | PCMCIA_PV
104 | CONFIG_SYS_PCMCIA_TIMING ); 104 | CONFIG_SYS_PCMCIA_TIMING );
105 break; 105 break;
106 } 106 }
107 case 5: 107 case 5:
108 case 1: { /* map I/O window for data reg */ 108 case 1: { /* map I/O window for data reg */
109 win->or = ( PCMCIA_BSIZE_1K 109 win->or = ( PCMCIA_BSIZE_1K
110 | PCMCIA_PPS_16 110 | PCMCIA_PPS_16
111 | PCMCIA_PRS_IO 111 | PCMCIA_PRS_IO
112 | slotbit 112 | slotbit
113 | PCMCIA_PV 113 | PCMCIA_PV
114 | CONFIG_SYS_PCMCIA_TIMING ); 114 | CONFIG_SYS_PCMCIA_TIMING );
115 break; 115 break;
116 } 116 }
117 case 6: 117 case 6:
118 case 2: { /* map I/O window for cmd/ctrl reg block */ 118 case 2: { /* map I/O window for cmd/ctrl reg block */
119 win->or = ( PCMCIA_BSIZE_1K 119 win->or = ( PCMCIA_BSIZE_1K
120 | PCMCIA_PPS_8 120 | PCMCIA_PPS_8
121 | PCMCIA_PRS_IO 121 | PCMCIA_PRS_IO
122 | slotbit 122 | slotbit
123 | PCMCIA_PV 123 | PCMCIA_PV
124 | CONFIG_SYS_PCMCIA_TIMING ); 124 | CONFIG_SYS_PCMCIA_TIMING );
125 break; 125 break;
126 } 126 }
127 #endif /* CONFIG_IDE_8xx_PCCARD */ 127 #endif /* CONFIG_IDE_8xx_PCCARD */
128 default: /* set to not valid */ 128 default: /* set to not valid */
129 win->or = 0; 129 win->or = 0;
130 break; 130 break;
131 } 131 }
132 132
133 debug ("MemWin %d: PBR 0x%08lX POR %08lX\n", 133 debug ("MemWin %d: PBR 0x%08lX POR %08lX\n",
134 i, win->br, win->or); 134 i, win->br, win->or);
135 base += CONFIG_SYS_PCMCIA_MEM_SIZE; 135 base += CONFIG_SYS_PCMCIA_MEM_SIZE;
136 ++win; 136 ++win;
137 } 137 }
138 138
139 for (i=0, rc=0, slot=_slot_; i<PCMCIA_SOCKETS_NO; i++, slot = !slot) { 139 for (i=0, rc=0, slot=_slot_; i<PCMCIA_SOCKETS_NO; i++, slot = !slot) {
140 /* turn off voltage */ 140 /* turn off voltage */
141 if ((rc = pcmcia_voltage_set(slot, 0, 0))) 141 if ((rc = pcmcia_voltage_set(slot, 0, 0)))
142 continue; 142 continue;
143 143
144 /* Enable external hardware */ 144 /* Enable external hardware */
145 if ((rc = pcmcia_hardware_enable(slot))) 145 if ((rc = pcmcia_hardware_enable(slot)))
146 continue; 146 continue;
147 147
148 #ifdef CONFIG_IDE_8xx_PCCARD 148 #ifdef CONFIG_IDE_8xx_PCCARD
149 if ((rc = check_ide_device(i))) 149 if ((rc = check_ide_device(i)))
150 continue; 150 continue;
151 #endif 151 #endif
152 } 152 }
153 return rc; 153 return rc;
154 } 154 }
155 155
156 #if defined(CONFIG_CMD_PCMCIA) 156 #if defined(CONFIG_CMD_PCMCIA)
157 int pcmcia_off (void) 157 int pcmcia_off (void)
158 { 158 {
159 int i; 159 int i;
160 pcmcia_win_t *win; 160 pcmcia_win_t *win;
161 161
162 printf ("Disable PCMCIA " PCMCIA_SLOT_MSG "\n"); 162 printf ("Disable PCMCIA " PCMCIA_SLOT_MSG "\n");
163 163
164 /* clear interrupt state, and disable interrupts */ 164 /* clear interrupt state, and disable interrupts */
165 ((immap_t *)CONFIG_SYS_IMMR)->im_pcmcia.pcmc_pscr = PCMCIA_MASK(_slot_); 165 ((immap_t *)CONFIG_SYS_IMMR)->im_pcmcia.pcmc_pscr = PCMCIA_MASK(_slot_);
166 ((immap_t *)CONFIG_SYS_IMMR)->im_pcmcia.pcmc_per &= ~PCMCIA_MASK(_slot_); 166 ((immap_t *)CONFIG_SYS_IMMR)->im_pcmcia.pcmc_per &= ~PCMCIA_MASK(_slot_);
167 167
168 /* turn off interrupt and disable CxOE */ 168 /* turn off interrupt and disable CxOE */
169 PCMCIA_PGCRX(_slot_) = __MY_PCMCIA_GCRX_CXOE; 169 PCMCIA_PGCRX(_slot_) = __MY_PCMCIA_GCRX_CXOE;
170 170
171 /* turn off memory windows */ 171 /* turn off memory windows */
172 win = (pcmcia_win_t *)(&((immap_t *)CONFIG_SYS_IMMR)->im_pcmcia.pcmc_pbr0); 172 win = (pcmcia_win_t *)(&((immap_t *)CONFIG_SYS_IMMR)->im_pcmcia.pcmc_pbr0);
173 173
174 for (i=0; i<PCMCIA_MEM_WIN_NO; ++i) { 174 for (i=0; i<PCMCIA_MEM_WIN_NO; ++i) {
175 /* disable memory window */ 175 /* disable memory window */
176 win->or = 0; 176 win->or = 0;
177 ++win; 177 ++win;
178 } 178 }
179 179
180 /* turn off voltage */ 180 /* turn off voltage */
181 pcmcia_voltage_set(_slot_, 0, 0); 181 pcmcia_voltage_set(_slot_, 0, 0);
182 182
183 /* disable external hardware */ 183 /* disable external hardware */
184 printf ("Shutdown and Poweroff " PCMCIA_SLOT_MSG "\n"); 184 printf ("Shutdown and Poweroff " PCMCIA_SLOT_MSG "\n");
185 pcmcia_hardware_disable(_slot_); 185 pcmcia_hardware_disable(_slot_);
186 return 0; 186 return 0;
187 } 187 }
188 #endif 188 #endif
189 189
190 190
191 static u_int m8xx_get_graycode(u_int size) 191 static u_int m8xx_get_graycode(u_int size)
192 { 192 {
193 u_int k; 193 u_int k;
194 194
195 for (k = 0; k < M8XX_SIZES_NO; k++) { 195 for (k = 0; k < M8XX_SIZES_NO; k++) {
196 if(m8xx_size_to_gray[k] == size) 196 if(m8xx_size_to_gray[k] == size)
197 break; 197 break;
198 } 198 }
199 199
200 if((k == M8XX_SIZES_NO) || (m8xx_size_to_gray[k] == -1)) 200 if((k == M8XX_SIZES_NO) || (m8xx_size_to_gray[k] == -1))
201 k = -1; 201 k = -1;
202 202
203 return k; 203 return k;
204 } 204 }
205 205
206 #if 0 206 #if 0
207 207
208 static u_int m8xx_get_speed(u_int ns, u_int is_io) 208 static u_int m8xx_get_speed(u_int ns, u_int is_io)
209 { 209 {
210 u_int reg, clocks, psst, psl, psht; 210 u_int reg, clocks, psst, psl, psht;
211 211
212 if(!ns) { 212 if(!ns) {
213 213
214 /* 214 /*
215 * We get called with IO maps setup to 0ns 215 * We get called with IO maps setup to 0ns
216 * if not specified by the user. 216 * if not specified by the user.
217 * They should be 255ns. 217 * They should be 255ns.
218 */ 218 */
219 219
220 if(is_io) 220 if(is_io)
221 ns = 255; 221 ns = 255;
222 else 222 else
223 ns = 100; /* fast memory if 0 */ 223 ns = 100; /* fast memory if 0 */
224 } 224 }
225 225
226 /* 226 /*
227 * In PSST, PSL, PSHT fields we tell the controller 227 * In PSST, PSL, PSHT fields we tell the controller
228 * timing parameters in CLKOUT clock cycles. 228 * timing parameters in CLKOUT clock cycles.
229 * CLKOUT is the same as GCLK2_50. 229 * CLKOUT is the same as GCLK2_50.
230 */ 230 */
231 231
232 /* how we want to adjust the timing - in percent */ 232 /* how we want to adjust the timing - in percent */
233 233
234 #define ADJ 180 /* 80 % longer accesstime - to be sure */ 234 #define ADJ 180 /* 80 % longer accesstime - to be sure */
235 235
236 clocks = ((M8XX_BUSFREQ / 1000) * ns) / 1000; 236 clocks = ((M8XX_BUSFREQ / 1000) * ns) / 1000;
237 clocks = (clocks * ADJ) / (100*1000); 237 clocks = (clocks * ADJ) / (100*1000);
238 238
239 if(clocks >= PCMCIA_BMT_LIMIT) { 239 if(clocks >= PCMCIA_BMT_LIMIT) {
240 DEBUG(0, "Max access time limit reached\n"); 240 DEBUG(0, "Max access time limit reached\n");
241 clocks = PCMCIA_BMT_LIMIT-1; 241 clocks = PCMCIA_BMT_LIMIT-1;
242 } 242 }
243 243
244 psst = clocks / 7; /* setup time */ 244 psst = clocks / 7; /* setup time */
245 psht = clocks / 7; /* hold time */ 245 psht = clocks / 7; /* hold time */
246 psl = (clocks * 5) / 7; /* strobe length */ 246 psl = (clocks * 5) / 7; /* strobe length */
247 247
248 psst += clocks - (psst + psht + psl); 248 psst += clocks - (psst + psht + psl);
249 249
250 reg = psst << 12; 250 reg = psst << 12;
251 reg |= psl << 7; 251 reg |= psl << 7;
252 reg |= psht << 16; 252 reg |= psht << 16;
253 253
254 return reg; 254 return reg;
255 } 255 }
256 #endif /* 0 */ 256 #endif /* 0 */
257 257
258 #endif /* CONFIG_PCMCIA */ 258 #endif /* CONFIG_PCMCIA */
259 259
drivers/pcmcia/tqm8xx_pcmcia.c
1 /* -------------------------------------------------------------------- */ 1 /* -------------------------------------------------------------------- */
2 /* TQM8xxL Boards by TQ Components */ 2 /* TQM8xxL Boards by TQ Components */
3 /* SC8xx Boards by SinoVee Microsystems */ 3 /* SC8xx Boards by SinoVee Microsystems */
4 /* -------------------------------------------------------------------- */ 4 /* -------------------------------------------------------------------- */
5 #include <common.h> 5 #include <common.h>
6 #include <asm/io.h> 6 #include <asm/io.h>
7 #ifdef CONFIG_8xx 7 #ifdef CONFIG_8xx
8 #include <mpc8xx.h> 8 #include <mpc8xx.h>
9 #endif 9 #endif
10 #include <pcmcia.h> 10 #include <pcmcia.h>
11 11
12 #undef CONFIG_PCMCIA 12 #undef CONFIG_PCMCIA
13 13
14 #if defined(CONFIG_CMD_PCMCIA) 14 #if defined(CONFIG_CMD_PCMCIA)
15 #define CONFIG_PCMCIA 15 #define CONFIG_PCMCIA
16 #endif 16 #endif
17 17
18 #if defined(CONFIG_CMD_IDE) && defined(CONFIG_IDE_8xx_PCCARD) 18 #if defined(CONFIG_IDE) && defined(CONFIG_IDE_8xx_PCCARD)
19 #define CONFIG_PCMCIA 19 #define CONFIG_PCMCIA
20 #endif 20 #endif
21 21
22 #if defined(CONFIG_PCMCIA) \ 22 #if defined(CONFIG_PCMCIA) \
23 && defined(CONFIG_TQM8xxL) 23 && defined(CONFIG_TQM8xxL)
24 24
25 #if defined(CONFIG_TQM8xxL) 25 #if defined(CONFIG_TQM8xxL)
26 #define PCMCIA_BOARD_MSG "TQM8xxL" 26 #define PCMCIA_BOARD_MSG "TQM8xxL"
27 #endif 27 #endif
28 28
29 static inline void power_config(int slot) 29 static inline void power_config(int slot)
30 { 30 {
31 immap_t *immap = (immap_t *)CONFIG_SYS_IMMR; 31 immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
32 /* 32 /*
33 * Configure Port C pins for 33 * Configure Port C pins for
34 * 5 Volts Enable and 3 Volts enable 34 * 5 Volts Enable and 3 Volts enable
35 */ 35 */
36 clrbits_be16(&immap->im_ioport.iop_pcpar, 0x0002 | 0x0004); 36 clrbits_be16(&immap->im_ioport.iop_pcpar, 0x0002 | 0x0004);
37 clrbits_be16(&immap->im_ioport.iop_pcso, 0x0002 | 0x0004); 37 clrbits_be16(&immap->im_ioport.iop_pcso, 0x0002 | 0x0004);
38 } 38 }
39 39
40 static inline void power_off(int slot) 40 static inline void power_off(int slot)
41 { 41 {
42 immap_t *immap = (immap_t *)CONFIG_SYS_IMMR; 42 immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
43 clrbits_be16(&immap->im_ioport.iop_pcdat, 0x0002 | 0x0004); 43 clrbits_be16(&immap->im_ioport.iop_pcdat, 0x0002 | 0x0004);
44 } 44 }
45 45
46 static inline void power_on_5_0(int slot) 46 static inline void power_on_5_0(int slot)
47 { 47 {
48 immap_t *immap = (immap_t *)CONFIG_SYS_IMMR; 48 immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
49 setbits_be16(&immap->im_ioport.iop_pcdat, 0x0004); 49 setbits_be16(&immap->im_ioport.iop_pcdat, 0x0004);
50 setbits_be16(&immap->im_ioport.iop_pcdir, 0x0002 | 0x0004); 50 setbits_be16(&immap->im_ioport.iop_pcdir, 0x0002 | 0x0004);
51 } 51 }
52 52
53 static inline void power_on_3_3(int slot) 53 static inline void power_on_3_3(int slot)
54 { 54 {
55 immap_t *immap = (immap_t *)CONFIG_SYS_IMMR; 55 immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
56 setbits_be16(&immap->im_ioport.iop_pcdat, 0x0002); 56 setbits_be16(&immap->im_ioport.iop_pcdat, 0x0002);
57 setbits_be16(&immap->im_ioport.iop_pcdir, 0x0002 | 0x0004); 57 setbits_be16(&immap->im_ioport.iop_pcdir, 0x0002 | 0x0004);
58 } 58 }
59 59
60 /* 60 /*
61 * Function to retrieve the PIPR register, used for debuging purposes. 61 * Function to retrieve the PIPR register, used for debuging purposes.
62 */ 62 */
63 static inline uint32_t debug_get_pipr(void) 63 static inline uint32_t debug_get_pipr(void)
64 { 64 {
65 uint32_t pipr = 0; 65 uint32_t pipr = 0;
66 #ifdef DEBUG 66 #ifdef DEBUG
67 immap_t *immap = (immap_t *)CONFIG_SYS_IMMR; 67 immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
68 pipr = in_be32(&immap->im_pcmcia.pcmc_pipr); 68 pipr = in_be32(&immap->im_pcmcia.pcmc_pipr);
69 #endif 69 #endif
70 return pipr; 70 return pipr;
71 } 71 }
72 72
73 73
74 static inline int check_card_is_absent(int slot) 74 static inline int check_card_is_absent(int slot)
75 { 75 {
76 immap_t *immap = (immap_t *)CONFIG_SYS_IMMR; 76 immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
77 uint32_t pipr = in_be32(&immap->im_pcmcia.pcmc_pipr); 77 uint32_t pipr = in_be32(&immap->im_pcmcia.pcmc_pipr);
78 return pipr & (0x18000000 >> (slot << 4)); 78 return pipr & (0x18000000 >> (slot << 4));
79 } 79 }
80 80
81 #define NSCU_GCRX_CXOE __MY_PCMCIA_GCRX_CXOE 81 #define NSCU_GCRX_CXOE __MY_PCMCIA_GCRX_CXOE
82 82
83 int pcmcia_hardware_enable(int slot) 83 int pcmcia_hardware_enable(int slot)
84 { 84 {
85 immap_t *immap = (immap_t *)CONFIG_SYS_IMMR; 85 immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
86 uint reg, mask; 86 uint reg, mask;
87 87
88 debug("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot); 88 debug("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
89 89
90 udelay(10000); 90 udelay(10000);
91 91
92 /* 92 /*
93 * Configure SIUMCR to enable PCMCIA port B 93 * Configure SIUMCR to enable PCMCIA port B
94 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead) 94 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
95 */ 95 */
96 96
97 /* Set DBGC to 00 */ 97 /* Set DBGC to 00 */
98 clrbits_be32(&immap->im_siu_conf.sc_siumcr, SIUMCR_DBGC11); 98 clrbits_be32(&immap->im_siu_conf.sc_siumcr, SIUMCR_DBGC11);
99 99
100 /* Clear interrupt state, and disable interrupts */ 100 /* Clear interrupt state, and disable interrupts */
101 out_be32(&immap->im_pcmcia.pcmc_pscr, PCMCIA_MASK(slot)); 101 out_be32(&immap->im_pcmcia.pcmc_pscr, PCMCIA_MASK(slot));
102 clrbits_be32(&immap->im_pcmcia.pcmc_per, PCMCIA_MASK(slot)); 102 clrbits_be32(&immap->im_pcmcia.pcmc_per, PCMCIA_MASK(slot));
103 103
104 /* 104 /*
105 * Disable interrupts, DMA, and PCMCIA buffers 105 * Disable interrupts, DMA, and PCMCIA buffers
106 * (isolate the interface) and assert RESET signal 106 * (isolate the interface) and assert RESET signal
107 */ 107 */
108 debug("Disable PCMCIA buffers and assert RESET\n"); 108 debug("Disable PCMCIA buffers and assert RESET\n");
109 reg = 0; 109 reg = 0;
110 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */ 110 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
111 reg |= NSCU_GCRX_CXOE; 111 reg |= NSCU_GCRX_CXOE;
112 112
113 PCMCIA_PGCRX(slot) = reg; 113 PCMCIA_PGCRX(slot) = reg;
114 udelay(500); 114 udelay(500);
115 115
116 power_config(slot); 116 power_config(slot);
117 power_off(slot); 117 power_off(slot);
118 118
119 /* 119 /*
120 * Make sure there is a card in the slot, then configure the interface. 120 * Make sure there is a card in the slot, then configure the interface.
121 */ 121 */
122 udelay(10000); 122 udelay(10000);
123 reg = debug_get_pipr(); 123 reg = debug_get_pipr();
124 debug("[%d] %s: PIPR(%p)=0x%x\n", __LINE__, __FUNCTION__, 124 debug("[%d] %s: PIPR(%p)=0x%x\n", __LINE__, __FUNCTION__,
125 &immap->im_pcmcia.pcmc_pipr, reg); 125 &immap->im_pcmcia.pcmc_pipr, reg);
126 126
127 if (check_card_is_absent(slot)) { 127 if (check_card_is_absent(slot)) {
128 printf (" No Card found\n"); 128 printf (" No Card found\n");
129 return (1); 129 return (1);
130 } 130 }
131 131
132 /* 132 /*
133 * Power On. 133 * Power On.
134 */ 134 */
135 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot); 135 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
136 reg = in_be32(&immap->im_pcmcia.pcmc_pipr); 136 reg = in_be32(&immap->im_pcmcia.pcmc_pipr);
137 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n", 137 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
138 reg, 138 reg,
139 (reg & PCMCIA_VS1(slot)) ? "n" : "ff", 139 (reg & PCMCIA_VS1(slot)) ? "n" : "ff",
140 (reg & PCMCIA_VS2(slot)) ? "n" : "ff"); 140 (reg & PCMCIA_VS2(slot)) ? "n" : "ff");
141 141
142 if ((reg & mask) == mask) { 142 if ((reg & mask) == mask) {
143 power_on_5_0(slot); 143 power_on_5_0(slot);
144 puts (" 5.0V card found: "); 144 puts (" 5.0V card found: ");
145 } else { 145 } else {
146 power_on_3_3(slot); 146 power_on_3_3(slot);
147 puts (" 3.3V card found: "); 147 puts (" 3.3V card found: ");
148 } 148 }
149 149
150 #if 0 150 #if 0
151 /* VCC switch error flag, PCMCIA slot INPACK_ pin */ 151 /* VCC switch error flag, PCMCIA slot INPACK_ pin */
152 cp->cp_pbdir &= ~(0x0020 | 0x0010); 152 cp->cp_pbdir &= ~(0x0020 | 0x0010);
153 cp->cp_pbpar &= ~(0x0020 | 0x0010); 153 cp->cp_pbpar &= ~(0x0020 | 0x0010);
154 udelay(500000); 154 udelay(500000);
155 #endif 155 #endif
156 156
157 udelay(1000); 157 udelay(1000);
158 debug("Enable PCMCIA buffers and stop RESET\n"); 158 debug("Enable PCMCIA buffers and stop RESET\n");
159 reg = PCMCIA_PGCRX(slot); 159 reg = PCMCIA_PGCRX(slot);
160 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */ 160 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
161 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */ 161 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
162 reg &= ~NSCU_GCRX_CXOE; 162 reg &= ~NSCU_GCRX_CXOE;
163 163
164 PCMCIA_PGCRX(slot) = reg; 164 PCMCIA_PGCRX(slot) = reg;
165 165
166 udelay(250000); /* some cards need >150 ms to come up :-( */ 166 udelay(250000); /* some cards need >150 ms to come up :-( */
167 167
168 debug("# hardware_enable done\n"); 168 debug("# hardware_enable done\n");
169 169
170 return (0); 170 return (0);
171 } 171 }
172 172
173 173
174 #if defined(CONFIG_CMD_PCMCIA) 174 #if defined(CONFIG_CMD_PCMCIA)
175 int pcmcia_hardware_disable(int slot) 175 int pcmcia_hardware_disable(int slot)
176 { 176 {
177 u_long reg; 177 u_long reg;
178 178
179 debug("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot); 179 debug("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
180 180
181 /* remove all power */ 181 /* remove all power */
182 power_off(slot); 182 power_off(slot);
183 183
184 debug("Disable PCMCIA buffers and assert RESET\n"); 184 debug("Disable PCMCIA buffers and assert RESET\n");
185 reg = 0; 185 reg = 0;
186 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */ 186 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
187 reg |= NSCU_GCRX_CXOE; /* active low */ 187 reg |= NSCU_GCRX_CXOE; /* active low */
188 188
189 PCMCIA_PGCRX(slot) = reg; 189 PCMCIA_PGCRX(slot) = reg;
190 190
191 udelay(10000); 191 udelay(10000);
192 192
193 return (0); 193 return (0);
194 } 194 }
195 #endif 195 #endif
196 196
197 int pcmcia_voltage_set(int slot, int vcc, int vpp) 197 int pcmcia_voltage_set(int slot, int vcc, int vpp)
198 { 198 {
199 u_long reg; 199 u_long reg;
200 uint32_t pipr = 0; 200 uint32_t pipr = 0;
201 201
202 debug("voltage_set: " PCMCIA_BOARD_MSG 202 debug("voltage_set: " PCMCIA_BOARD_MSG
203 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n", 203 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
204 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10); 204 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
205 205
206 /* 206 /*
207 * Disable PCMCIA buffers (isolate the interface) 207 * Disable PCMCIA buffers (isolate the interface)
208 * and assert RESET signal 208 * and assert RESET signal
209 */ 209 */
210 debug("Disable PCMCIA buffers and assert RESET\n"); 210 debug("Disable PCMCIA buffers and assert RESET\n");
211 reg = PCMCIA_PGCRX(slot); 211 reg = PCMCIA_PGCRX(slot);
212 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */ 212 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
213 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */ 213 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
214 reg |= NSCU_GCRX_CXOE; /* active low */ 214 reg |= NSCU_GCRX_CXOE; /* active low */
215 215
216 PCMCIA_PGCRX(slot) = reg; 216 PCMCIA_PGCRX(slot) = reg;
217 udelay(500); 217 udelay(500);
218 218
219 debug("PCMCIA power OFF\n"); 219 debug("PCMCIA power OFF\n");
220 power_config(slot); 220 power_config(slot);
221 power_off(slot); 221 power_off(slot);
222 222
223 switch(vcc) { 223 switch(vcc) {
224 case 0: break; 224 case 0: break;
225 case 33: power_on_3_3(slot); break; 225 case 33: power_on_3_3(slot); break;
226 case 50: power_on_5_0(slot); break; 226 case 50: power_on_5_0(slot); break;
227 default: goto done; 227 default: goto done;
228 } 228 }
229 229
230 /* Checking supported voltages */ 230 /* Checking supported voltages */
231 pipr = debug_get_pipr(); 231 pipr = debug_get_pipr();
232 debug("PIPR: 0x%x --> %s\n", pipr, 232 debug("PIPR: 0x%x --> %s\n", pipr,
233 (pipr & 0x00008000) ? "only 5 V" : "can do 3.3V"); 233 (pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
234 234
235 if (vcc) 235 if (vcc)
236 debug("PCMCIA powered at %sV\n", (vcc == 50) ? "5.0" : "3.3"); 236 debug("PCMCIA powered at %sV\n", (vcc == 50) ? "5.0" : "3.3");
237 else 237 else
238 debug("PCMCIA powered down\n"); 238 debug("PCMCIA powered down\n");
239 239
240 done: 240 done:
241 debug("Enable PCMCIA buffers and stop RESET\n"); 241 debug("Enable PCMCIA buffers and stop RESET\n");
242 reg = PCMCIA_PGCRX(slot); 242 reg = PCMCIA_PGCRX(slot);
243 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */ 243 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
244 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */ 244 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
245 reg &= ~NSCU_GCRX_CXOE; /* active low */ 245 reg &= ~NSCU_GCRX_CXOE; /* active low */
246 246
247 PCMCIA_PGCRX(slot) = reg; 247 PCMCIA_PGCRX(slot) = reg;
248 udelay(500); 248 udelay(500);
249 249
250 debug("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n", slot+'A'); 250 debug("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n", slot+'A');
251 return 0; 251 return 0;
252 } 252 }
253 253
254 #endif /* CONFIG_PCMCIA && CONFIG_TQM8xxL */ 254 #endif /* CONFIG_PCMCIA && CONFIG_TQM8xxL */
255 255
1 /* 1 /*
2 * fat.c 2 * fat.c
3 * 3 *
4 * R/O (V)FAT 12/16/32 filesystem implementation by Marcus Sundberg 4 * R/O (V)FAT 12/16/32 filesystem implementation by Marcus Sundberg
5 * 5 *
6 * 2002-07-28 - rjones@nexus-tech.net - ported to ppcboot v1.1.6 6 * 2002-07-28 - rjones@nexus-tech.net - ported to ppcboot v1.1.6
7 * 2003-03-10 - kharris@nexus-tech.net - ported to uboot 7 * 2003-03-10 - kharris@nexus-tech.net - ported to uboot
8 * 8 *
9 * SPDX-License-Identifier: GPL-2.0+ 9 * SPDX-License-Identifier: GPL-2.0+
10 */ 10 */
11 11
12 #include <common.h> 12 #include <common.h>
13 #include <blk.h> 13 #include <blk.h>
14 #include <config.h> 14 #include <config.h>
15 #include <exports.h> 15 #include <exports.h>
16 #include <fat.h> 16 #include <fat.h>
17 #include <asm/byteorder.h> 17 #include <asm/byteorder.h>
18 #include <part.h> 18 #include <part.h>
19 #include <malloc.h> 19 #include <malloc.h>
20 #include <memalign.h> 20 #include <memalign.h>
21 #include <linux/compiler.h> 21 #include <linux/compiler.h>
22 #include <linux/ctype.h> 22 #include <linux/ctype.h>
23 23
24 #ifdef CONFIG_SUPPORT_VFAT 24 #ifdef CONFIG_SUPPORT_VFAT
25 static const int vfat_enabled = 1; 25 static const int vfat_enabled = 1;
26 #else 26 #else
27 static const int vfat_enabled = 0; 27 static const int vfat_enabled = 0;
28 #endif 28 #endif
29 29
30 /* 30 /*
31 * Convert a string to lowercase. 31 * Convert a string to lowercase.
32 */ 32 */
33 static void downcase(char *str) 33 static void downcase(char *str)
34 { 34 {
35 while (*str != '\0') { 35 while (*str != '\0') {
36 *str = tolower(*str); 36 *str = tolower(*str);
37 str++; 37 str++;
38 } 38 }
39 } 39 }
40 40
41 static struct blk_desc *cur_dev; 41 static struct blk_desc *cur_dev;
42 static disk_partition_t cur_part_info; 42 static disk_partition_t cur_part_info;
43 43
44 #define DOS_BOOT_MAGIC_OFFSET 0x1fe 44 #define DOS_BOOT_MAGIC_OFFSET 0x1fe
45 #define DOS_FS_TYPE_OFFSET 0x36 45 #define DOS_FS_TYPE_OFFSET 0x36
46 #define DOS_FS32_TYPE_OFFSET 0x52 46 #define DOS_FS32_TYPE_OFFSET 0x52
47 47
48 static int disk_read(__u32 block, __u32 nr_blocks, void *buf) 48 static int disk_read(__u32 block, __u32 nr_blocks, void *buf)
49 { 49 {
50 ulong ret; 50 ulong ret;
51 51
52 if (!cur_dev) 52 if (!cur_dev)
53 return -1; 53 return -1;
54 54
55 ret = blk_dread(cur_dev, cur_part_info.start + block, nr_blocks, buf); 55 ret = blk_dread(cur_dev, cur_part_info.start + block, nr_blocks, buf);
56 56
57 if (nr_blocks && ret == 0) 57 if (nr_blocks && ret == 0)
58 return -1; 58 return -1;
59 59
60 return ret; 60 return ret;
61 } 61 }
62 62
63 int fat_set_blk_dev(struct blk_desc *dev_desc, disk_partition_t *info) 63 int fat_set_blk_dev(struct blk_desc *dev_desc, disk_partition_t *info)
64 { 64 {
65 ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, dev_desc->blksz); 65 ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, dev_desc->blksz);
66 66
67 cur_dev = dev_desc; 67 cur_dev = dev_desc;
68 cur_part_info = *info; 68 cur_part_info = *info;
69 69
70 /* Make sure it has a valid FAT header */ 70 /* Make sure it has a valid FAT header */
71 if (disk_read(0, 1, buffer) != 1) { 71 if (disk_read(0, 1, buffer) != 1) {
72 cur_dev = NULL; 72 cur_dev = NULL;
73 return -1; 73 return -1;
74 } 74 }
75 75
76 /* Check if it's actually a DOS volume */ 76 /* Check if it's actually a DOS volume */
77 if (memcmp(buffer + DOS_BOOT_MAGIC_OFFSET, "\x55\xAA", 2)) { 77 if (memcmp(buffer + DOS_BOOT_MAGIC_OFFSET, "\x55\xAA", 2)) {
78 cur_dev = NULL; 78 cur_dev = NULL;
79 return -1; 79 return -1;
80 } 80 }
81 81
82 /* Check for FAT12/FAT16/FAT32 filesystem */ 82 /* Check for FAT12/FAT16/FAT32 filesystem */
83 if (!memcmp(buffer + DOS_FS_TYPE_OFFSET, "FAT", 3)) 83 if (!memcmp(buffer + DOS_FS_TYPE_OFFSET, "FAT", 3))
84 return 0; 84 return 0;
85 if (!memcmp(buffer + DOS_FS32_TYPE_OFFSET, "FAT32", 5)) 85 if (!memcmp(buffer + DOS_FS32_TYPE_OFFSET, "FAT32", 5))
86 return 0; 86 return 0;
87 87
88 cur_dev = NULL; 88 cur_dev = NULL;
89 return -1; 89 return -1;
90 } 90 }
91 91
92 int fat_register_device(struct blk_desc *dev_desc, int part_no) 92 int fat_register_device(struct blk_desc *dev_desc, int part_no)
93 { 93 {
94 disk_partition_t info; 94 disk_partition_t info;
95 95
96 /* First close any currently found FAT filesystem */ 96 /* First close any currently found FAT filesystem */
97 cur_dev = NULL; 97 cur_dev = NULL;
98 98
99 /* Read the partition table, if present */ 99 /* Read the partition table, if present */
100 if (part_get_info(dev_desc, part_no, &info)) { 100 if (part_get_info(dev_desc, part_no, &info)) {
101 if (part_no != 0) { 101 if (part_no != 0) {
102 printf("** Partition %d not valid on device %d **\n", 102 printf("** Partition %d not valid on device %d **\n",
103 part_no, dev_desc->devnum); 103 part_no, dev_desc->devnum);
104 return -1; 104 return -1;
105 } 105 }
106 106
107 info.start = 0; 107 info.start = 0;
108 info.size = dev_desc->lba; 108 info.size = dev_desc->lba;
109 info.blksz = dev_desc->blksz; 109 info.blksz = dev_desc->blksz;
110 info.name[0] = 0; 110 info.name[0] = 0;
111 info.type[0] = 0; 111 info.type[0] = 0;
112 info.bootable = 0; 112 info.bootable = 0;
113 #if CONFIG_IS_ENABLED(PARTITION_UUIDS) 113 #if CONFIG_IS_ENABLED(PARTITION_UUIDS)
114 info.uuid[0] = 0; 114 info.uuid[0] = 0;
115 #endif 115 #endif
116 } 116 }
117 117
118 return fat_set_blk_dev(dev_desc, &info); 118 return fat_set_blk_dev(dev_desc, &info);
119 } 119 }
120 120
121 /* 121 /*
122 * Get the first occurence of a directory delimiter ('/' or '\') in a string. 122 * Get the first occurence of a directory delimiter ('/' or '\') in a string.
123 * Return index into string if found, -1 otherwise. 123 * Return index into string if found, -1 otherwise.
124 */ 124 */
125 static int dirdelim(char *str) 125 static int dirdelim(char *str)
126 { 126 {
127 char *start = str; 127 char *start = str;
128 128
129 while (*str != '\0') { 129 while (*str != '\0') {
130 if (ISDIRDELIM(*str)) 130 if (ISDIRDELIM(*str))
131 return str - start; 131 return str - start;
132 str++; 132 str++;
133 } 133 }
134 return -1; 134 return -1;
135 } 135 }
136 136
137 /* 137 /*
138 * Extract zero terminated short name from a directory entry. 138 * Extract zero terminated short name from a directory entry.
139 */ 139 */
140 static void get_name(dir_entry *dirent, char *s_name) 140 static void get_name(dir_entry *dirent, char *s_name)
141 { 141 {
142 char *ptr; 142 char *ptr;
143 143
144 memcpy(s_name, dirent->name, 8); 144 memcpy(s_name, dirent->name, 8);
145 s_name[8] = '\0'; 145 s_name[8] = '\0';
146 ptr = s_name; 146 ptr = s_name;
147 while (*ptr && *ptr != ' ') 147 while (*ptr && *ptr != ' ')
148 ptr++; 148 ptr++;
149 if (dirent->ext[0] && dirent->ext[0] != ' ') { 149 if (dirent->ext[0] && dirent->ext[0] != ' ') {
150 *ptr = '.'; 150 *ptr = '.';
151 ptr++; 151 ptr++;
152 memcpy(ptr, dirent->ext, 3); 152 memcpy(ptr, dirent->ext, 3);
153 ptr[3] = '\0'; 153 ptr[3] = '\0';
154 while (*ptr && *ptr != ' ') 154 while (*ptr && *ptr != ' ')
155 ptr++; 155 ptr++;
156 } 156 }
157 *ptr = '\0'; 157 *ptr = '\0';
158 if (*s_name == DELETED_FLAG) 158 if (*s_name == DELETED_FLAG)
159 *s_name = '\0'; 159 *s_name = '\0';
160 else if (*s_name == aRING) 160 else if (*s_name == aRING)
161 *s_name = DELETED_FLAG; 161 *s_name = DELETED_FLAG;
162 downcase(s_name); 162 downcase(s_name);
163 } 163 }
164 164
165 static int flush_dirty_fat_buffer(fsdata *mydata); 165 static int flush_dirty_fat_buffer(fsdata *mydata);
166 #if !defined(CONFIG_FAT_WRITE) 166 #if !defined(CONFIG_FAT_WRITE)
167 /* Stub for read only operation */ 167 /* Stub for read only operation */
168 int flush_dirty_fat_buffer(fsdata *mydata) 168 int flush_dirty_fat_buffer(fsdata *mydata)
169 { 169 {
170 (void)(mydata); 170 (void)(mydata);
171 return 0; 171 return 0;
172 } 172 }
173 #endif 173 #endif
174 174
175 /* 175 /*
176 * Get the entry at index 'entry' in a FAT (12/16/32) table. 176 * Get the entry at index 'entry' in a FAT (12/16/32) table.
177 * On failure 0x00 is returned. 177 * On failure 0x00 is returned.
178 */ 178 */
179 static __u32 get_fatent(fsdata *mydata, __u32 entry) 179 static __u32 get_fatent(fsdata *mydata, __u32 entry)
180 { 180 {
181 __u32 bufnum; 181 __u32 bufnum;
182 __u32 offset, off8; 182 __u32 offset, off8;
183 __u32 ret = 0x00; 183 __u32 ret = 0x00;
184 184
185 if (CHECK_CLUST(entry, mydata->fatsize)) { 185 if (CHECK_CLUST(entry, mydata->fatsize)) {
186 printf("Error: Invalid FAT entry: 0x%08x\n", entry); 186 printf("Error: Invalid FAT entry: 0x%08x\n", entry);
187 return ret; 187 return ret;
188 } 188 }
189 189
190 switch (mydata->fatsize) { 190 switch (mydata->fatsize) {
191 case 32: 191 case 32:
192 bufnum = entry / FAT32BUFSIZE; 192 bufnum = entry / FAT32BUFSIZE;
193 offset = entry - bufnum * FAT32BUFSIZE; 193 offset = entry - bufnum * FAT32BUFSIZE;
194 break; 194 break;
195 case 16: 195 case 16:
196 bufnum = entry / FAT16BUFSIZE; 196 bufnum = entry / FAT16BUFSIZE;
197 offset = entry - bufnum * FAT16BUFSIZE; 197 offset = entry - bufnum * FAT16BUFSIZE;
198 break; 198 break;
199 case 12: 199 case 12:
200 bufnum = entry / FAT12BUFSIZE; 200 bufnum = entry / FAT12BUFSIZE;
201 offset = entry - bufnum * FAT12BUFSIZE; 201 offset = entry - bufnum * FAT12BUFSIZE;
202 break; 202 break;
203 203
204 default: 204 default:
205 /* Unsupported FAT size */ 205 /* Unsupported FAT size */
206 return ret; 206 return ret;
207 } 207 }
208 208
209 debug("FAT%d: entry: 0x%08x = %d, offset: 0x%04x = %d\n", 209 debug("FAT%d: entry: 0x%08x = %d, offset: 0x%04x = %d\n",
210 mydata->fatsize, entry, entry, offset, offset); 210 mydata->fatsize, entry, entry, offset, offset);
211 211
212 /* Read a new block of FAT entries into the cache. */ 212 /* Read a new block of FAT entries into the cache. */
213 if (bufnum != mydata->fatbufnum) { 213 if (bufnum != mydata->fatbufnum) {
214 __u32 getsize = FATBUFBLOCKS; 214 __u32 getsize = FATBUFBLOCKS;
215 __u8 *bufptr = mydata->fatbuf; 215 __u8 *bufptr = mydata->fatbuf;
216 __u32 fatlength = mydata->fatlength; 216 __u32 fatlength = mydata->fatlength;
217 __u32 startblock = bufnum * FATBUFBLOCKS; 217 __u32 startblock = bufnum * FATBUFBLOCKS;
218 218
219 /* Cap length if fatlength is not a multiple of FATBUFBLOCKS */ 219 /* Cap length if fatlength is not a multiple of FATBUFBLOCKS */
220 if (startblock + getsize > fatlength) 220 if (startblock + getsize > fatlength)
221 getsize = fatlength - startblock; 221 getsize = fatlength - startblock;
222 222
223 startblock += mydata->fat_sect; /* Offset from start of disk */ 223 startblock += mydata->fat_sect; /* Offset from start of disk */
224 224
225 /* Write back the fatbuf to the disk */ 225 /* Write back the fatbuf to the disk */
226 if (flush_dirty_fat_buffer(mydata) < 0) 226 if (flush_dirty_fat_buffer(mydata) < 0)
227 return -1; 227 return -1;
228 228
229 if (disk_read(startblock, getsize, bufptr) < 0) { 229 if (disk_read(startblock, getsize, bufptr) < 0) {
230 debug("Error reading FAT blocks\n"); 230 debug("Error reading FAT blocks\n");
231 return ret; 231 return ret;
232 } 232 }
233 mydata->fatbufnum = bufnum; 233 mydata->fatbufnum = bufnum;
234 } 234 }
235 235
236 /* Get the actual entry from the table */ 236 /* Get the actual entry from the table */
237 switch (mydata->fatsize) { 237 switch (mydata->fatsize) {
238 case 32: 238 case 32:
239 ret = FAT2CPU32(((__u32 *) mydata->fatbuf)[offset]); 239 ret = FAT2CPU32(((__u32 *) mydata->fatbuf)[offset]);
240 break; 240 break;
241 case 16: 241 case 16:
242 ret = FAT2CPU16(((__u16 *) mydata->fatbuf)[offset]); 242 ret = FAT2CPU16(((__u16 *) mydata->fatbuf)[offset]);
243 break; 243 break;
244 case 12: 244 case 12:
245 off8 = (offset * 3) / 2; 245 off8 = (offset * 3) / 2;
246 /* fatbut + off8 may be unaligned, read in byte granularity */ 246 /* fatbut + off8 may be unaligned, read in byte granularity */
247 ret = mydata->fatbuf[off8] + (mydata->fatbuf[off8 + 1] << 8); 247 ret = mydata->fatbuf[off8] + (mydata->fatbuf[off8 + 1] << 8);
248 248
249 if (offset & 0x1) 249 if (offset & 0x1)
250 ret >>= 4; 250 ret >>= 4;
251 ret &= 0xfff; 251 ret &= 0xfff;
252 } 252 }
253 debug("FAT%d: ret: 0x%08x, entry: 0x%08x, offset: 0x%04x\n", 253 debug("FAT%d: ret: 0x%08x, entry: 0x%08x, offset: 0x%04x\n",
254 mydata->fatsize, ret, entry, offset); 254 mydata->fatsize, ret, entry, offset);
255 255
256 return ret; 256 return ret;
257 } 257 }
258 258
259 /* 259 /*
260 * Read at most 'size' bytes from the specified cluster into 'buffer'. 260 * Read at most 'size' bytes from the specified cluster into 'buffer'.
261 * Return 0 on success, -1 otherwise. 261 * Return 0 on success, -1 otherwise.
262 */ 262 */
263 static int 263 static int
264 get_cluster(fsdata *mydata, __u32 clustnum, __u8 *buffer, unsigned long size) 264 get_cluster(fsdata *mydata, __u32 clustnum, __u8 *buffer, unsigned long size)
265 { 265 {
266 __u32 idx = 0; 266 __u32 idx = 0;
267 __u32 startsect; 267 __u32 startsect;
268 int ret; 268 int ret;
269 269
270 if (clustnum > 0) { 270 if (clustnum > 0) {
271 startsect = mydata->data_begin + 271 startsect = mydata->data_begin +
272 clustnum * mydata->clust_size; 272 clustnum * mydata->clust_size;
273 } else { 273 } else {
274 startsect = mydata->rootdir_sect; 274 startsect = mydata->rootdir_sect;
275 } 275 }
276 276
277 debug("gc - clustnum: %d, startsect: %d\n", clustnum, startsect); 277 debug("gc - clustnum: %d, startsect: %d\n", clustnum, startsect);
278 278
279 if ((unsigned long)buffer & (ARCH_DMA_MINALIGN - 1)) { 279 if ((unsigned long)buffer & (ARCH_DMA_MINALIGN - 1)) {
280 ALLOC_CACHE_ALIGN_BUFFER(__u8, tmpbuf, mydata->sect_size); 280 ALLOC_CACHE_ALIGN_BUFFER(__u8, tmpbuf, mydata->sect_size);
281 281
282 printf("FAT: Misaligned buffer address (%p)\n", buffer); 282 printf("FAT: Misaligned buffer address (%p)\n", buffer);
283 283
284 while (size >= mydata->sect_size) { 284 while (size >= mydata->sect_size) {
285 ret = disk_read(startsect++, 1, tmpbuf); 285 ret = disk_read(startsect++, 1, tmpbuf);
286 if (ret != 1) { 286 if (ret != 1) {
287 debug("Error reading data (got %d)\n", ret); 287 debug("Error reading data (got %d)\n", ret);
288 return -1; 288 return -1;
289 } 289 }
290 290
291 memcpy(buffer, tmpbuf, mydata->sect_size); 291 memcpy(buffer, tmpbuf, mydata->sect_size);
292 buffer += mydata->sect_size; 292 buffer += mydata->sect_size;
293 size -= mydata->sect_size; 293 size -= mydata->sect_size;
294 } 294 }
295 } else { 295 } else {
296 idx = size / mydata->sect_size; 296 idx = size / mydata->sect_size;
297 ret = disk_read(startsect, idx, buffer); 297 ret = disk_read(startsect, idx, buffer);
298 if (ret != idx) { 298 if (ret != idx) {
299 debug("Error reading data (got %d)\n", ret); 299 debug("Error reading data (got %d)\n", ret);
300 return -1; 300 return -1;
301 } 301 }
302 startsect += idx; 302 startsect += idx;
303 idx *= mydata->sect_size; 303 idx *= mydata->sect_size;
304 buffer += idx; 304 buffer += idx;
305 size -= idx; 305 size -= idx;
306 } 306 }
307 if (size) { 307 if (size) {
308 ALLOC_CACHE_ALIGN_BUFFER(__u8, tmpbuf, mydata->sect_size); 308 ALLOC_CACHE_ALIGN_BUFFER(__u8, tmpbuf, mydata->sect_size);
309 309
310 ret = disk_read(startsect, 1, tmpbuf); 310 ret = disk_read(startsect, 1, tmpbuf);
311 if (ret != 1) { 311 if (ret != 1) {
312 debug("Error reading data (got %d)\n", ret); 312 debug("Error reading data (got %d)\n", ret);
313 return -1; 313 return -1;
314 } 314 }
315 315
316 memcpy(buffer, tmpbuf, size); 316 memcpy(buffer, tmpbuf, size);
317 } 317 }
318 318
319 return 0; 319 return 0;
320 } 320 }
321 321
322 /* 322 /*
323 * Read at most 'maxsize' bytes from 'pos' in the file associated with 'dentptr' 323 * Read at most 'maxsize' bytes from 'pos' in the file associated with 'dentptr'
324 * into 'buffer'. 324 * into 'buffer'.
325 * Update the number of bytes read in *gotsize or return -1 on fatal errors. 325 * Update the number of bytes read in *gotsize or return -1 on fatal errors.
326 */ 326 */
327 __u8 get_contents_vfatname_block[MAX_CLUSTSIZE] 327 __u8 get_contents_vfatname_block[MAX_CLUSTSIZE]
328 __aligned(ARCH_DMA_MINALIGN); 328 __aligned(ARCH_DMA_MINALIGN);
329 329
330 static int get_contents(fsdata *mydata, dir_entry *dentptr, loff_t pos, 330 static int get_contents(fsdata *mydata, dir_entry *dentptr, loff_t pos,
331 __u8 *buffer, loff_t maxsize, loff_t *gotsize) 331 __u8 *buffer, loff_t maxsize, loff_t *gotsize)
332 { 332 {
333 loff_t filesize = FAT2CPU32(dentptr->size); 333 loff_t filesize = FAT2CPU32(dentptr->size);
334 unsigned int bytesperclust = mydata->clust_size * mydata->sect_size; 334 unsigned int bytesperclust = mydata->clust_size * mydata->sect_size;
335 __u32 curclust = START(dentptr); 335 __u32 curclust = START(dentptr);
336 __u32 endclust, newclust; 336 __u32 endclust, newclust;
337 loff_t actsize; 337 loff_t actsize;
338 338
339 *gotsize = 0; 339 *gotsize = 0;
340 debug("Filesize: %llu bytes\n", filesize); 340 debug("Filesize: %llu bytes\n", filesize);
341 341
342 if (pos >= filesize) { 342 if (pos >= filesize) {
343 debug("Read position past EOF: %llu\n", pos); 343 debug("Read position past EOF: %llu\n", pos);
344 return 0; 344 return 0;
345 } 345 }
346 346
347 if (maxsize > 0 && filesize > pos + maxsize) 347 if (maxsize > 0 && filesize > pos + maxsize)
348 filesize = pos + maxsize; 348 filesize = pos + maxsize;
349 349
350 debug("%llu bytes\n", filesize); 350 debug("%llu bytes\n", filesize);
351 351
352 actsize = bytesperclust; 352 actsize = bytesperclust;
353 353
354 /* go to cluster at pos */ 354 /* go to cluster at pos */
355 while (actsize <= pos) { 355 while (actsize <= pos) {
356 curclust = get_fatent(mydata, curclust); 356 curclust = get_fatent(mydata, curclust);
357 if (CHECK_CLUST(curclust, mydata->fatsize)) { 357 if (CHECK_CLUST(curclust, mydata->fatsize)) {
358 debug("curclust: 0x%x\n", curclust); 358 debug("curclust: 0x%x\n", curclust);
359 debug("Invalid FAT entry\n"); 359 debug("Invalid FAT entry\n");
360 return 0; 360 return 0;
361 } 361 }
362 actsize += bytesperclust; 362 actsize += bytesperclust;
363 } 363 }
364 364
365 /* actsize > pos */ 365 /* actsize > pos */
366 actsize -= bytesperclust; 366 actsize -= bytesperclust;
367 filesize -= actsize; 367 filesize -= actsize;
368 pos -= actsize; 368 pos -= actsize;
369 369
370 /* align to beginning of next cluster if any */ 370 /* align to beginning of next cluster if any */
371 if (pos) { 371 if (pos) {
372 actsize = min(filesize, (loff_t)bytesperclust); 372 actsize = min(filesize, (loff_t)bytesperclust);
373 if (get_cluster(mydata, curclust, get_contents_vfatname_block, 373 if (get_cluster(mydata, curclust, get_contents_vfatname_block,
374 (int)actsize) != 0) { 374 (int)actsize) != 0) {
375 printf("Error reading cluster\n"); 375 printf("Error reading cluster\n");
376 return -1; 376 return -1;
377 } 377 }
378 filesize -= actsize; 378 filesize -= actsize;
379 actsize -= pos; 379 actsize -= pos;
380 memcpy(buffer, get_contents_vfatname_block + pos, actsize); 380 memcpy(buffer, get_contents_vfatname_block + pos, actsize);
381 *gotsize += actsize; 381 *gotsize += actsize;
382 if (!filesize) 382 if (!filesize)
383 return 0; 383 return 0;
384 buffer += actsize; 384 buffer += actsize;
385 385
386 curclust = get_fatent(mydata, curclust); 386 curclust = get_fatent(mydata, curclust);
387 if (CHECK_CLUST(curclust, mydata->fatsize)) { 387 if (CHECK_CLUST(curclust, mydata->fatsize)) {
388 debug("curclust: 0x%x\n", curclust); 388 debug("curclust: 0x%x\n", curclust);
389 debug("Invalid FAT entry\n"); 389 debug("Invalid FAT entry\n");
390 return 0; 390 return 0;
391 } 391 }
392 } 392 }
393 393
394 actsize = bytesperclust; 394 actsize = bytesperclust;
395 endclust = curclust; 395 endclust = curclust;
396 396
397 do { 397 do {
398 /* search for consecutive clusters */ 398 /* search for consecutive clusters */
399 while (actsize < filesize) { 399 while (actsize < filesize) {
400 newclust = get_fatent(mydata, endclust); 400 newclust = get_fatent(mydata, endclust);
401 if ((newclust - 1) != endclust) 401 if ((newclust - 1) != endclust)
402 goto getit; 402 goto getit;
403 if (CHECK_CLUST(newclust, mydata->fatsize)) { 403 if (CHECK_CLUST(newclust, mydata->fatsize)) {
404 debug("curclust: 0x%x\n", newclust); 404 debug("curclust: 0x%x\n", newclust);
405 debug("Invalid FAT entry\n"); 405 debug("Invalid FAT entry\n");
406 return 0; 406 return 0;
407 } 407 }
408 endclust = newclust; 408 endclust = newclust;
409 actsize += bytesperclust; 409 actsize += bytesperclust;
410 } 410 }
411 411
412 /* get remaining bytes */ 412 /* get remaining bytes */
413 actsize = filesize; 413 actsize = filesize;
414 if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) { 414 if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
415 printf("Error reading cluster\n"); 415 printf("Error reading cluster\n");
416 return -1; 416 return -1;
417 } 417 }
418 *gotsize += actsize; 418 *gotsize += actsize;
419 return 0; 419 return 0;
420 getit: 420 getit:
421 if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) { 421 if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
422 printf("Error reading cluster\n"); 422 printf("Error reading cluster\n");
423 return -1; 423 return -1;
424 } 424 }
425 *gotsize += (int)actsize; 425 *gotsize += (int)actsize;
426 filesize -= actsize; 426 filesize -= actsize;
427 buffer += actsize; 427 buffer += actsize;
428 428
429 curclust = get_fatent(mydata, endclust); 429 curclust = get_fatent(mydata, endclust);
430 if (CHECK_CLUST(curclust, mydata->fatsize)) { 430 if (CHECK_CLUST(curclust, mydata->fatsize)) {
431 debug("curclust: 0x%x\n", curclust); 431 debug("curclust: 0x%x\n", curclust);
432 printf("Invalid FAT entry\n"); 432 printf("Invalid FAT entry\n");
433 return 0; 433 return 0;
434 } 434 }
435 actsize = bytesperclust; 435 actsize = bytesperclust;
436 endclust = curclust; 436 endclust = curclust;
437 } while (1); 437 } while (1);
438 } 438 }
439 439
440 /* 440 /*
441 * Extract the file name information from 'slotptr' into 'l_name', 441 * Extract the file name information from 'slotptr' into 'l_name',
442 * starting at l_name[*idx]. 442 * starting at l_name[*idx].
443 * Return 1 if terminator (zero byte) is found, 0 otherwise. 443 * Return 1 if terminator (zero byte) is found, 0 otherwise.
444 */ 444 */
445 static int slot2str(dir_slot *slotptr, char *l_name, int *idx) 445 static int slot2str(dir_slot *slotptr, char *l_name, int *idx)
446 { 446 {
447 int j; 447 int j;
448 448
449 for (j = 0; j <= 8; j += 2) { 449 for (j = 0; j <= 8; j += 2) {
450 l_name[*idx] = slotptr->name0_4[j]; 450 l_name[*idx] = slotptr->name0_4[j];
451 if (l_name[*idx] == 0x00) 451 if (l_name[*idx] == 0x00)
452 return 1; 452 return 1;
453 (*idx)++; 453 (*idx)++;
454 } 454 }
455 for (j = 0; j <= 10; j += 2) { 455 for (j = 0; j <= 10; j += 2) {
456 l_name[*idx] = slotptr->name5_10[j]; 456 l_name[*idx] = slotptr->name5_10[j];
457 if (l_name[*idx] == 0x00) 457 if (l_name[*idx] == 0x00)
458 return 1; 458 return 1;
459 (*idx)++; 459 (*idx)++;
460 } 460 }
461 for (j = 0; j <= 2; j += 2) { 461 for (j = 0; j <= 2; j += 2) {
462 l_name[*idx] = slotptr->name11_12[j]; 462 l_name[*idx] = slotptr->name11_12[j];
463 if (l_name[*idx] == 0x00) 463 if (l_name[*idx] == 0x00)
464 return 1; 464 return 1;
465 (*idx)++; 465 (*idx)++;
466 } 466 }
467 467
468 return 0; 468 return 0;
469 } 469 }
470 470
471 /* 471 /*
472 * Extract the full long filename starting at 'retdent' (which is really 472 * Extract the full long filename starting at 'retdent' (which is really
473 * a slot) into 'l_name'. If successful also copy the real directory entry 473 * a slot) into 'l_name'. If successful also copy the real directory entry
474 * into 'retdent' 474 * into 'retdent'
475 * Return 0 on success, -1 otherwise. 475 * Return 0 on success, -1 otherwise.
476 */ 476 */
477 static int 477 static int
478 get_vfatname(fsdata *mydata, int curclust, __u8 *cluster, 478 get_vfatname(fsdata *mydata, int curclust, __u8 *cluster,
479 dir_entry *retdent, char *l_name) 479 dir_entry *retdent, char *l_name)
480 { 480 {
481 dir_entry *realdent; 481 dir_entry *realdent;
482 dir_slot *slotptr = (dir_slot *)retdent; 482 dir_slot *slotptr = (dir_slot *)retdent;
483 __u8 *buflimit = cluster + mydata->sect_size * ((curclust == 0) ? 483 __u8 *buflimit = cluster + mydata->sect_size * ((curclust == 0) ?
484 PREFETCH_BLOCKS : 484 PREFETCH_BLOCKS :
485 mydata->clust_size); 485 mydata->clust_size);
486 __u8 counter = (slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff; 486 __u8 counter = (slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff;
487 int idx = 0; 487 int idx = 0;
488 488
489 if (counter > VFAT_MAXSEQ) { 489 if (counter > VFAT_MAXSEQ) {
490 debug("Error: VFAT name is too long\n"); 490 debug("Error: VFAT name is too long\n");
491 return -1; 491 return -1;
492 } 492 }
493 493
494 while ((__u8 *)slotptr < buflimit) { 494 while ((__u8 *)slotptr < buflimit) {
495 if (counter == 0) 495 if (counter == 0)
496 break; 496 break;
497 if (((slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff) != counter) 497 if (((slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff) != counter)
498 return -1; 498 return -1;
499 slotptr++; 499 slotptr++;
500 counter--; 500 counter--;
501 } 501 }
502 502
503 if ((__u8 *)slotptr >= buflimit) { 503 if ((__u8 *)slotptr >= buflimit) {
504 dir_slot *slotptr2; 504 dir_slot *slotptr2;
505 505
506 if (curclust == 0) 506 if (curclust == 0)
507 return -1; 507 return -1;
508 curclust = get_fatent(mydata, curclust); 508 curclust = get_fatent(mydata, curclust);
509 if (CHECK_CLUST(curclust, mydata->fatsize)) { 509 if (CHECK_CLUST(curclust, mydata->fatsize)) {
510 debug("curclust: 0x%x\n", curclust); 510 debug("curclust: 0x%x\n", curclust);
511 printf("Invalid FAT entry\n"); 511 printf("Invalid FAT entry\n");
512 return -1; 512 return -1;
513 } 513 }
514 514
515 if (get_cluster(mydata, curclust, get_contents_vfatname_block, 515 if (get_cluster(mydata, curclust, get_contents_vfatname_block,
516 mydata->clust_size * mydata->sect_size) != 0) { 516 mydata->clust_size * mydata->sect_size) != 0) {
517 debug("Error: reading directory block\n"); 517 debug("Error: reading directory block\n");
518 return -1; 518 return -1;
519 } 519 }
520 520
521 slotptr2 = (dir_slot *)get_contents_vfatname_block; 521 slotptr2 = (dir_slot *)get_contents_vfatname_block;
522 while (counter > 0) { 522 while (counter > 0) {
523 if (((slotptr2->id & ~LAST_LONG_ENTRY_MASK) 523 if (((slotptr2->id & ~LAST_LONG_ENTRY_MASK)
524 & 0xff) != counter) 524 & 0xff) != counter)
525 return -1; 525 return -1;
526 slotptr2++; 526 slotptr2++;
527 counter--; 527 counter--;
528 } 528 }
529 529
530 /* Save the real directory entry */ 530 /* Save the real directory entry */
531 realdent = (dir_entry *)slotptr2; 531 realdent = (dir_entry *)slotptr2;
532 while ((__u8 *)slotptr2 > get_contents_vfatname_block) { 532 while ((__u8 *)slotptr2 > get_contents_vfatname_block) {
533 slotptr2--; 533 slotptr2--;
534 slot2str(slotptr2, l_name, &idx); 534 slot2str(slotptr2, l_name, &idx);
535 } 535 }
536 } else { 536 } else {
537 /* Save the real directory entry */ 537 /* Save the real directory entry */
538 realdent = (dir_entry *)slotptr; 538 realdent = (dir_entry *)slotptr;
539 } 539 }
540 540
541 do { 541 do {
542 slotptr--; 542 slotptr--;
543 if (slot2str(slotptr, l_name, &idx)) 543 if (slot2str(slotptr, l_name, &idx))
544 break; 544 break;
545 } while (!(slotptr->id & LAST_LONG_ENTRY_MASK)); 545 } while (!(slotptr->id & LAST_LONG_ENTRY_MASK));
546 546
547 l_name[idx] = '\0'; 547 l_name[idx] = '\0';
548 if (*l_name == DELETED_FLAG) 548 if (*l_name == DELETED_FLAG)
549 *l_name = '\0'; 549 *l_name = '\0';
550 else if (*l_name == aRING) 550 else if (*l_name == aRING)
551 *l_name = DELETED_FLAG; 551 *l_name = DELETED_FLAG;
552 downcase(l_name); 552 downcase(l_name);
553 553
554 /* Return the real directory entry */ 554 /* Return the real directory entry */
555 memcpy(retdent, realdent, sizeof(dir_entry)); 555 memcpy(retdent, realdent, sizeof(dir_entry));
556 556
557 return 0; 557 return 0;
558 } 558 }
559 559
560 /* Calculate short name checksum */ 560 /* Calculate short name checksum */
561 static __u8 mkcksum(const char name[8], const char ext[3]) 561 static __u8 mkcksum(const char name[8], const char ext[3])
562 { 562 {
563 int i; 563 int i;
564 564
565 __u8 ret = 0; 565 __u8 ret = 0;
566 566
567 for (i = 0; i < 8; i++) 567 for (i = 0; i < 8; i++)
568 ret = (((ret & 1) << 7) | ((ret & 0xfe) >> 1)) + name[i]; 568 ret = (((ret & 1) << 7) | ((ret & 0xfe) >> 1)) + name[i];
569 for (i = 0; i < 3; i++) 569 for (i = 0; i < 3; i++)
570 ret = (((ret & 1) << 7) | ((ret & 0xfe) >> 1)) + ext[i]; 570 ret = (((ret & 1) << 7) | ((ret & 0xfe) >> 1)) + ext[i];
571 571
572 return ret; 572 return ret;
573 } 573 }
574 574
575 /* 575 /*
576 * Get the directory entry associated with 'filename' from the directory 576 * Get the directory entry associated with 'filename' from the directory
577 * starting at 'startsect' 577 * starting at 'startsect'
578 */ 578 */
579 __u8 get_dentfromdir_block[MAX_CLUSTSIZE] 579 __u8 get_dentfromdir_block[MAX_CLUSTSIZE]
580 __aligned(ARCH_DMA_MINALIGN); 580 __aligned(ARCH_DMA_MINALIGN);
581 581
582 static dir_entry *get_dentfromdir(fsdata *mydata, int startsect, 582 static dir_entry *get_dentfromdir(fsdata *mydata, int startsect,
583 char *filename, dir_entry *retdent, 583 char *filename, dir_entry *retdent,
584 int dols) 584 int dols)
585 { 585 {
586 __u16 prevcksum = 0xffff; 586 __u16 prevcksum = 0xffff;
587 __u32 curclust = START(retdent); 587 __u32 curclust = START(retdent);
588 int files = 0, dirs = 0; 588 int files = 0, dirs = 0;
589 589
590 debug("get_dentfromdir: %s\n", filename); 590 debug("get_dentfromdir: %s\n", filename);
591 591
592 while (1) { 592 while (1) {
593 dir_entry *dentptr; 593 dir_entry *dentptr;
594 594
595 int i; 595 int i;
596 596
597 if (get_cluster(mydata, curclust, get_dentfromdir_block, 597 if (get_cluster(mydata, curclust, get_dentfromdir_block,
598 mydata->clust_size * mydata->sect_size) != 0) { 598 mydata->clust_size * mydata->sect_size) != 0) {
599 debug("Error: reading directory block\n"); 599 debug("Error: reading directory block\n");
600 return NULL; 600 return NULL;
601 } 601 }
602 602
603 dentptr = (dir_entry *)get_dentfromdir_block; 603 dentptr = (dir_entry *)get_dentfromdir_block;
604 604
605 for (i = 0; i < DIRENTSPERCLUST; i++) { 605 for (i = 0; i < DIRENTSPERCLUST; i++) {
606 char s_name[14], l_name[VFAT_MAXLEN_BYTES]; 606 char s_name[14], l_name[VFAT_MAXLEN_BYTES];
607 607
608 l_name[0] = '\0'; 608 l_name[0] = '\0';
609 if (dentptr->name[0] == DELETED_FLAG) { 609 if (dentptr->name[0] == DELETED_FLAG) {
610 dentptr++; 610 dentptr++;
611 continue; 611 continue;
612 } 612 }
613 if ((dentptr->attr & ATTR_VOLUME)) { 613 if ((dentptr->attr & ATTR_VOLUME)) {
614 if (vfat_enabled && 614 if (vfat_enabled &&
615 (dentptr->attr & ATTR_VFAT) == ATTR_VFAT && 615 (dentptr->attr & ATTR_VFAT) == ATTR_VFAT &&
616 (dentptr->name[0] & LAST_LONG_ENTRY_MASK)) { 616 (dentptr->name[0] & LAST_LONG_ENTRY_MASK)) {
617 prevcksum = ((dir_slot *)dentptr)->alias_checksum; 617 prevcksum = ((dir_slot *)dentptr)->alias_checksum;
618 get_vfatname(mydata, curclust, 618 get_vfatname(mydata, curclust,
619 get_dentfromdir_block, 619 get_dentfromdir_block,
620 dentptr, l_name); 620 dentptr, l_name);
621 if (dols) { 621 if (dols) {
622 int isdir; 622 int isdir;
623 char dirc; 623 char dirc;
624 int doit = 0; 624 int doit = 0;
625 625
626 isdir = (dentptr->attr & ATTR_DIR); 626 isdir = (dentptr->attr & ATTR_DIR);
627 627
628 if (isdir) { 628 if (isdir) {
629 dirs++; 629 dirs++;
630 dirc = '/'; 630 dirc = '/';
631 doit = 1; 631 doit = 1;
632 } else { 632 } else {
633 dirc = ' '; 633 dirc = ' ';
634 if (l_name[0] != 0) { 634 if (l_name[0] != 0) {
635 files++; 635 files++;
636 doit = 1; 636 doit = 1;
637 } 637 }
638 } 638 }
639 if (doit) { 639 if (doit) {
640 if (dirc == ' ') { 640 if (dirc == ' ') {
641 printf(" %8u %s%c\n", 641 printf(" %8u %s%c\n",
642 FAT2CPU32(dentptr->size), 642 FAT2CPU32(dentptr->size),
643 l_name, 643 l_name,
644 dirc); 644 dirc);
645 } else { 645 } else {
646 printf(" %s%c\n", 646 printf(" %s%c\n",
647 l_name, 647 l_name,
648 dirc); 648 dirc);
649 } 649 }
650 } 650 }
651 dentptr++; 651 dentptr++;
652 continue; 652 continue;
653 } 653 }
654 debug("vfatname: |%s|\n", l_name); 654 debug("vfatname: |%s|\n", l_name);
655 } else { 655 } else {
656 /* Volume label or VFAT entry */ 656 /* Volume label or VFAT entry */
657 dentptr++; 657 dentptr++;
658 continue; 658 continue;
659 } 659 }
660 } 660 }
661 if (dentptr->name[0] == 0) { 661 if (dentptr->name[0] == 0) {
662 if (dols) { 662 if (dols) {
663 printf("\n%d file(s), %d dir(s)\n\n", 663 printf("\n%d file(s), %d dir(s)\n\n",
664 files, dirs); 664 files, dirs);
665 } 665 }
666 debug("Dentname == NULL - %d\n", i); 666 debug("Dentname == NULL - %d\n", i);
667 return NULL; 667 return NULL;
668 } 668 }
669 if (vfat_enabled) { 669 if (vfat_enabled) {
670 __u8 csum = mkcksum(dentptr->name, dentptr->ext); 670 __u8 csum = mkcksum(dentptr->name, dentptr->ext);
671 if (dols && csum == prevcksum) { 671 if (dols && csum == prevcksum) {
672 prevcksum = 0xffff; 672 prevcksum = 0xffff;
673 dentptr++; 673 dentptr++;
674 continue; 674 continue;
675 } 675 }
676 } 676 }
677 677
678 get_name(dentptr, s_name); 678 get_name(dentptr, s_name);
679 if (dols) { 679 if (dols) {
680 int isdir = (dentptr->attr & ATTR_DIR); 680 int isdir = (dentptr->attr & ATTR_DIR);
681 char dirc; 681 char dirc;
682 int doit = 0; 682 int doit = 0;
683 683
684 if (isdir) { 684 if (isdir) {
685 dirs++; 685 dirs++;
686 dirc = '/'; 686 dirc = '/';
687 doit = 1; 687 doit = 1;
688 } else { 688 } else {
689 dirc = ' '; 689 dirc = ' ';
690 if (s_name[0] != 0) { 690 if (s_name[0] != 0) {
691 files++; 691 files++;
692 doit = 1; 692 doit = 1;
693 } 693 }
694 } 694 }
695 695
696 if (doit) { 696 if (doit) {
697 if (dirc == ' ') { 697 if (dirc == ' ') {
698 printf(" %8u %s%c\n", 698 printf(" %8u %s%c\n",
699 FAT2CPU32(dentptr->size), 699 FAT2CPU32(dentptr->size),
700 s_name, dirc); 700 s_name, dirc);
701 } else { 701 } else {
702 printf(" %s%c\n", 702 printf(" %s%c\n",
703 s_name, dirc); 703 s_name, dirc);
704 } 704 }
705 } 705 }
706 706
707 dentptr++; 707 dentptr++;
708 continue; 708 continue;
709 } 709 }
710 710
711 if (strcmp(filename, s_name) 711 if (strcmp(filename, s_name)
712 && strcmp(filename, l_name)) { 712 && strcmp(filename, l_name)) {
713 debug("Mismatch: |%s|%s|\n", s_name, l_name); 713 debug("Mismatch: |%s|%s|\n", s_name, l_name);
714 dentptr++; 714 dentptr++;
715 continue; 715 continue;
716 } 716 }
717 717
718 memcpy(retdent, dentptr, sizeof(dir_entry)); 718 memcpy(retdent, dentptr, sizeof(dir_entry));
719 719
720 debug("DentName: %s", s_name); 720 debug("DentName: %s", s_name);
721 debug(", start: 0x%x", START(dentptr)); 721 debug(", start: 0x%x", START(dentptr));
722 debug(", size: 0x%x %s\n", 722 debug(", size: 0x%x %s\n",
723 FAT2CPU32(dentptr->size), 723 FAT2CPU32(dentptr->size),
724 (dentptr->attr & ATTR_DIR) ? "(DIR)" : ""); 724 (dentptr->attr & ATTR_DIR) ? "(DIR)" : "");
725 725
726 return retdent; 726 return retdent;
727 } 727 }
728 728
729 curclust = get_fatent(mydata, curclust); 729 curclust = get_fatent(mydata, curclust);
730 if (CHECK_CLUST(curclust, mydata->fatsize)) { 730 if (CHECK_CLUST(curclust, mydata->fatsize)) {
731 debug("curclust: 0x%x\n", curclust); 731 debug("curclust: 0x%x\n", curclust);
732 printf("Invalid FAT entry\n"); 732 printf("Invalid FAT entry\n");
733 return NULL; 733 return NULL;
734 } 734 }
735 } 735 }
736 736
737 return NULL; 737 return NULL;
738 } 738 }
739 739
740 /* 740 /*
741 * Read boot sector and volume info from a FAT filesystem 741 * Read boot sector and volume info from a FAT filesystem
742 */ 742 */
743 static int 743 static int
744 read_bootsectandvi(boot_sector *bs, volume_info *volinfo, int *fatsize) 744 read_bootsectandvi(boot_sector *bs, volume_info *volinfo, int *fatsize)
745 { 745 {
746 __u8 *block; 746 __u8 *block;
747 volume_info *vistart; 747 volume_info *vistart;
748 int ret = 0; 748 int ret = 0;
749 749
750 if (cur_dev == NULL) { 750 if (cur_dev == NULL) {
751 debug("Error: no device selected\n"); 751 debug("Error: no device selected\n");
752 return -1; 752 return -1;
753 } 753 }
754 754
755 block = memalign(ARCH_DMA_MINALIGN, cur_dev->blksz); 755 block = memalign(ARCH_DMA_MINALIGN, cur_dev->blksz);
756 if (block == NULL) { 756 if (block == NULL) {
757 debug("Error: allocating block\n"); 757 debug("Error: allocating block\n");
758 return -1; 758 return -1;
759 } 759 }
760 760
761 if (disk_read(0, 1, block) < 0) { 761 if (disk_read(0, 1, block) < 0) {
762 debug("Error: reading block\n"); 762 debug("Error: reading block\n");
763 goto fail; 763 goto fail;
764 } 764 }
765 765
766 memcpy(bs, block, sizeof(boot_sector)); 766 memcpy(bs, block, sizeof(boot_sector));
767 bs->reserved = FAT2CPU16(bs->reserved); 767 bs->reserved = FAT2CPU16(bs->reserved);
768 bs->fat_length = FAT2CPU16(bs->fat_length); 768 bs->fat_length = FAT2CPU16(bs->fat_length);
769 bs->secs_track = FAT2CPU16(bs->secs_track); 769 bs->secs_track = FAT2CPU16(bs->secs_track);
770 bs->heads = FAT2CPU16(bs->heads); 770 bs->heads = FAT2CPU16(bs->heads);
771 bs->total_sect = FAT2CPU32(bs->total_sect); 771 bs->total_sect = FAT2CPU32(bs->total_sect);
772 772
773 /* FAT32 entries */ 773 /* FAT32 entries */
774 if (bs->fat_length == 0) { 774 if (bs->fat_length == 0) {
775 /* Assume FAT32 */ 775 /* Assume FAT32 */
776 bs->fat32_length = FAT2CPU32(bs->fat32_length); 776 bs->fat32_length = FAT2CPU32(bs->fat32_length);
777 bs->flags = FAT2CPU16(bs->flags); 777 bs->flags = FAT2CPU16(bs->flags);
778 bs->root_cluster = FAT2CPU32(bs->root_cluster); 778 bs->root_cluster = FAT2CPU32(bs->root_cluster);
779 bs->info_sector = FAT2CPU16(bs->info_sector); 779 bs->info_sector = FAT2CPU16(bs->info_sector);
780 bs->backup_boot = FAT2CPU16(bs->backup_boot); 780 bs->backup_boot = FAT2CPU16(bs->backup_boot);
781 vistart = (volume_info *)(block + sizeof(boot_sector)); 781 vistart = (volume_info *)(block + sizeof(boot_sector));
782 *fatsize = 32; 782 *fatsize = 32;
783 } else { 783 } else {
784 vistart = (volume_info *)&(bs->fat32_length); 784 vistart = (volume_info *)&(bs->fat32_length);
785 *fatsize = 0; 785 *fatsize = 0;
786 } 786 }
787 memcpy(volinfo, vistart, sizeof(volume_info)); 787 memcpy(volinfo, vistart, sizeof(volume_info));
788 788
789 if (*fatsize == 32) { 789 if (*fatsize == 32) {
790 if (strncmp(FAT32_SIGN, vistart->fs_type, SIGNLEN) == 0) 790 if (strncmp(FAT32_SIGN, vistart->fs_type, SIGNLEN) == 0)
791 goto exit; 791 goto exit;
792 } else { 792 } else {
793 if (strncmp(FAT12_SIGN, vistart->fs_type, SIGNLEN) == 0) { 793 if (strncmp(FAT12_SIGN, vistart->fs_type, SIGNLEN) == 0) {
794 *fatsize = 12; 794 *fatsize = 12;
795 goto exit; 795 goto exit;
796 } 796 }
797 if (strncmp(FAT16_SIGN, vistart->fs_type, SIGNLEN) == 0) { 797 if (strncmp(FAT16_SIGN, vistart->fs_type, SIGNLEN) == 0) {
798 *fatsize = 16; 798 *fatsize = 16;
799 goto exit; 799 goto exit;
800 } 800 }
801 } 801 }
802 802
803 debug("Error: broken fs_type sign\n"); 803 debug("Error: broken fs_type sign\n");
804 fail: 804 fail:
805 ret = -1; 805 ret = -1;
806 exit: 806 exit:
807 free(block); 807 free(block);
808 return ret; 808 return ret;
809 } 809 }
810 810
811 __u8 do_fat_read_at_block[MAX_CLUSTSIZE] 811 __u8 do_fat_read_at_block[MAX_CLUSTSIZE]
812 __aligned(ARCH_DMA_MINALIGN); 812 __aligned(ARCH_DMA_MINALIGN);
813 813
814 int do_fat_read_at(const char *filename, loff_t pos, void *buffer, 814 int do_fat_read_at(const char *filename, loff_t pos, void *buffer,
815 loff_t maxsize, int dols, int dogetsize, loff_t *size) 815 loff_t maxsize, int dols, int dogetsize, loff_t *size)
816 { 816 {
817 char fnamecopy[2048]; 817 char fnamecopy[2048];
818 boot_sector bs; 818 boot_sector bs;
819 volume_info volinfo; 819 volume_info volinfo;
820 fsdata datablock; 820 fsdata datablock;
821 fsdata *mydata = &datablock; 821 fsdata *mydata = &datablock;
822 dir_entry *dentptr = NULL; 822 dir_entry *dentptr = NULL;
823 __u16 prevcksum = 0xffff; 823 __u16 prevcksum = 0xffff;
824 char *subname = ""; 824 char *subname = "";
825 __u32 cursect; 825 __u32 cursect;
826 int idx, isdir = 0; 826 int idx, isdir = 0;
827 int files = 0, dirs = 0; 827 int files = 0, dirs = 0;
828 int ret = -1; 828 int ret = -1;
829 int firsttime; 829 int firsttime;
830 __u32 root_cluster = 0; 830 __u32 root_cluster = 0;
831 __u32 read_blk; 831 __u32 read_blk;
832 int rootdir_size = 0; 832 int rootdir_size = 0;
833 int buffer_blk_cnt; 833 int buffer_blk_cnt;
834 int do_read; 834 int do_read;
835 __u8 *dir_ptr; 835 __u8 *dir_ptr;
836 836
837 if (read_bootsectandvi(&bs, &volinfo, &mydata->fatsize)) { 837 if (read_bootsectandvi(&bs, &volinfo, &mydata->fatsize)) {
838 debug("Error: reading boot sector\n"); 838 debug("Error: reading boot sector\n");
839 return -1; 839 return -1;
840 } 840 }
841 841
842 if (mydata->fatsize == 32) { 842 if (mydata->fatsize == 32) {
843 root_cluster = bs.root_cluster; 843 root_cluster = bs.root_cluster;
844 mydata->fatlength = bs.fat32_length; 844 mydata->fatlength = bs.fat32_length;
845 } else { 845 } else {
846 mydata->fatlength = bs.fat_length; 846 mydata->fatlength = bs.fat_length;
847 } 847 }
848 848
849 mydata->fat_sect = bs.reserved; 849 mydata->fat_sect = bs.reserved;
850 850
851 cursect = mydata->rootdir_sect 851 cursect = mydata->rootdir_sect
852 = mydata->fat_sect + mydata->fatlength * bs.fats; 852 = mydata->fat_sect + mydata->fatlength * bs.fats;
853 853
854 mydata->sect_size = (bs.sector_size[1] << 8) + bs.sector_size[0]; 854 mydata->sect_size = (bs.sector_size[1] << 8) + bs.sector_size[0];
855 mydata->clust_size = bs.cluster_size; 855 mydata->clust_size = bs.cluster_size;
856 if (mydata->sect_size != cur_part_info.blksz) { 856 if (mydata->sect_size != cur_part_info.blksz) {
857 printf("Error: FAT sector size mismatch (fs=%hu, dev=%lu)\n", 857 printf("Error: FAT sector size mismatch (fs=%hu, dev=%lu)\n",
858 mydata->sect_size, cur_part_info.blksz); 858 mydata->sect_size, cur_part_info.blksz);
859 return -1; 859 return -1;
860 } 860 }
861 861
862 if (mydata->fatsize == 32) { 862 if (mydata->fatsize == 32) {
863 mydata->data_begin = mydata->rootdir_sect - 863 mydata->data_begin = mydata->rootdir_sect -
864 (mydata->clust_size * 2); 864 (mydata->clust_size * 2);
865 } else { 865 } else {
866 rootdir_size = ((bs.dir_entries[1] * (int)256 + 866 rootdir_size = ((bs.dir_entries[1] * (int)256 +
867 bs.dir_entries[0]) * 867 bs.dir_entries[0]) *
868 sizeof(dir_entry)) / 868 sizeof(dir_entry)) /
869 mydata->sect_size; 869 mydata->sect_size;
870 mydata->data_begin = mydata->rootdir_sect + 870 mydata->data_begin = mydata->rootdir_sect +
871 rootdir_size - 871 rootdir_size -
872 (mydata->clust_size * 2); 872 (mydata->clust_size * 2);
873 } 873 }
874 874
875 mydata->fatbufnum = -1; 875 mydata->fatbufnum = -1;
876 mydata->fat_dirty = 0; 876 mydata->fat_dirty = 0;
877 mydata->fatbuf = memalign(ARCH_DMA_MINALIGN, FATBUFSIZE); 877 mydata->fatbuf = memalign(ARCH_DMA_MINALIGN, FATBUFSIZE);
878 if (mydata->fatbuf == NULL) { 878 if (mydata->fatbuf == NULL) {
879 debug("Error: allocating memory\n"); 879 debug("Error: allocating memory\n");
880 return -1; 880 return -1;
881 } 881 }
882 882
883 if (vfat_enabled) 883 if (vfat_enabled)
884 debug("VFAT Support enabled\n"); 884 debug("VFAT Support enabled\n");
885 885
886 debug("FAT%d, fat_sect: %d, fatlength: %d\n", 886 debug("FAT%d, fat_sect: %d, fatlength: %d\n",
887 mydata->fatsize, mydata->fat_sect, mydata->fatlength); 887 mydata->fatsize, mydata->fat_sect, mydata->fatlength);
888 debug("Rootdir begins at cluster: %d, sector: %d, offset: %x\n" 888 debug("Rootdir begins at cluster: %d, sector: %d, offset: %x\n"
889 "Data begins at: %d\n", 889 "Data begins at: %d\n",
890 root_cluster, 890 root_cluster,
891 mydata->rootdir_sect, 891 mydata->rootdir_sect,
892 mydata->rootdir_sect * mydata->sect_size, mydata->data_begin); 892 mydata->rootdir_sect * mydata->sect_size, mydata->data_begin);
893 debug("Sector size: %d, cluster size: %d\n", mydata->sect_size, 893 debug("Sector size: %d, cluster size: %d\n", mydata->sect_size,
894 mydata->clust_size); 894 mydata->clust_size);
895 895
896 /* "cwd" is always the root... */ 896 /* "cwd" is always the root... */
897 while (ISDIRDELIM(*filename)) 897 while (ISDIRDELIM(*filename))
898 filename++; 898 filename++;
899 899
900 /* Make a copy of the filename and convert it to lowercase */ 900 /* Make a copy of the filename and convert it to lowercase */
901 strcpy(fnamecopy, filename); 901 strcpy(fnamecopy, filename);
902 downcase(fnamecopy); 902 downcase(fnamecopy);
903 903
904 root_reparse: 904 root_reparse:
905 if (*fnamecopy == '\0') { 905 if (*fnamecopy == '\0') {
906 if (!dols) 906 if (!dols)
907 goto exit; 907 goto exit;
908 908
909 dols = LS_ROOT; 909 dols = LS_ROOT;
910 } else if ((idx = dirdelim(fnamecopy)) >= 0) { 910 } else if ((idx = dirdelim(fnamecopy)) >= 0) {
911 isdir = 1; 911 isdir = 1;
912 fnamecopy[idx] = '\0'; 912 fnamecopy[idx] = '\0';
913 subname = fnamecopy + idx + 1; 913 subname = fnamecopy + idx + 1;
914 914
915 /* Handle multiple delimiters */ 915 /* Handle multiple delimiters */
916 while (ISDIRDELIM(*subname)) 916 while (ISDIRDELIM(*subname))
917 subname++; 917 subname++;
918 } else if (dols) { 918 } else if (dols) {
919 isdir = 1; 919 isdir = 1;
920 } 920 }
921 921
922 buffer_blk_cnt = 0; 922 buffer_blk_cnt = 0;
923 firsttime = 1; 923 firsttime = 1;
924 while (1) { 924 while (1) {
925 int i; 925 int i;
926 926
927 if (mydata->fatsize == 32 || firsttime) { 927 if (mydata->fatsize == 32 || firsttime) {
928 dir_ptr = do_fat_read_at_block; 928 dir_ptr = do_fat_read_at_block;
929 firsttime = 0; 929 firsttime = 0;
930 } else { 930 } else {
931 /** 931 /**
932 * FAT16 sector buffer modification: 932 * FAT16 sector buffer modification:
933 * Each loop, the second buffered block is moved to 933 * Each loop, the second buffered block is moved to
934 * the buffer begin, and two next sectors are read 934 * the buffer begin, and two next sectors are read
935 * next to the previously moved one. So the sector 935 * next to the previously moved one. So the sector
936 * buffer keeps always 3 sectors for fat16. 936 * buffer keeps always 3 sectors for fat16.
937 * And the current sector is the buffer second sector 937 * And the current sector is the buffer second sector
938 * beside the "firsttime" read, when it is the first one. 938 * beside the "firsttime" read, when it is the first one.
939 * 939 *
940 * PREFETCH_BLOCKS is 2 for FAT16 == loop[0:1] 940 * PREFETCH_BLOCKS is 2 for FAT16 == loop[0:1]
941 * n = computed root dir sector 941 * n = computed root dir sector
942 * loop | cursect-1 | cursect | cursect+1 | 942 * loop | cursect-1 | cursect | cursect+1 |
943 * 0 | sector n+0 | sector n+1 | none | 943 * 0 | sector n+0 | sector n+1 | none |
944 * 1 | none | sector n+0 | sector n+1 | 944 * 1 | none | sector n+0 | sector n+1 |
945 * 0 | sector n+1 | sector n+2 | sector n+3 | 945 * 0 | sector n+1 | sector n+2 | sector n+3 |
946 * 1 | sector n+3 | ... 946 * 1 | sector n+3 | ...
947 */ 947 */
948 dir_ptr = (do_fat_read_at_block + mydata->sect_size); 948 dir_ptr = (do_fat_read_at_block + mydata->sect_size);
949 memcpy(do_fat_read_at_block, dir_ptr, mydata->sect_size); 949 memcpy(do_fat_read_at_block, dir_ptr, mydata->sect_size);
950 } 950 }
951 951
952 do_read = 1; 952 do_read = 1;
953 953
954 if (mydata->fatsize == 32 && buffer_blk_cnt) 954 if (mydata->fatsize == 32 && buffer_blk_cnt)
955 do_read = 0; 955 do_read = 0;
956 956
957 if (do_read) { 957 if (do_read) {
958 read_blk = (mydata->fatsize == 32) ? 958 read_blk = (mydata->fatsize == 32) ?
959 mydata->clust_size : PREFETCH_BLOCKS; 959 mydata->clust_size : PREFETCH_BLOCKS;
960 960
961 debug("FAT read(sect=%d, cnt:%d), clust_size=%d, DIRENTSPERBLOCK=%zd\n", 961 debug("FAT read(sect=%d, cnt:%d), clust_size=%d, DIRENTSPERBLOCK=%zd\n",
962 cursect, read_blk, mydata->clust_size, DIRENTSPERBLOCK); 962 cursect, read_blk, mydata->clust_size, DIRENTSPERBLOCK);
963 963
964 if (disk_read(cursect, read_blk, dir_ptr) < 0) { 964 if (disk_read(cursect, read_blk, dir_ptr) < 0) {
965 debug("Error: reading rootdir block\n"); 965 debug("Error: reading rootdir block\n");
966 goto exit; 966 goto exit;
967 } 967 }
968 968
969 dentptr = (dir_entry *)dir_ptr; 969 dentptr = (dir_entry *)dir_ptr;
970 } 970 }
971 971
972 for (i = 0; i < DIRENTSPERBLOCK; i++) { 972 for (i = 0; i < DIRENTSPERBLOCK; i++) {
973 char s_name[14], l_name[VFAT_MAXLEN_BYTES]; 973 char s_name[14], l_name[VFAT_MAXLEN_BYTES];
974 __u8 csum; 974 __u8 csum;
975 975
976 l_name[0] = '\0'; 976 l_name[0] = '\0';
977 if (dentptr->name[0] == DELETED_FLAG) { 977 if (dentptr->name[0] == DELETED_FLAG) {
978 dentptr++; 978 dentptr++;
979 continue; 979 continue;
980 } 980 }
981 981
982 if (vfat_enabled) 982 if (vfat_enabled)
983 csum = mkcksum(dentptr->name, dentptr->ext); 983 csum = mkcksum(dentptr->name, dentptr->ext);
984 984
985 if (dentptr->attr & ATTR_VOLUME) { 985 if (dentptr->attr & ATTR_VOLUME) {
986 if (vfat_enabled && 986 if (vfat_enabled &&
987 (dentptr->attr & ATTR_VFAT) == ATTR_VFAT && 987 (dentptr->attr & ATTR_VFAT) == ATTR_VFAT &&
988 (dentptr->name[0] & LAST_LONG_ENTRY_MASK)) { 988 (dentptr->name[0] & LAST_LONG_ENTRY_MASK)) {
989 prevcksum = 989 prevcksum =
990 ((dir_slot *)dentptr)->alias_checksum; 990 ((dir_slot *)dentptr)->alias_checksum;
991 991
992 get_vfatname(mydata, 992 get_vfatname(mydata,
993 root_cluster, 993 root_cluster,
994 dir_ptr, 994 dir_ptr,
995 dentptr, l_name); 995 dentptr, l_name);
996 996
997 if (dols == LS_ROOT) { 997 if (dols == LS_ROOT) {
998 char dirc; 998 char dirc;
999 int doit = 0; 999 int doit = 0;
1000 int isdir = 1000 int isdir =
1001 (dentptr->attr & ATTR_DIR); 1001 (dentptr->attr & ATTR_DIR);
1002 1002
1003 if (isdir) { 1003 if (isdir) {
1004 dirs++; 1004 dirs++;
1005 dirc = '/'; 1005 dirc = '/';
1006 doit = 1; 1006 doit = 1;
1007 } else { 1007 } else {
1008 dirc = ' '; 1008 dirc = ' ';
1009 if (l_name[0] != 0) { 1009 if (l_name[0] != 0) {
1010 files++; 1010 files++;
1011 doit = 1; 1011 doit = 1;
1012 } 1012 }
1013 } 1013 }
1014 if (doit) { 1014 if (doit) {
1015 if (dirc == ' ') { 1015 if (dirc == ' ') {
1016 printf(" %8u %s%c\n", 1016 printf(" %8u %s%c\n",
1017 FAT2CPU32(dentptr->size), 1017 FAT2CPU32(dentptr->size),
1018 l_name, 1018 l_name,
1019 dirc); 1019 dirc);
1020 } else { 1020 } else {
1021 printf(" %s%c\n", 1021 printf(" %s%c\n",
1022 l_name, 1022 l_name,
1023 dirc); 1023 dirc);
1024 } 1024 }
1025 } 1025 }
1026 dentptr++; 1026 dentptr++;
1027 continue; 1027 continue;
1028 } 1028 }
1029 debug("Rootvfatname: |%s|\n", 1029 debug("Rootvfatname: |%s|\n",
1030 l_name); 1030 l_name);
1031 } else { 1031 } else {
1032 /* Volume label or VFAT entry */ 1032 /* Volume label or VFAT entry */
1033 dentptr++; 1033 dentptr++;
1034 continue; 1034 continue;
1035 } 1035 }
1036 } else if (dentptr->name[0] == 0) { 1036 } else if (dentptr->name[0] == 0) {
1037 debug("RootDentname == NULL - %d\n", i); 1037 debug("RootDentname == NULL - %d\n", i);
1038 if (dols == LS_ROOT) { 1038 if (dols == LS_ROOT) {
1039 printf("\n%d file(s), %d dir(s)\n\n", 1039 printf("\n%d file(s), %d dir(s)\n\n",
1040 files, dirs); 1040 files, dirs);
1041 ret = 0; 1041 ret = 0;
1042 } 1042 }
1043 goto exit; 1043 goto exit;
1044 } 1044 }
1045 else if (vfat_enabled && 1045 else if (vfat_enabled &&
1046 dols == LS_ROOT && csum == prevcksum) { 1046 dols == LS_ROOT && csum == prevcksum) {
1047 prevcksum = 0xffff; 1047 prevcksum = 0xffff;
1048 dentptr++; 1048 dentptr++;
1049 continue; 1049 continue;
1050 } 1050 }
1051 1051
1052 get_name(dentptr, s_name); 1052 get_name(dentptr, s_name);
1053 1053
1054 if (dols == LS_ROOT) { 1054 if (dols == LS_ROOT) {
1055 int isdir = (dentptr->attr & ATTR_DIR); 1055 int isdir = (dentptr->attr & ATTR_DIR);
1056 char dirc; 1056 char dirc;
1057 int doit = 0; 1057 int doit = 0;
1058 1058
1059 if (isdir) { 1059 if (isdir) {
1060 dirc = '/'; 1060 dirc = '/';
1061 if (s_name[0] != 0) { 1061 if (s_name[0] != 0) {
1062 dirs++; 1062 dirs++;
1063 doit = 1; 1063 doit = 1;
1064 } 1064 }
1065 } else { 1065 } else {
1066 dirc = ' '; 1066 dirc = ' ';
1067 if (s_name[0] != 0) { 1067 if (s_name[0] != 0) {
1068 files++; 1068 files++;
1069 doit = 1; 1069 doit = 1;
1070 } 1070 }
1071 } 1071 }
1072 if (doit) { 1072 if (doit) {
1073 if (dirc == ' ') { 1073 if (dirc == ' ') {
1074 printf(" %8u %s%c\n", 1074 printf(" %8u %s%c\n",
1075 FAT2CPU32(dentptr->size), 1075 FAT2CPU32(dentptr->size),
1076 s_name, dirc); 1076 s_name, dirc);
1077 } else { 1077 } else {
1078 printf(" %s%c\n", 1078 printf(" %s%c\n",
1079 s_name, dirc); 1079 s_name, dirc);
1080 } 1080 }
1081 } 1081 }
1082 dentptr++; 1082 dentptr++;
1083 continue; 1083 continue;
1084 } 1084 }
1085 1085
1086 if (strcmp(fnamecopy, s_name) 1086 if (strcmp(fnamecopy, s_name)
1087 && strcmp(fnamecopy, l_name)) { 1087 && strcmp(fnamecopy, l_name)) {
1088 debug("RootMismatch: |%s|%s|\n", s_name, 1088 debug("RootMismatch: |%s|%s|\n", s_name,
1089 l_name); 1089 l_name);
1090 dentptr++; 1090 dentptr++;
1091 continue; 1091 continue;
1092 } 1092 }
1093 1093
1094 if (isdir && !(dentptr->attr & ATTR_DIR)) 1094 if (isdir && !(dentptr->attr & ATTR_DIR))
1095 goto exit; 1095 goto exit;
1096 1096
1097 debug("RootName: %s", s_name); 1097 debug("RootName: %s", s_name);
1098 debug(", start: 0x%x", START(dentptr)); 1098 debug(", start: 0x%x", START(dentptr));
1099 debug(", size: 0x%x %s\n", 1099 debug(", size: 0x%x %s\n",
1100 FAT2CPU32(dentptr->size), 1100 FAT2CPU32(dentptr->size),
1101 isdir ? "(DIR)" : ""); 1101 isdir ? "(DIR)" : "");
1102 1102
1103 goto rootdir_done; /* We got a match */ 1103 goto rootdir_done; /* We got a match */
1104 } 1104 }
1105 debug("END LOOP: buffer_blk_cnt=%d clust_size=%d\n", buffer_blk_cnt, 1105 debug("END LOOP: buffer_blk_cnt=%d clust_size=%d\n", buffer_blk_cnt,
1106 mydata->clust_size); 1106 mydata->clust_size);
1107 1107
1108 /* 1108 /*
1109 * On FAT32 we must fetch the FAT entries for the next 1109 * On FAT32 we must fetch the FAT entries for the next
1110 * root directory clusters when a cluster has been 1110 * root directory clusters when a cluster has been
1111 * completely processed. 1111 * completely processed.
1112 */ 1112 */
1113 ++buffer_blk_cnt; 1113 ++buffer_blk_cnt;
1114 int rootdir_end = 0; 1114 int rootdir_end = 0;
1115 if (mydata->fatsize == 32) { 1115 if (mydata->fatsize == 32) {
1116 if (buffer_blk_cnt == mydata->clust_size) { 1116 if (buffer_blk_cnt == mydata->clust_size) {
1117 int nxtsect = 0; 1117 int nxtsect = 0;
1118 int nxt_clust = 0; 1118 int nxt_clust = 0;
1119 1119
1120 nxt_clust = get_fatent(mydata, root_cluster); 1120 nxt_clust = get_fatent(mydata, root_cluster);
1121 rootdir_end = CHECK_CLUST(nxt_clust, 32); 1121 rootdir_end = CHECK_CLUST(nxt_clust, 32);
1122 1122
1123 nxtsect = mydata->data_begin + 1123 nxtsect = mydata->data_begin +
1124 (nxt_clust * mydata->clust_size); 1124 (nxt_clust * mydata->clust_size);
1125 1125
1126 root_cluster = nxt_clust; 1126 root_cluster = nxt_clust;
1127 1127
1128 cursect = nxtsect; 1128 cursect = nxtsect;
1129 buffer_blk_cnt = 0; 1129 buffer_blk_cnt = 0;
1130 } 1130 }
1131 } else { 1131 } else {
1132 if (buffer_blk_cnt == PREFETCH_BLOCKS) 1132 if (buffer_blk_cnt == PREFETCH_BLOCKS)
1133 buffer_blk_cnt = 0; 1133 buffer_blk_cnt = 0;
1134 1134
1135 rootdir_end = (++cursect - mydata->rootdir_sect >= 1135 rootdir_end = (++cursect - mydata->rootdir_sect >=
1136 rootdir_size); 1136 rootdir_size);
1137 } 1137 }
1138 1138
1139 /* If end of rootdir reached */ 1139 /* If end of rootdir reached */
1140 if (rootdir_end) { 1140 if (rootdir_end) {
1141 if (dols == LS_ROOT) { 1141 if (dols == LS_ROOT) {
1142 printf("\n%d file(s), %d dir(s)\n\n", 1142 printf("\n%d file(s), %d dir(s)\n\n",
1143 files, dirs); 1143 files, dirs);
1144 *size = 0; 1144 *size = 0;
1145 } 1145 }
1146 goto exit; 1146 goto exit;
1147 } 1147 }
1148 } 1148 }
1149 rootdir_done: 1149 rootdir_done:
1150 1150
1151 firsttime = 1; 1151 firsttime = 1;
1152 1152
1153 while (isdir) { 1153 while (isdir) {
1154 int startsect = mydata->data_begin 1154 int startsect = mydata->data_begin
1155 + START(dentptr) * mydata->clust_size; 1155 + START(dentptr) * mydata->clust_size;
1156 dir_entry dent; 1156 dir_entry dent;
1157 char *nextname = NULL; 1157 char *nextname = NULL;
1158 1158
1159 dent = *dentptr; 1159 dent = *dentptr;
1160 dentptr = &dent; 1160 dentptr = &dent;
1161 1161
1162 idx = dirdelim(subname); 1162 idx = dirdelim(subname);
1163 1163
1164 if (idx >= 0) { 1164 if (idx >= 0) {
1165 subname[idx] = '\0'; 1165 subname[idx] = '\0';
1166 nextname = subname + idx + 1; 1166 nextname = subname + idx + 1;
1167 /* Handle multiple delimiters */ 1167 /* Handle multiple delimiters */
1168 while (ISDIRDELIM(*nextname)) 1168 while (ISDIRDELIM(*nextname))
1169 nextname++; 1169 nextname++;
1170 if (dols && *nextname == '\0') 1170 if (dols && *nextname == '\0')
1171 firsttime = 0; 1171 firsttime = 0;
1172 } else { 1172 } else {
1173 if (dols && firsttime) { 1173 if (dols && firsttime) {
1174 firsttime = 0; 1174 firsttime = 0;
1175 } else { 1175 } else {
1176 isdir = 0; 1176 isdir = 0;
1177 } 1177 }
1178 } 1178 }
1179 1179
1180 if (get_dentfromdir(mydata, startsect, subname, dentptr, 1180 if (get_dentfromdir(mydata, startsect, subname, dentptr,
1181 isdir ? 0 : dols) == NULL) { 1181 isdir ? 0 : dols) == NULL) {
1182 if (dols && !isdir) 1182 if (dols && !isdir)
1183 *size = 0; 1183 *size = 0;
1184 goto exit; 1184 goto exit;
1185 } 1185 }
1186 1186
1187 if (isdir && !(dentptr->attr & ATTR_DIR)) 1187 if (isdir && !(dentptr->attr & ATTR_DIR))
1188 goto exit; 1188 goto exit;
1189 1189
1190 /* 1190 /*
1191 * If we are looking for a directory, and found a directory 1191 * If we are looking for a directory, and found a directory
1192 * type entry, and the entry is for the root directory (as 1192 * type entry, and the entry is for the root directory (as
1193 * denoted by a cluster number of 0), jump back to the start 1193 * denoted by a cluster number of 0), jump back to the start
1194 * of the function, since at least on FAT12/16, the root dir 1194 * of the function, since at least on FAT12/16, the root dir
1195 * lives in a hard-coded location and needs special handling 1195 * lives in a hard-coded location and needs special handling
1196 * to parse, rather than simply following the cluster linked 1196 * to parse, rather than simply following the cluster linked
1197 * list in the FAT, like other directories. 1197 * list in the FAT, like other directories.
1198 */ 1198 */
1199 if (isdir && (dentptr->attr & ATTR_DIR) && !START(dentptr)) { 1199 if (isdir && (dentptr->attr & ATTR_DIR) && !START(dentptr)) {
1200 /* 1200 /*
1201 * Modify the filename to remove the prefix that gets 1201 * Modify the filename to remove the prefix that gets
1202 * back to the root directory, so the initial root dir 1202 * back to the root directory, so the initial root dir
1203 * parsing code can continue from where we are without 1203 * parsing code can continue from where we are without
1204 * confusion. 1204 * confusion.
1205 */ 1205 */
1206 strcpy(fnamecopy, nextname ?: ""); 1206 strcpy(fnamecopy, nextname ?: "");
1207 /* 1207 /*
1208 * Set up state the same way as the function does when 1208 * Set up state the same way as the function does when
1209 * first started. This is required for the root dir 1209 * first started. This is required for the root dir
1210 * parsing code operates in its expected environment. 1210 * parsing code operates in its expected environment.
1211 */ 1211 */
1212 subname = ""; 1212 subname = "";
1213 cursect = mydata->rootdir_sect; 1213 cursect = mydata->rootdir_sect;
1214 isdir = 0; 1214 isdir = 0;
1215 goto root_reparse; 1215 goto root_reparse;
1216 } 1216 }
1217 1217
1218 if (idx >= 0) 1218 if (idx >= 0)
1219 subname = nextname; 1219 subname = nextname;
1220 } 1220 }
1221 1221
1222 if (dogetsize) { 1222 if (dogetsize) {
1223 *size = FAT2CPU32(dentptr->size); 1223 *size = FAT2CPU32(dentptr->size);
1224 ret = 0; 1224 ret = 0;
1225 } else { 1225 } else {
1226 ret = get_contents(mydata, dentptr, pos, buffer, maxsize, size); 1226 ret = get_contents(mydata, dentptr, pos, buffer, maxsize, size);
1227 } 1227 }
1228 debug("Size: %u, got: %llu\n", FAT2CPU32(dentptr->size), *size); 1228 debug("Size: %u, got: %llu\n", FAT2CPU32(dentptr->size), *size);
1229 1229
1230 exit: 1230 exit:
1231 free(mydata->fatbuf); 1231 free(mydata->fatbuf);
1232 return ret; 1232 return ret;
1233 } 1233 }
1234 1234
1235 int do_fat_read(const char *filename, void *buffer, loff_t maxsize, int dols, 1235 int do_fat_read(const char *filename, void *buffer, loff_t maxsize, int dols,
1236 loff_t *actread) 1236 loff_t *actread)
1237 { 1237 {
1238 return do_fat_read_at(filename, 0, buffer, maxsize, dols, 0, actread); 1238 return do_fat_read_at(filename, 0, buffer, maxsize, dols, 0, actread);
1239 } 1239 }
1240 1240
1241 int file_fat_detectfs(void) 1241 int file_fat_detectfs(void)
1242 { 1242 {
1243 boot_sector bs; 1243 boot_sector bs;
1244 volume_info volinfo; 1244 volume_info volinfo;
1245 int fatsize; 1245 int fatsize;
1246 char vol_label[12]; 1246 char vol_label[12];
1247 1247
1248 if (cur_dev == NULL) { 1248 if (cur_dev == NULL) {
1249 printf("No current device\n"); 1249 printf("No current device\n");
1250 return 1; 1250 return 1;
1251 } 1251 }
1252 1252
1253 #if defined(CONFIG_CMD_IDE) || \ 1253 #if defined(CONFIG_IDE) || \
1254 defined(CONFIG_CMD_SATA) || \ 1254 defined(CONFIG_CMD_SATA) || \
1255 defined(CONFIG_SCSI) || \ 1255 defined(CONFIG_SCSI) || \
1256 defined(CONFIG_CMD_USB) || \ 1256 defined(CONFIG_CMD_USB) || \
1257 defined(CONFIG_MMC) 1257 defined(CONFIG_MMC)
1258 printf("Interface: "); 1258 printf("Interface: ");
1259 switch (cur_dev->if_type) { 1259 switch (cur_dev->if_type) {
1260 case IF_TYPE_IDE: 1260 case IF_TYPE_IDE:
1261 printf("IDE"); 1261 printf("IDE");
1262 break; 1262 break;
1263 case IF_TYPE_SATA: 1263 case IF_TYPE_SATA:
1264 printf("SATA"); 1264 printf("SATA");
1265 break; 1265 break;
1266 case IF_TYPE_SCSI: 1266 case IF_TYPE_SCSI:
1267 printf("SCSI"); 1267 printf("SCSI");
1268 break; 1268 break;
1269 case IF_TYPE_ATAPI: 1269 case IF_TYPE_ATAPI:
1270 printf("ATAPI"); 1270 printf("ATAPI");
1271 break; 1271 break;
1272 case IF_TYPE_USB: 1272 case IF_TYPE_USB:
1273 printf("USB"); 1273 printf("USB");
1274 break; 1274 break;
1275 case IF_TYPE_DOC: 1275 case IF_TYPE_DOC:
1276 printf("DOC"); 1276 printf("DOC");
1277 break; 1277 break;
1278 case IF_TYPE_MMC: 1278 case IF_TYPE_MMC:
1279 printf("MMC"); 1279 printf("MMC");
1280 break; 1280 break;
1281 default: 1281 default:
1282 printf("Unknown"); 1282 printf("Unknown");
1283 } 1283 }
1284 1284
1285 printf("\n Device %d: ", cur_dev->devnum); 1285 printf("\n Device %d: ", cur_dev->devnum);
1286 dev_print(cur_dev); 1286 dev_print(cur_dev);
1287 #endif 1287 #endif
1288 1288
1289 if (read_bootsectandvi(&bs, &volinfo, &fatsize)) { 1289 if (read_bootsectandvi(&bs, &volinfo, &fatsize)) {
1290 printf("\nNo valid FAT fs found\n"); 1290 printf("\nNo valid FAT fs found\n");
1291 return 1; 1291 return 1;
1292 } 1292 }
1293 1293
1294 memcpy(vol_label, volinfo.volume_label, 11); 1294 memcpy(vol_label, volinfo.volume_label, 11);
1295 vol_label[11] = '\0'; 1295 vol_label[11] = '\0';
1296 volinfo.fs_type[5] = '\0'; 1296 volinfo.fs_type[5] = '\0';
1297 1297
1298 printf("Filesystem: %s \"%s\"\n", volinfo.fs_type, vol_label); 1298 printf("Filesystem: %s \"%s\"\n", volinfo.fs_type, vol_label);
1299 1299
1300 return 0; 1300 return 0;
1301 } 1301 }
1302 1302
1303 int file_fat_ls(const char *dir) 1303 int file_fat_ls(const char *dir)
1304 { 1304 {
1305 loff_t size; 1305 loff_t size;
1306 1306
1307 return do_fat_read(dir, NULL, 0, LS_YES, &size); 1307 return do_fat_read(dir, NULL, 0, LS_YES, &size);
1308 } 1308 }
1309 1309
1310 int fat_exists(const char *filename) 1310 int fat_exists(const char *filename)
1311 { 1311 {
1312 int ret; 1312 int ret;
1313 loff_t size; 1313 loff_t size;
1314 1314
1315 ret = do_fat_read_at(filename, 0, NULL, 0, LS_NO, 1, &size); 1315 ret = do_fat_read_at(filename, 0, NULL, 0, LS_NO, 1, &size);
1316 return ret == 0; 1316 return ret == 0;
1317 } 1317 }
1318 1318
1319 int fat_size(const char *filename, loff_t *size) 1319 int fat_size(const char *filename, loff_t *size)
1320 { 1320 {
1321 return do_fat_read_at(filename, 0, NULL, 0, LS_NO, 1, size); 1321 return do_fat_read_at(filename, 0, NULL, 0, LS_NO, 1, size);
1322 } 1322 }
1323 1323
1324 int file_fat_read_at(const char *filename, loff_t pos, void *buffer, 1324 int file_fat_read_at(const char *filename, loff_t pos, void *buffer,
1325 loff_t maxsize, loff_t *actread) 1325 loff_t maxsize, loff_t *actread)
1326 { 1326 {
1327 printf("reading %s\n", filename); 1327 printf("reading %s\n", filename);
1328 return do_fat_read_at(filename, pos, buffer, maxsize, LS_NO, 0, 1328 return do_fat_read_at(filename, pos, buffer, maxsize, LS_NO, 0,
1329 actread); 1329 actread);
1330 } 1330 }
1331 1331
1332 int file_fat_read(const char *filename, void *buffer, int maxsize) 1332 int file_fat_read(const char *filename, void *buffer, int maxsize)
1333 { 1333 {
1334 loff_t actread; 1334 loff_t actread;
1335 int ret; 1335 int ret;
1336 1336
1337 ret = file_fat_read_at(filename, 0, buffer, maxsize, &actread); 1337 ret = file_fat_read_at(filename, 0, buffer, maxsize, &actread);
1338 if (ret) 1338 if (ret)
1339 return ret; 1339 return ret;
1340 else 1340 else
1341 return actread; 1341 return actread;
1342 } 1342 }
1343 1343
1344 int fat_read_file(const char *filename, void *buf, loff_t offset, loff_t len, 1344 int fat_read_file(const char *filename, void *buf, loff_t offset, loff_t len,
1345 loff_t *actread) 1345 loff_t *actread)
1346 { 1346 {
1347 int ret; 1347 int ret;
1348 1348
1349 ret = file_fat_read_at(filename, offset, buf, len, actread); 1349 ret = file_fat_read_at(filename, offset, buf, len, actread);
1350 if (ret) 1350 if (ret)
1351 printf("** Unable to read file %s **\n", filename); 1351 printf("** Unable to read file %s **\n", filename);
1352 1352
1353 return ret; 1353 return ret;
1354 } 1354 }
1355 1355
1356 void fat_close(void) 1356 void fat_close(void)
1357 { 1357 {
1358 } 1358 }
1359 1359
include/config_distro_bootcmd.h
1 /* 1 /*
2 * (C) Copyright 2014 2 * (C) Copyright 2014
3 * NVIDIA Corporation <www.nvidia.com> 3 * NVIDIA Corporation <www.nvidia.com>
4 * 4 *
5 * Copyright 2014 Red Hat, Inc. 5 * Copyright 2014 Red Hat, Inc.
6 * 6 *
7 * SPDX-License-Identifier: GPL-2.0+ 7 * SPDX-License-Identifier: GPL-2.0+
8 */ 8 */
9 9
10 #ifndef _CONFIG_CMD_DISTRO_BOOTCMD_H 10 #ifndef _CONFIG_CMD_DISTRO_BOOTCMD_H
11 #define _CONFIG_CMD_DISTRO_BOOTCMD_H 11 #define _CONFIG_CMD_DISTRO_BOOTCMD_H
12 12
13 /* 13 /*
14 * A note on error handling: It is possible for BOOT_TARGET_DEVICES to 14 * A note on error handling: It is possible for BOOT_TARGET_DEVICES to
15 * reference a device that is not enabled in the U-Boot configuration, e.g. 15 * reference a device that is not enabled in the U-Boot configuration, e.g.
16 * it may include MMC in the list without CONFIG_CMD_MMC being enabled. Given 16 * it may include MMC in the list without CONFIG_CMD_MMC being enabled. Given
17 * that BOOT_TARGET_DEVICES is a macro that's expanded by the C pre-processor 17 * that BOOT_TARGET_DEVICES is a macro that's expanded by the C pre-processor
18 * at compile time, it's not possible to detect and report such problems via 18 * at compile time, it's not possible to detect and report such problems via
19 * a simple #ifdef/#error combination. Still, the code needs to report errors. 19 * a simple #ifdef/#error combination. Still, the code needs to report errors.
20 * The best way I've found to do this is to make BOOT_TARGET_DEVICES expand to 20 * The best way I've found to do this is to make BOOT_TARGET_DEVICES expand to
21 * reference a non-existent symbol, and have the name of that symbol encode 21 * reference a non-existent symbol, and have the name of that symbol encode
22 * the error message. Consequently, this file contains references to e.g. 22 * the error message. Consequently, this file contains references to e.g.
23 * BOOT_TARGET_DEVICES_references_MMC_without_CONFIG_CMD_MMC. Given the 23 * BOOT_TARGET_DEVICES_references_MMC_without_CONFIG_CMD_MMC. Given the
24 * prevalence of capitals here, this looks like a pre-processor macro and 24 * prevalence of capitals here, this looks like a pre-processor macro and
25 * hence seems like it should be all capitals, but it's really an error 25 * hence seems like it should be all capitals, but it's really an error
26 * message that includes some other pre-processor symbols in the text. 26 * message that includes some other pre-processor symbols in the text.
27 */ 27 */
28 28
29 #define BOOTENV_SHARED_BLKDEV_BODY(devtypel) \ 29 #define BOOTENV_SHARED_BLKDEV_BODY(devtypel) \
30 "if " #devtypel " dev ${devnum}; then " \ 30 "if " #devtypel " dev ${devnum}; then " \
31 "setenv devtype " #devtypel "; " \ 31 "setenv devtype " #devtypel "; " \
32 "run scan_dev_for_boot_part; " \ 32 "run scan_dev_for_boot_part; " \
33 "fi\0" 33 "fi\0"
34 34
35 #define BOOTENV_SHARED_BLKDEV(devtypel) \ 35 #define BOOTENV_SHARED_BLKDEV(devtypel) \
36 #devtypel "_boot=" \ 36 #devtypel "_boot=" \
37 BOOTENV_SHARED_BLKDEV_BODY(devtypel) 37 BOOTENV_SHARED_BLKDEV_BODY(devtypel)
38 38
39 #define BOOTENV_DEV_BLKDEV(devtypeu, devtypel, instance) \ 39 #define BOOTENV_DEV_BLKDEV(devtypeu, devtypel, instance) \
40 "bootcmd_" #devtypel #instance "=" \ 40 "bootcmd_" #devtypel #instance "=" \
41 "setenv devnum " #instance "; " \ 41 "setenv devnum " #instance "; " \
42 "run " #devtypel "_boot\0" 42 "run " #devtypel "_boot\0"
43 43
44 #define BOOTENV_DEV_NAME_BLKDEV(devtypeu, devtypel, instance) \ 44 #define BOOTENV_DEV_NAME_BLKDEV(devtypeu, devtypel, instance) \
45 #devtypel #instance " " 45 #devtypel #instance " "
46 46
47 #ifdef CONFIG_SANDBOX 47 #ifdef CONFIG_SANDBOX
48 #define BOOTENV_SHARED_HOST BOOTENV_SHARED_BLKDEV(host) 48 #define BOOTENV_SHARED_HOST BOOTENV_SHARED_BLKDEV(host)
49 #define BOOTENV_DEV_HOST BOOTENV_DEV_BLKDEV 49 #define BOOTENV_DEV_HOST BOOTENV_DEV_BLKDEV
50 #define BOOTENV_DEV_NAME_HOST BOOTENV_DEV_NAME_BLKDEV 50 #define BOOTENV_DEV_NAME_HOST BOOTENV_DEV_NAME_BLKDEV
51 #else 51 #else
52 #define BOOTENV_SHARED_HOST 52 #define BOOTENV_SHARED_HOST
53 #define BOOTENV_DEV_HOST \ 53 #define BOOTENV_DEV_HOST \
54 BOOT_TARGET_DEVICES_references_HOST_without_CONFIG_SANDBOX 54 BOOT_TARGET_DEVICES_references_HOST_without_CONFIG_SANDBOX
55 #define BOOTENV_DEV_NAME_HOST \ 55 #define BOOTENV_DEV_NAME_HOST \
56 BOOT_TARGET_DEVICES_references_HOST_without_CONFIG_SANDBOX 56 BOOT_TARGET_DEVICES_references_HOST_without_CONFIG_SANDBOX
57 #endif 57 #endif
58 58
59 #ifdef CONFIG_CMD_MMC 59 #ifdef CONFIG_CMD_MMC
60 #define BOOTENV_SHARED_MMC BOOTENV_SHARED_BLKDEV(mmc) 60 #define BOOTENV_SHARED_MMC BOOTENV_SHARED_BLKDEV(mmc)
61 #define BOOTENV_DEV_MMC BOOTENV_DEV_BLKDEV 61 #define BOOTENV_DEV_MMC BOOTENV_DEV_BLKDEV
62 #define BOOTENV_DEV_NAME_MMC BOOTENV_DEV_NAME_BLKDEV 62 #define BOOTENV_DEV_NAME_MMC BOOTENV_DEV_NAME_BLKDEV
63 #else 63 #else
64 #define BOOTENV_SHARED_MMC 64 #define BOOTENV_SHARED_MMC
65 #define BOOTENV_DEV_MMC \ 65 #define BOOTENV_DEV_MMC \
66 BOOT_TARGET_DEVICES_references_MMC_without_CONFIG_CMD_MMC 66 BOOT_TARGET_DEVICES_references_MMC_without_CONFIG_CMD_MMC
67 #define BOOTENV_DEV_NAME_MMC \ 67 #define BOOTENV_DEV_NAME_MMC \
68 BOOT_TARGET_DEVICES_references_MMC_without_CONFIG_CMD_MMC 68 BOOT_TARGET_DEVICES_references_MMC_without_CONFIG_CMD_MMC
69 #endif 69 #endif
70 70
71 #ifdef CONFIG_CMD_UBIFS 71 #ifdef CONFIG_CMD_UBIFS
72 #define BOOTENV_SHARED_UBIFS \ 72 #define BOOTENV_SHARED_UBIFS \
73 "ubifs_boot=" \ 73 "ubifs_boot=" \
74 "if ubi part UBI && ubifsmount ubi${devnum}:boot; then " \ 74 "if ubi part UBI && ubifsmount ubi${devnum}:boot; then " \
75 "setenv devtype ubi; " \ 75 "setenv devtype ubi; " \
76 "setenv bootpart 0; " \ 76 "setenv bootpart 0; " \
77 "run scan_dev_for_boot; " \ 77 "run scan_dev_for_boot; " \
78 "fi\0" 78 "fi\0"
79 #define BOOTENV_DEV_UBIFS BOOTENV_DEV_BLKDEV 79 #define BOOTENV_DEV_UBIFS BOOTENV_DEV_BLKDEV
80 #define BOOTENV_DEV_NAME_UBIFS BOOTENV_DEV_NAME_BLKDEV 80 #define BOOTENV_DEV_NAME_UBIFS BOOTENV_DEV_NAME_BLKDEV
81 #else 81 #else
82 #define BOOTENV_SHARED_UBIFS 82 #define BOOTENV_SHARED_UBIFS
83 #define BOOTENV_DEV_UBIFS \ 83 #define BOOTENV_DEV_UBIFS \
84 BOOT_TARGET_DEVICES_references_UBIFS_without_CONFIG_CMD_UBIFS 84 BOOT_TARGET_DEVICES_references_UBIFS_without_CONFIG_CMD_UBIFS
85 #define BOOTENV_DEV_NAME_UBIFS \ 85 #define BOOTENV_DEV_NAME_UBIFS \
86 BOOT_TARGET_DEVICES_references_UBIFS_without_CONFIG_CMD_UBIFS 86 BOOT_TARGET_DEVICES_references_UBIFS_without_CONFIG_CMD_UBIFS
87 #endif 87 #endif
88 88
89 #ifdef CONFIG_EFI_LOADER 89 #ifdef CONFIG_EFI_LOADER
90 #if defined(CONFIG_ARM64) 90 #if defined(CONFIG_ARM64)
91 #define BOOTEFI_NAME "bootaa64.efi" 91 #define BOOTEFI_NAME "bootaa64.efi"
92 #elif defined(CONFIG_ARM) 92 #elif defined(CONFIG_ARM)
93 #define BOOTEFI_NAME "bootarm.efi" 93 #define BOOTEFI_NAME "bootarm.efi"
94 #endif 94 #endif
95 #endif 95 #endif
96 96
97 #ifdef BOOTEFI_NAME 97 #ifdef BOOTEFI_NAME
98 #if defined(CONFIG_ARM) && !defined(CONFIG_ARM64) 98 #if defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
99 /* 99 /*
100 * On 32bit ARM systems there is a reasonable number of systems that follow 100 * On 32bit ARM systems there is a reasonable number of systems that follow
101 * the $soc-$board$boardver.dtb name scheme for their device trees. Use that 101 * the $soc-$board$boardver.dtb name scheme for their device trees. Use that
102 * scheme if we don't have an explicit fdtfile variable. 102 * scheme if we don't have an explicit fdtfile variable.
103 */ 103 */
104 #define BOOTENV_EFI_SET_FDTFILE_FALLBACK \ 104 #define BOOTENV_EFI_SET_FDTFILE_FALLBACK \
105 "if test -z \"${fdtfile}\" -a -n \"${soc}\"; then " \ 105 "if test -z \"${fdtfile}\" -a -n \"${soc}\"; then " \
106 "setenv efi_fdtfile ${soc}-${board}${boardver}.dtb; " \ 106 "setenv efi_fdtfile ${soc}-${board}${boardver}.dtb; " \
107 "fi; " 107 "fi; "
108 #else 108 #else
109 #define BOOTENV_EFI_SET_FDTFILE_FALLBACK 109 #define BOOTENV_EFI_SET_FDTFILE_FALLBACK
110 #endif 110 #endif
111 111
112 112
113 #define BOOTENV_SHARED_EFI \ 113 #define BOOTENV_SHARED_EFI \
114 "boot_efi_binary=" \ 114 "boot_efi_binary=" \
115 "load ${devtype} ${devnum}:${distro_bootpart} " \ 115 "load ${devtype} ${devnum}:${distro_bootpart} " \
116 "${kernel_addr_r} efi/boot/"BOOTEFI_NAME"; " \ 116 "${kernel_addr_r} efi/boot/"BOOTEFI_NAME"; " \
117 "if fdt addr ${fdt_addr_r}; then " \ 117 "if fdt addr ${fdt_addr_r}; then " \
118 "bootefi ${kernel_addr_r} ${fdt_addr_r};" \ 118 "bootefi ${kernel_addr_r} ${fdt_addr_r};" \
119 "else " \ 119 "else " \
120 "bootefi ${kernel_addr_r} ${fdtcontroladdr};" \ 120 "bootefi ${kernel_addr_r} ${fdtcontroladdr};" \
121 "fi\0" \ 121 "fi\0" \
122 \ 122 \
123 "load_efi_dtb=" \ 123 "load_efi_dtb=" \
124 "load ${devtype} ${devnum}:${distro_bootpart} " \ 124 "load ${devtype} ${devnum}:${distro_bootpart} " \
125 "${fdt_addr_r} ${prefix}${efi_fdtfile}\0" \ 125 "${fdt_addr_r} ${prefix}${efi_fdtfile}\0" \
126 \ 126 \
127 "efi_dtb_prefixes=/ /dtb/ /dtb/current/\0" \ 127 "efi_dtb_prefixes=/ /dtb/ /dtb/current/\0" \
128 "scan_dev_for_efi=" \ 128 "scan_dev_for_efi=" \
129 "setenv efi_fdtfile ${fdtfile}; " \ 129 "setenv efi_fdtfile ${fdtfile}; " \
130 BOOTENV_EFI_SET_FDTFILE_FALLBACK \ 130 BOOTENV_EFI_SET_FDTFILE_FALLBACK \
131 "for prefix in ${efi_dtb_prefixes}; do " \ 131 "for prefix in ${efi_dtb_prefixes}; do " \
132 "if test -e ${devtype} " \ 132 "if test -e ${devtype} " \
133 "${devnum}:${distro_bootpart} " \ 133 "${devnum}:${distro_bootpart} " \
134 "${prefix}${efi_fdtfile}; then " \ 134 "${prefix}${efi_fdtfile}; then " \
135 "run load_efi_dtb; " \ 135 "run load_efi_dtb; " \
136 "fi;" \ 136 "fi;" \
137 "done;" \ 137 "done;" \
138 "if test -e ${devtype} ${devnum}:${distro_bootpart} " \ 138 "if test -e ${devtype} ${devnum}:${distro_bootpart} " \
139 "efi/boot/"BOOTEFI_NAME"; then " \ 139 "efi/boot/"BOOTEFI_NAME"; then " \
140 "echo Found EFI removable media binary " \ 140 "echo Found EFI removable media binary " \
141 "efi/boot/"BOOTEFI_NAME"; " \ 141 "efi/boot/"BOOTEFI_NAME"; " \
142 "run boot_efi_binary; " \ 142 "run boot_efi_binary; " \
143 "echo EFI LOAD FAILED: continuing...; " \ 143 "echo EFI LOAD FAILED: continuing...; " \
144 "fi; " \ 144 "fi; " \
145 "setenv efi_fdtfile\0" 145 "setenv efi_fdtfile\0"
146 #define SCAN_DEV_FOR_EFI "run scan_dev_for_efi;" 146 #define SCAN_DEV_FOR_EFI "run scan_dev_for_efi;"
147 #else 147 #else
148 #define BOOTENV_SHARED_EFI 148 #define BOOTENV_SHARED_EFI
149 #define SCAN_DEV_FOR_EFI 149 #define SCAN_DEV_FOR_EFI
150 #endif 150 #endif
151 151
152 #ifdef CONFIG_CMD_SATA 152 #ifdef CONFIG_CMD_SATA
153 #define BOOTENV_SHARED_SATA BOOTENV_SHARED_BLKDEV(sata) 153 #define BOOTENV_SHARED_SATA BOOTENV_SHARED_BLKDEV(sata)
154 #define BOOTENV_DEV_SATA BOOTENV_DEV_BLKDEV 154 #define BOOTENV_DEV_SATA BOOTENV_DEV_BLKDEV
155 #define BOOTENV_DEV_NAME_SATA BOOTENV_DEV_NAME_BLKDEV 155 #define BOOTENV_DEV_NAME_SATA BOOTENV_DEV_NAME_BLKDEV
156 #else 156 #else
157 #define BOOTENV_SHARED_SATA 157 #define BOOTENV_SHARED_SATA
158 #define BOOTENV_DEV_SATA \ 158 #define BOOTENV_DEV_SATA \
159 BOOT_TARGET_DEVICES_references_SATA_without_CONFIG_CMD_SATA 159 BOOT_TARGET_DEVICES_references_SATA_without_CONFIG_CMD_SATA
160 #define BOOTENV_DEV_NAME_SATA \ 160 #define BOOTENV_DEV_NAME_SATA \
161 BOOT_TARGET_DEVICES_references_SATA_without_CONFIG_CMD_SATA 161 BOOT_TARGET_DEVICES_references_SATA_without_CONFIG_CMD_SATA
162 #endif 162 #endif
163 163
164 #ifdef CONFIG_SCSI 164 #ifdef CONFIG_SCSI
165 #define BOOTENV_RUN_SCSI_INIT "run scsi_init; " 165 #define BOOTENV_RUN_SCSI_INIT "run scsi_init; "
166 #define BOOTENV_SET_SCSI_NEED_INIT "setenv scsi_need_init; " 166 #define BOOTENV_SET_SCSI_NEED_INIT "setenv scsi_need_init; "
167 #define BOOTENV_SHARED_SCSI \ 167 #define BOOTENV_SHARED_SCSI \
168 "scsi_init=" \ 168 "scsi_init=" \
169 "if ${scsi_need_init}; then " \ 169 "if ${scsi_need_init}; then " \
170 "setenv scsi_need_init false; " \ 170 "setenv scsi_need_init false; " \
171 "scsi scan; " \ 171 "scsi scan; " \
172 "fi\0" \ 172 "fi\0" \
173 \ 173 \
174 "scsi_boot=" \ 174 "scsi_boot=" \
175 BOOTENV_RUN_SCSI_INIT \ 175 BOOTENV_RUN_SCSI_INIT \
176 BOOTENV_SHARED_BLKDEV_BODY(scsi) 176 BOOTENV_SHARED_BLKDEV_BODY(scsi)
177 #define BOOTENV_DEV_SCSI BOOTENV_DEV_BLKDEV 177 #define BOOTENV_DEV_SCSI BOOTENV_DEV_BLKDEV
178 #define BOOTENV_DEV_NAME_SCSI BOOTENV_DEV_NAME_BLKDEV 178 #define BOOTENV_DEV_NAME_SCSI BOOTENV_DEV_NAME_BLKDEV
179 #else 179 #else
180 #define BOOTENV_RUN_SCSI_INIT 180 #define BOOTENV_RUN_SCSI_INIT
181 #define BOOTENV_SET_SCSI_NEED_INIT 181 #define BOOTENV_SET_SCSI_NEED_INIT
182 #define BOOTENV_SHARED_SCSI 182 #define BOOTENV_SHARED_SCSI
183 #define BOOTENV_DEV_SCSI \ 183 #define BOOTENV_DEV_SCSI \
184 BOOT_TARGET_DEVICES_references_SCSI_without_CONFIG_SCSI 184 BOOT_TARGET_DEVICES_references_SCSI_without_CONFIG_SCSI
185 #define BOOTENV_DEV_NAME_SCSI \ 185 #define BOOTENV_DEV_NAME_SCSI \
186 BOOT_TARGET_DEVICES_references_SCSI_without_CONFIG_SCSI 186 BOOT_TARGET_DEVICES_references_SCSI_without_CONFIG_SCSI
187 #endif 187 #endif
188 188
189 #ifdef CONFIG_CMD_IDE 189 #ifdef CONFIG_IDE
190 #define BOOTENV_SHARED_IDE BOOTENV_SHARED_BLKDEV(ide) 190 #define BOOTENV_SHARED_IDE BOOTENV_SHARED_BLKDEV(ide)
191 #define BOOTENV_DEV_IDE BOOTENV_DEV_BLKDEV 191 #define BOOTENV_DEV_IDE BOOTENV_DEV_BLKDEV
192 #define BOOTENV_DEV_NAME_IDE BOOTENV_DEV_NAME_BLKDEV 192 #define BOOTENV_DEV_NAME_IDE BOOTENV_DEV_NAME_BLKDEV
193 #else 193 #else
194 #define BOOTENV_SHARED_IDE 194 #define BOOTENV_SHARED_IDE
195 #define BOOTENV_DEV_IDE \ 195 #define BOOTENV_DEV_IDE \
196 BOOT_TARGET_DEVICES_references_IDE_without_CONFIG_CMD_IDE 196 BOOT_TARGET_DEVICES_references_IDE_without_CONFIG_IDE
197 #define BOOTENV_DEV_NAME_IDE \ 197 #define BOOTENV_DEV_NAME_IDE \
198 BOOT_TARGET_DEVICES_references_IDE_without_CONFIG_CMD_IDE 198 BOOT_TARGET_DEVICES_references_IDE_without_CONFIG_IDE
199 #endif 199 #endif
200 200
201 #if defined(CONFIG_CMD_PCI_ENUM) || defined(CONFIG_DM_PCI) 201 #if defined(CONFIG_CMD_PCI_ENUM) || defined(CONFIG_DM_PCI)
202 #define BOOTENV_RUN_NET_PCI_ENUM "run boot_net_pci_enum; " 202 #define BOOTENV_RUN_NET_PCI_ENUM "run boot_net_pci_enum; "
203 #define BOOTENV_SHARED_PCI \ 203 #define BOOTENV_SHARED_PCI \
204 "boot_net_pci_enum=pci enum\0" 204 "boot_net_pci_enum=pci enum\0"
205 #else 205 #else
206 #define BOOTENV_RUN_NET_PCI_ENUM 206 #define BOOTENV_RUN_NET_PCI_ENUM
207 #define BOOTENV_SHARED_PCI 207 #define BOOTENV_SHARED_PCI
208 #endif 208 #endif
209 209
210 #ifdef CONFIG_CMD_USB 210 #ifdef CONFIG_CMD_USB
211 #define BOOTENV_RUN_NET_USB_START "run boot_net_usb_start; " 211 #define BOOTENV_RUN_NET_USB_START "run boot_net_usb_start; "
212 #define BOOTENV_SHARED_USB \ 212 #define BOOTENV_SHARED_USB \
213 "boot_net_usb_start=usb start\0" \ 213 "boot_net_usb_start=usb start\0" \
214 "usb_boot=" \ 214 "usb_boot=" \
215 "usb start; " \ 215 "usb start; " \
216 BOOTENV_SHARED_BLKDEV_BODY(usb) 216 BOOTENV_SHARED_BLKDEV_BODY(usb)
217 #define BOOTENV_DEV_USB BOOTENV_DEV_BLKDEV 217 #define BOOTENV_DEV_USB BOOTENV_DEV_BLKDEV
218 #define BOOTENV_DEV_NAME_USB BOOTENV_DEV_NAME_BLKDEV 218 #define BOOTENV_DEV_NAME_USB BOOTENV_DEV_NAME_BLKDEV
219 #else 219 #else
220 #define BOOTENV_RUN_NET_USB_START 220 #define BOOTENV_RUN_NET_USB_START
221 #define BOOTENV_SHARED_USB 221 #define BOOTENV_SHARED_USB
222 #define BOOTENV_DEV_USB \ 222 #define BOOTENV_DEV_USB \
223 BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB 223 BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB
224 #define BOOTENV_DEV_NAME_USB \ 224 #define BOOTENV_DEV_NAME_USB \
225 BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB 225 BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB
226 #endif 226 #endif
227 227
228 #if defined(CONFIG_CMD_DHCP) 228 #if defined(CONFIG_CMD_DHCP)
229 #if defined(CONFIG_EFI_LOADER) 229 #if defined(CONFIG_EFI_LOADER)
230 #if defined(CONFIG_ARM64) 230 #if defined(CONFIG_ARM64)
231 #define BOOTENV_EFI_PXE_ARCH "0xb" 231 #define BOOTENV_EFI_PXE_ARCH "0xb"
232 #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00011:UNDI:003000" 232 #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00011:UNDI:003000"
233 #elif defined(CONFIG_ARM) 233 #elif defined(CONFIG_ARM)
234 #define BOOTENV_EFI_PXE_ARCH "0xa" 234 #define BOOTENV_EFI_PXE_ARCH "0xa"
235 #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00010:UNDI:003000" 235 #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00010:UNDI:003000"
236 #elif defined(CONFIG_X86) 236 #elif defined(CONFIG_X86)
237 /* Always assume we're running 64bit */ 237 /* Always assume we're running 64bit */
238 #define BOOTENV_EFI_PXE_ARCH "0x7" 238 #define BOOTENV_EFI_PXE_ARCH "0x7"
239 #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00007:UNDI:003000" 239 #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00007:UNDI:003000"
240 #else 240 #else
241 #error Please specify an EFI client identifier 241 #error Please specify an EFI client identifier
242 #endif 242 #endif
243 243
244 /* 244 /*
245 * Ask the dhcp server for an EFI binary. If we get one, check for a 245 * Ask the dhcp server for an EFI binary. If we get one, check for a
246 * device tree in the same folder. Then boot everything. If the file was 246 * device tree in the same folder. Then boot everything. If the file was
247 * not an EFI binary, we just return from the bootefi command and continue. 247 * not an EFI binary, we just return from the bootefi command and continue.
248 */ 248 */
249 #define BOOTENV_EFI_RUN_DHCP \ 249 #define BOOTENV_EFI_RUN_DHCP \
250 "setenv efi_fdtfile ${fdtfile}; " \ 250 "setenv efi_fdtfile ${fdtfile}; " \
251 BOOTENV_EFI_SET_FDTFILE_FALLBACK \ 251 BOOTENV_EFI_SET_FDTFILE_FALLBACK \
252 "setenv efi_old_vci ${bootp_vci};" \ 252 "setenv efi_old_vci ${bootp_vci};" \
253 "setenv efi_old_arch ${bootp_arch};" \ 253 "setenv efi_old_arch ${bootp_arch};" \
254 "setenv bootp_vci " BOOTENV_EFI_PXE_VCI ";" \ 254 "setenv bootp_vci " BOOTENV_EFI_PXE_VCI ";" \
255 "setenv bootp_arch " BOOTENV_EFI_PXE_ARCH ";" \ 255 "setenv bootp_arch " BOOTENV_EFI_PXE_ARCH ";" \
256 "if dhcp ${kernel_addr_r}; then " \ 256 "if dhcp ${kernel_addr_r}; then " \
257 "tftpboot ${fdt_addr_r} dtb/${efi_fdtfile};" \ 257 "tftpboot ${fdt_addr_r} dtb/${efi_fdtfile};" \
258 "if fdt addr ${fdt_addr_r}; then " \ 258 "if fdt addr ${fdt_addr_r}; then " \
259 "bootefi ${kernel_addr_r} ${fdt_addr_r}; " \ 259 "bootefi ${kernel_addr_r} ${fdt_addr_r}; " \
260 "else " \ 260 "else " \
261 "bootefi ${kernel_addr_r} ${fdtcontroladdr};" \ 261 "bootefi ${kernel_addr_r} ${fdtcontroladdr};" \
262 "fi;" \ 262 "fi;" \
263 "fi;" \ 263 "fi;" \
264 "setenv bootp_vci ${efi_old_vci};" \ 264 "setenv bootp_vci ${efi_old_vci};" \
265 "setenv bootp_arch ${efi_old_arch};" \ 265 "setenv bootp_arch ${efi_old_arch};" \
266 "setenv efi_fdtfile;" \ 266 "setenv efi_fdtfile;" \
267 "setenv efi_old_arch;" \ 267 "setenv efi_old_arch;" \
268 "setenv efi_old_vci;" 268 "setenv efi_old_vci;"
269 #else 269 #else
270 #define BOOTENV_EFI_RUN_DHCP 270 #define BOOTENV_EFI_RUN_DHCP
271 #endif 271 #endif
272 #define BOOTENV_DEV_DHCP(devtypeu, devtypel, instance) \ 272 #define BOOTENV_DEV_DHCP(devtypeu, devtypel, instance) \
273 "bootcmd_dhcp=" \ 273 "bootcmd_dhcp=" \
274 BOOTENV_RUN_NET_USB_START \ 274 BOOTENV_RUN_NET_USB_START \
275 BOOTENV_RUN_NET_PCI_ENUM \ 275 BOOTENV_RUN_NET_PCI_ENUM \
276 "if dhcp ${scriptaddr} ${boot_script_dhcp}; then " \ 276 "if dhcp ${scriptaddr} ${boot_script_dhcp}; then " \
277 "source ${scriptaddr}; " \ 277 "source ${scriptaddr}; " \
278 "fi;" \ 278 "fi;" \
279 BOOTENV_EFI_RUN_DHCP \ 279 BOOTENV_EFI_RUN_DHCP \
280 "\0" 280 "\0"
281 #define BOOTENV_DEV_NAME_DHCP(devtypeu, devtypel, instance) \ 281 #define BOOTENV_DEV_NAME_DHCP(devtypeu, devtypel, instance) \
282 "dhcp " 282 "dhcp "
283 #else 283 #else
284 #define BOOTENV_DEV_DHCP \ 284 #define BOOTENV_DEV_DHCP \
285 BOOT_TARGET_DEVICES_references_DHCP_without_CONFIG_CMD_DHCP 285 BOOT_TARGET_DEVICES_references_DHCP_without_CONFIG_CMD_DHCP
286 #define BOOTENV_DEV_NAME_DHCP \ 286 #define BOOTENV_DEV_NAME_DHCP \
287 BOOT_TARGET_DEVICES_references_DHCP_without_CONFIG_CMD_DHCP 287 BOOT_TARGET_DEVICES_references_DHCP_without_CONFIG_CMD_DHCP
288 #endif 288 #endif
289 289
290 #if defined(CONFIG_CMD_DHCP) && defined(CONFIG_CMD_PXE) 290 #if defined(CONFIG_CMD_DHCP) && defined(CONFIG_CMD_PXE)
291 #define BOOTENV_DEV_PXE(devtypeu, devtypel, instance) \ 291 #define BOOTENV_DEV_PXE(devtypeu, devtypel, instance) \
292 "bootcmd_pxe=" \ 292 "bootcmd_pxe=" \
293 BOOTENV_RUN_NET_USB_START \ 293 BOOTENV_RUN_NET_USB_START \
294 BOOTENV_RUN_NET_PCI_ENUM \ 294 BOOTENV_RUN_NET_PCI_ENUM \
295 "dhcp; " \ 295 "dhcp; " \
296 "if pxe get; then " \ 296 "if pxe get; then " \
297 "pxe boot; " \ 297 "pxe boot; " \
298 "fi\0" 298 "fi\0"
299 #define BOOTENV_DEV_NAME_PXE(devtypeu, devtypel, instance) \ 299 #define BOOTENV_DEV_NAME_PXE(devtypeu, devtypel, instance) \
300 "pxe " 300 "pxe "
301 #else 301 #else
302 #define BOOTENV_DEV_PXE \ 302 #define BOOTENV_DEV_PXE \
303 BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE 303 BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE
304 #define BOOTENV_DEV_NAME_PXE \ 304 #define BOOTENV_DEV_NAME_PXE \
305 BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE 305 BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE
306 #endif 306 #endif
307 307
308 #define BOOTENV_DEV_NAME(devtypeu, devtypel, instance) \ 308 #define BOOTENV_DEV_NAME(devtypeu, devtypel, instance) \
309 BOOTENV_DEV_NAME_##devtypeu(devtypeu, devtypel, instance) 309 BOOTENV_DEV_NAME_##devtypeu(devtypeu, devtypel, instance)
310 #define BOOTENV_BOOT_TARGETS \ 310 #define BOOTENV_BOOT_TARGETS \
311 "boot_targets=" BOOT_TARGET_DEVICES(BOOTENV_DEV_NAME) "\0" 311 "boot_targets=" BOOT_TARGET_DEVICES(BOOTENV_DEV_NAME) "\0"
312 312
313 #define BOOTENV_DEV(devtypeu, devtypel, instance) \ 313 #define BOOTENV_DEV(devtypeu, devtypel, instance) \
314 BOOTENV_DEV_##devtypeu(devtypeu, devtypel, instance) 314 BOOTENV_DEV_##devtypeu(devtypeu, devtypel, instance)
315 #define BOOTENV \ 315 #define BOOTENV \
316 BOOTENV_SHARED_HOST \ 316 BOOTENV_SHARED_HOST \
317 BOOTENV_SHARED_MMC \ 317 BOOTENV_SHARED_MMC \
318 BOOTENV_SHARED_PCI \ 318 BOOTENV_SHARED_PCI \
319 BOOTENV_SHARED_USB \ 319 BOOTENV_SHARED_USB \
320 BOOTENV_SHARED_SATA \ 320 BOOTENV_SHARED_SATA \
321 BOOTENV_SHARED_SCSI \ 321 BOOTENV_SHARED_SCSI \
322 BOOTENV_SHARED_IDE \ 322 BOOTENV_SHARED_IDE \
323 BOOTENV_SHARED_UBIFS \ 323 BOOTENV_SHARED_UBIFS \
324 BOOTENV_SHARED_EFI \ 324 BOOTENV_SHARED_EFI \
325 "boot_prefixes=/ /boot/\0" \ 325 "boot_prefixes=/ /boot/\0" \
326 "boot_scripts=boot.scr.uimg boot.scr\0" \ 326 "boot_scripts=boot.scr.uimg boot.scr\0" \
327 "boot_script_dhcp=boot.scr.uimg\0" \ 327 "boot_script_dhcp=boot.scr.uimg\0" \
328 BOOTENV_BOOT_TARGETS \ 328 BOOTENV_BOOT_TARGETS \
329 \ 329 \
330 "boot_extlinux=" \ 330 "boot_extlinux=" \
331 "sysboot ${devtype} ${devnum}:${distro_bootpart} any " \ 331 "sysboot ${devtype} ${devnum}:${distro_bootpart} any " \
332 "${scriptaddr} ${prefix}extlinux/extlinux.conf\0" \ 332 "${scriptaddr} ${prefix}extlinux/extlinux.conf\0" \
333 \ 333 \
334 "scan_dev_for_extlinux=" \ 334 "scan_dev_for_extlinux=" \
335 "if test -e ${devtype} " \ 335 "if test -e ${devtype} " \
336 "${devnum}:${distro_bootpart} " \ 336 "${devnum}:${distro_bootpart} " \
337 "${prefix}extlinux/extlinux.conf; then " \ 337 "${prefix}extlinux/extlinux.conf; then " \
338 "echo Found ${prefix}extlinux/extlinux.conf; " \ 338 "echo Found ${prefix}extlinux/extlinux.conf; " \
339 "run boot_extlinux; " \ 339 "run boot_extlinux; " \
340 "echo SCRIPT FAILED: continuing...; " \ 340 "echo SCRIPT FAILED: continuing...; " \
341 "fi\0" \ 341 "fi\0" \
342 \ 342 \
343 "boot_a_script=" \ 343 "boot_a_script=" \
344 "load ${devtype} ${devnum}:${distro_bootpart} " \ 344 "load ${devtype} ${devnum}:${distro_bootpart} " \
345 "${scriptaddr} ${prefix}${script}; " \ 345 "${scriptaddr} ${prefix}${script}; " \
346 "source ${scriptaddr}\0" \ 346 "source ${scriptaddr}\0" \
347 \ 347 \
348 "scan_dev_for_scripts=" \ 348 "scan_dev_for_scripts=" \
349 "for script in ${boot_scripts}; do " \ 349 "for script in ${boot_scripts}; do " \
350 "if test -e ${devtype} " \ 350 "if test -e ${devtype} " \
351 "${devnum}:${distro_bootpart} " \ 351 "${devnum}:${distro_bootpart} " \
352 "${prefix}${script}; then " \ 352 "${prefix}${script}; then " \
353 "echo Found U-Boot script " \ 353 "echo Found U-Boot script " \
354 "${prefix}${script}; " \ 354 "${prefix}${script}; " \
355 "run boot_a_script; " \ 355 "run boot_a_script; " \
356 "echo SCRIPT FAILED: continuing...; " \ 356 "echo SCRIPT FAILED: continuing...; " \
357 "fi; " \ 357 "fi; " \
358 "done\0" \ 358 "done\0" \
359 \ 359 \
360 "scan_dev_for_boot=" \ 360 "scan_dev_for_boot=" \
361 "echo Scanning ${devtype} " \ 361 "echo Scanning ${devtype} " \
362 "${devnum}:${distro_bootpart}...; " \ 362 "${devnum}:${distro_bootpart}...; " \
363 "for prefix in ${boot_prefixes}; do " \ 363 "for prefix in ${boot_prefixes}; do " \
364 "run scan_dev_for_extlinux; " \ 364 "run scan_dev_for_extlinux; " \
365 "run scan_dev_for_scripts; " \ 365 "run scan_dev_for_scripts; " \
366 "done;" \ 366 "done;" \
367 SCAN_DEV_FOR_EFI \ 367 SCAN_DEV_FOR_EFI \
368 "\0" \ 368 "\0" \
369 \ 369 \
370 "scan_dev_for_boot_part=" \ 370 "scan_dev_for_boot_part=" \
371 "part list ${devtype} ${devnum} -bootable devplist; " \ 371 "part list ${devtype} ${devnum} -bootable devplist; " \
372 "env exists devplist || setenv devplist 1; " \ 372 "env exists devplist || setenv devplist 1; " \
373 "for distro_bootpart in ${devplist}; do " \ 373 "for distro_bootpart in ${devplist}; do " \
374 "if fstype ${devtype} " \ 374 "if fstype ${devtype} " \
375 "${devnum}:${distro_bootpart} " \ 375 "${devnum}:${distro_bootpart} " \
376 "bootfstype; then " \ 376 "bootfstype; then " \
377 "run scan_dev_for_boot; " \ 377 "run scan_dev_for_boot; " \
378 "fi; " \ 378 "fi; " \
379 "done\0" \ 379 "done\0" \
380 \ 380 \
381 BOOT_TARGET_DEVICES(BOOTENV_DEV) \ 381 BOOT_TARGET_DEVICES(BOOTENV_DEV) \
382 \ 382 \
383 "distro_bootcmd=" BOOTENV_SET_SCSI_NEED_INIT \ 383 "distro_bootcmd=" BOOTENV_SET_SCSI_NEED_INIT \
384 "for target in ${boot_targets}; do " \ 384 "for target in ${boot_targets}; do " \
385 "run bootcmd_${target}; " \ 385 "run bootcmd_${target}; " \
386 "done\0" 386 "done\0"
387 387
388 #ifndef CONFIG_BOOTCOMMAND 388 #ifndef CONFIG_BOOTCOMMAND
389 #define CONFIG_BOOTCOMMAND "run distro_bootcmd" 389 #define CONFIG_BOOTCOMMAND "run distro_bootcmd"
390 #endif 390 #endif
391 391
392 #endif /* _CONFIG_CMD_DISTRO_BOOTCMD_H */ 392 #endif /* _CONFIG_CMD_DISTRO_BOOTCMD_H */
393 393
include/config_fallbacks.h
1 /* 1 /*
2 * Copyright 2012 Texas Instruments 2 * Copyright 2012 Texas Instruments
3 * 3 *
4 * This file is licensed under the terms of the GNU General Public 4 * This file is licensed under the terms of the GNU General Public
5 * License Version 2. This file is licensed "as is" without any 5 * License Version 2. This file is licensed "as is" without any
6 * warranty of any kind, whether express or implied. 6 * warranty of any kind, whether express or implied.
7 */ 7 */
8 8
9 #ifndef __CONFIG_FALLBACKS_H 9 #ifndef __CONFIG_FALLBACKS_H
10 #define __CONFIG_FALLBACKS_H 10 #define __CONFIG_FALLBACKS_H
11 11
12 #ifdef CONFIG_SPL 12 #ifdef CONFIG_SPL
13 #ifdef CONFIG_SPL_PAD_TO 13 #ifdef CONFIG_SPL_PAD_TO
14 #ifdef CONFIG_SPL_MAX_SIZE 14 #ifdef CONFIG_SPL_MAX_SIZE
15 #if CONFIG_SPL_PAD_TO && CONFIG_SPL_PAD_TO < CONFIG_SPL_MAX_SIZE 15 #if CONFIG_SPL_PAD_TO && CONFIG_SPL_PAD_TO < CONFIG_SPL_MAX_SIZE
16 #error CONFIG_SPL_PAD_TO < CONFIG_SPL_MAX_SIZE 16 #error CONFIG_SPL_PAD_TO < CONFIG_SPL_MAX_SIZE
17 #endif 17 #endif
18 #endif 18 #endif
19 #else 19 #else
20 #ifdef CONFIG_SPL_MAX_SIZE 20 #ifdef CONFIG_SPL_MAX_SIZE
21 #define CONFIG_SPL_PAD_TO CONFIG_SPL_MAX_SIZE 21 #define CONFIG_SPL_PAD_TO CONFIG_SPL_MAX_SIZE
22 #else 22 #else
23 #define CONFIG_SPL_PAD_TO 0 23 #define CONFIG_SPL_PAD_TO 0
24 #endif 24 #endif
25 #endif 25 #endif
26 #endif 26 #endif
27 27
28 #ifndef CONFIG_SYS_BAUDRATE_TABLE 28 #ifndef CONFIG_SYS_BAUDRATE_TABLE
29 #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 } 29 #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
30 #endif 30 #endif
31 31
32 #if defined(CONFIG_CMD_FAT) && !defined(CONFIG_FS_FAT) 32 #if defined(CONFIG_CMD_FAT) && !defined(CONFIG_FS_FAT)
33 #define CONFIG_FS_FAT 33 #define CONFIG_FS_FAT
34 #endif 34 #endif
35 35
36 #if (defined(CONFIG_CMD_EXT4) || defined(CONFIG_CMD_EXT2)) && \ 36 #if (defined(CONFIG_CMD_EXT4) || defined(CONFIG_CMD_EXT2)) && \
37 !defined(CONFIG_FS_EXT4) 37 !defined(CONFIG_FS_EXT4)
38 #define CONFIG_FS_EXT4 38 #define CONFIG_FS_EXT4
39 #endif 39 #endif
40 40
41 #if defined(CONFIG_CMD_EXT4_WRITE) && !defined(CONFIG_EXT4_WRITE) 41 #if defined(CONFIG_CMD_EXT4_WRITE) && !defined(CONFIG_EXT4_WRITE)
42 #define CONFIG_EXT4_WRITE 42 #define CONFIG_EXT4_WRITE
43 #endif 43 #endif
44 44
45 /* Rather than repeat this expression each time, add a define for it */ 45 /* Rather than repeat this expression each time, add a define for it */
46 #if defined(CONFIG_CMD_IDE) || \ 46 #if defined(CONFIG_IDE) || \
47 defined(CONFIG_CMD_SATA) || \ 47 defined(CONFIG_CMD_SATA) || \
48 defined(CONFIG_SCSI) || \ 48 defined(CONFIG_SCSI) || \
49 defined(CONFIG_CMD_USB) || \ 49 defined(CONFIG_CMD_USB) || \
50 defined(CONFIG_CMD_PART) || \ 50 defined(CONFIG_CMD_PART) || \
51 defined(CONFIG_CMD_GPT) || \ 51 defined(CONFIG_CMD_GPT) || \
52 defined(CONFIG_MMC) || \ 52 defined(CONFIG_MMC) || \
53 defined(CONFIG_SYSTEMACE) || \ 53 defined(CONFIG_SYSTEMACE) || \
54 defined(CONFIG_SANDBOX) 54 defined(CONFIG_SANDBOX)
55 #define HAVE_BLOCK_DEVICE 55 #define HAVE_BLOCK_DEVICE
56 #endif 56 #endif
57 57
58 #if (CONFIG_IS_ENABLED(PARTITION_UUIDS) || \ 58 #if (CONFIG_IS_ENABLED(PARTITION_UUIDS) || \
59 CONFIG_IS_ENABLED(EFI_PARTITION) || \ 59 CONFIG_IS_ENABLED(EFI_PARTITION) || \
60 defined(CONFIG_RANDOM_UUID) || \ 60 defined(CONFIG_RANDOM_UUID) || \
61 defined(CONFIG_CMD_UUID) || \ 61 defined(CONFIG_CMD_UUID) || \
62 defined(CONFIG_BOOTP_PXE)) && \ 62 defined(CONFIG_BOOTP_PXE)) && \
63 !defined(CONFIG_LIB_UUID) 63 !defined(CONFIG_LIB_UUID)
64 #define CONFIG_LIB_UUID 64 #define CONFIG_LIB_UUID
65 #endif 65 #endif
66 66
67 #if (defined(CONFIG_RANDOM_UUID) || \ 67 #if (defined(CONFIG_RANDOM_UUID) || \
68 defined(CONFIG_CMD_UUID)) && \ 68 defined(CONFIG_CMD_UUID)) && \
69 (!defined(CONFIG_LIB_RAND) && \ 69 (!defined(CONFIG_LIB_RAND) && \
70 !defined(CONFIG_LIB_HW_RAND)) 70 !defined(CONFIG_LIB_HW_RAND))
71 #define CONFIG_LIB_RAND 71 #define CONFIG_LIB_RAND
72 #endif 72 #endif
73 73
74 #ifndef CONFIG_SYS_PBSIZE 74 #ifndef CONFIG_SYS_PBSIZE
75 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + 128) 75 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + 128)
76 #endif 76 #endif
77 77
78 #ifndef CONFIG_FIT_SIGNATURE 78 #ifndef CONFIG_FIT_SIGNATURE
79 #define CONFIG_IMAGE_FORMAT_LEGACY 79 #define CONFIG_IMAGE_FORMAT_LEGACY
80 #endif 80 #endif
81 81
82 #ifdef CONFIG_DISABLE_IMAGE_LEGACY 82 #ifdef CONFIG_DISABLE_IMAGE_LEGACY
83 #undef CONFIG_IMAGE_FORMAT_LEGACY 83 #undef CONFIG_IMAGE_FORMAT_LEGACY
84 #endif 84 #endif
85 85
86 #ifdef CONFIG_DM_I2C 86 #ifdef CONFIG_DM_I2C
87 # ifdef CONFIG_SYS_I2C 87 # ifdef CONFIG_SYS_I2C
88 # error "Cannot define CONFIG_SYS_I2C when CONFIG_DM_I2C is used" 88 # error "Cannot define CONFIG_SYS_I2C when CONFIG_DM_I2C is used"
89 # endif 89 # endif
90 #endif 90 #endif
91 91
92 #ifndef CONFIG_CMDLINE 92 #ifndef CONFIG_CMDLINE
93 #undef CONFIG_CMDLINE_EDITING 93 #undef CONFIG_CMDLINE_EDITING
94 #undef CONFIG_SYS_LONGHELP 94 #undef CONFIG_SYS_LONGHELP
95 #endif 95 #endif
96 96
97 #endif /* __CONFIG_FALLBACKS_H */ 97 #endif /* __CONFIG_FALLBACKS_H */
98 98
include/configs/M5253DEMO.h
1 /* Copyright (C) 2004-2007 Freescale Semiconductor, Inc. 1 /* Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
2 * Hayden Fraser (Hayden.Fraser@freescale.com) 2 * Hayden Fraser (Hayden.Fraser@freescale.com)
3 * 3 *
4 * SPDX-License-Identifier: GPL-2.0+ 4 * SPDX-License-Identifier: GPL-2.0+
5 */ 5 */
6 6
7 #ifndef _M5253DEMO_H 7 #ifndef _M5253DEMO_H
8 #define _M5253DEMO_H 8 #define _M5253DEMO_H
9 9
10 #define CONFIG_M5253DEMO /* define board type */ 10 #define CONFIG_M5253DEMO /* define board type */
11 11
12 #define CONFIG_MCFTMR 12 #define CONFIG_MCFTMR
13 13
14 #define CONFIG_MCFUART 14 #define CONFIG_MCFUART
15 #define CONFIG_SYS_UART_PORT (0) 15 #define CONFIG_SYS_UART_PORT (0)
16 16
17 #undef CONFIG_WATCHDOG /* disable watchdog */ 17 #undef CONFIG_WATCHDOG /* disable watchdog */
18 18
19 19
20 /* Configuration for environment 20 /* Configuration for environment
21 * Environment is embedded in u-boot in the second sector of the flash 21 * Environment is embedded in u-boot in the second sector of the flash
22 */ 22 */
23 #ifdef CONFIG_MONITOR_IS_IN_RAM 23 #ifdef CONFIG_MONITOR_IS_IN_RAM
24 # define CONFIG_ENV_OFFSET 0x4000 24 # define CONFIG_ENV_OFFSET 0x4000
25 # define CONFIG_ENV_SECT_SIZE 0x1000 25 # define CONFIG_ENV_SECT_SIZE 0x1000
26 # define CONFIG_ENV_IS_IN_FLASH 1 26 # define CONFIG_ENV_IS_IN_FLASH 1
27 #else 27 #else
28 # define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + 0x4000) 28 # define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + 0x4000)
29 # define CONFIG_ENV_SECT_SIZE 0x1000 29 # define CONFIG_ENV_SECT_SIZE 0x1000
30 # define CONFIG_ENV_IS_IN_FLASH 1 30 # define CONFIG_ENV_IS_IN_FLASH 1
31 #endif 31 #endif
32 32
33 #define LDS_BOARD_TEXT \ 33 #define LDS_BOARD_TEXT \
34 . = DEFINED(env_offset) ? env_offset : .; \ 34 . = DEFINED(env_offset) ? env_offset : .; \
35 common/env_embedded.o (.text*); 35 common/env_embedded.o (.text*);
36 36
37 /* 37 /*
38 * Command line configuration. 38 * Command line configuration.
39 */ 39 */
40 40
41 #ifdef CONFIG_CMD_IDE 41 #ifdef CONFIG_IDE
42 /* ATA */ 42 /* ATA */
43 # define CONFIG_IDE_RESET 1 43 # define CONFIG_IDE_RESET 1
44 # define CONFIG_IDE_PREINIT 1 44 # define CONFIG_IDE_PREINIT 1
45 # define CONFIG_ATAPI 45 # define CONFIG_ATAPI
46 # undef CONFIG_LBA48 46 # undef CONFIG_LBA48
47 47
48 # define CONFIG_SYS_IDE_MAXBUS 1 48 # define CONFIG_SYS_IDE_MAXBUS 1
49 # define CONFIG_SYS_IDE_MAXDEVICE 2 49 # define CONFIG_SYS_IDE_MAXDEVICE 2
50 50
51 # define CONFIG_SYS_ATA_BASE_ADDR (CONFIG_SYS_MBAR2 + 0x800) 51 # define CONFIG_SYS_ATA_BASE_ADDR (CONFIG_SYS_MBAR2 + 0x800)
52 # define CONFIG_SYS_ATA_IDE0_OFFSET 0 52 # define CONFIG_SYS_ATA_IDE0_OFFSET 0
53 53
54 # define CONFIG_SYS_ATA_DATA_OFFSET 0xA0 /* Offset for data I/O */ 54 # define CONFIG_SYS_ATA_DATA_OFFSET 0xA0 /* Offset for data I/O */
55 # define CONFIG_SYS_ATA_REG_OFFSET 0xA0 /* Offset for normal register accesses */ 55 # define CONFIG_SYS_ATA_REG_OFFSET 0xA0 /* Offset for normal register accesses */
56 # define CONFIG_SYS_ATA_ALT_OFFSET 0xC0 /* Offset for alternate registers */ 56 # define CONFIG_SYS_ATA_ALT_OFFSET 0xC0 /* Offset for alternate registers */
57 # define CONFIG_SYS_ATA_STRIDE 4 /* Interval between registers */ 57 # define CONFIG_SYS_ATA_STRIDE 4 /* Interval between registers */
58 #endif 58 #endif
59 59
60 #define CONFIG_DRIVER_DM9000 60 #define CONFIG_DRIVER_DM9000
61 #ifdef CONFIG_DRIVER_DM9000 61 #ifdef CONFIG_DRIVER_DM9000
62 # define CONFIG_DM9000_BASE (CONFIG_SYS_CS1_BASE | 0x300) 62 # define CONFIG_DM9000_BASE (CONFIG_SYS_CS1_BASE | 0x300)
63 # define DM9000_IO CONFIG_DM9000_BASE 63 # define DM9000_IO CONFIG_DM9000_BASE
64 # define DM9000_DATA (CONFIG_DM9000_BASE + 4) 64 # define DM9000_DATA (CONFIG_DM9000_BASE + 4)
65 # undef CONFIG_DM9000_DEBUG 65 # undef CONFIG_DM9000_DEBUG
66 # define CONFIG_DM9000_BYTE_SWAPPED 66 # define CONFIG_DM9000_BYTE_SWAPPED
67 67
68 # define CONFIG_OVERWRITE_ETHADDR_ONCE 68 # define CONFIG_OVERWRITE_ETHADDR_ONCE
69 69
70 # define CONFIG_EXTRA_ENV_SETTINGS \ 70 # define CONFIG_EXTRA_ENV_SETTINGS \
71 "netdev=eth0\0" \ 71 "netdev=eth0\0" \
72 "inpclk=" __stringify(CONFIG_SYS_INPUT_CLKSRC) "\0" \ 72 "inpclk=" __stringify(CONFIG_SYS_INPUT_CLKSRC) "\0" \
73 "loadaddr=10000\0" \ 73 "loadaddr=10000\0" \
74 "u-boot=u-boot.bin\0" \ 74 "u-boot=u-boot.bin\0" \
75 "load=tftp ${loadaddr) ${u-boot}\0" \ 75 "load=tftp ${loadaddr) ${u-boot}\0" \
76 "upd=run load; run prog\0" \ 76 "upd=run load; run prog\0" \
77 "prog=prot off 0xff800000 0xff82ffff;" \ 77 "prog=prot off 0xff800000 0xff82ffff;" \
78 "era 0xff800000 0xff82ffff;" \ 78 "era 0xff800000 0xff82ffff;" \
79 "cp.b ${loadaddr} 0xff800000 ${filesize};" \ 79 "cp.b ${loadaddr} 0xff800000 ${filesize};" \
80 "save\0" \ 80 "save\0" \
81 "" 81 ""
82 #endif 82 #endif
83 83
84 #define CONFIG_HOSTNAME M5253DEMO 84 #define CONFIG_HOSTNAME M5253DEMO
85 85
86 /* I2C */ 86 /* I2C */
87 #define CONFIG_SYS_I2C 87 #define CONFIG_SYS_I2C
88 #define CONFIG_SYS_I2C_FSL 88 #define CONFIG_SYS_I2C_FSL
89 #define CONFIG_SYS_FSL_I2C_SPEED 80000 89 #define CONFIG_SYS_FSL_I2C_SPEED 80000
90 #define CONFIG_SYS_FSL_I2C_SLAVE 0x7F 90 #define CONFIG_SYS_FSL_I2C_SLAVE 0x7F
91 #define CONFIG_SYS_FSL_I2C_OFFSET 0x00000280 91 #define CONFIG_SYS_FSL_I2C_OFFSET 0x00000280
92 #define CONFIG_SYS_IMMR CONFIG_SYS_MBAR 92 #define CONFIG_SYS_IMMR CONFIG_SYS_MBAR
93 #define CONFIG_SYS_I2C_PINMUX_REG (*(u32 *) (CONFIG_SYS_MBAR+0x19C)) 93 #define CONFIG_SYS_I2C_PINMUX_REG (*(u32 *) (CONFIG_SYS_MBAR+0x19C))
94 #define CONFIG_SYS_I2C_PINMUX_CLR (0xFFFFE7FF) 94 #define CONFIG_SYS_I2C_PINMUX_CLR (0xFFFFE7FF)
95 #define CONFIG_SYS_I2C_PINMUX_SET (0) 95 #define CONFIG_SYS_I2C_PINMUX_SET (0)
96 96
97 #define CONFIG_SYS_LONGHELP /* undef to save memory */ 97 #define CONFIG_SYS_LONGHELP /* undef to save memory */
98 98
99 #if defined(CONFIG_CMD_KGDB) 99 #if defined(CONFIG_CMD_KGDB)
100 # define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */ 100 # define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
101 #else 101 #else
102 # define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */ 102 # define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */
103 #endif 103 #endif
104 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16) /* Print Buffer Size */ 104 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16) /* Print Buffer Size */
105 #define CONFIG_SYS_MAXARGS 16 /* max number of command args */ 105 #define CONFIG_SYS_MAXARGS 16 /* max number of command args */
106 #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE /* Boot Argument Buffer Size */ 106 #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE /* Boot Argument Buffer Size */
107 107
108 #define CONFIG_SYS_LOAD_ADDR 0x00100000 108 #define CONFIG_SYS_LOAD_ADDR 0x00100000
109 109
110 #define CONFIG_SYS_MEMTEST_START 0x400 110 #define CONFIG_SYS_MEMTEST_START 0x400
111 #define CONFIG_SYS_MEMTEST_END 0x380000 111 #define CONFIG_SYS_MEMTEST_END 0x380000
112 112
113 #undef CONFIG_SYS_PLL_BYPASS /* bypass PLL for test purpose */ 113 #undef CONFIG_SYS_PLL_BYPASS /* bypass PLL for test purpose */
114 #define CONFIG_SYS_FAST_CLK 114 #define CONFIG_SYS_FAST_CLK
115 #ifdef CONFIG_SYS_FAST_CLK 115 #ifdef CONFIG_SYS_FAST_CLK
116 # define CONFIG_SYS_PLLCR 0x1243E054 116 # define CONFIG_SYS_PLLCR 0x1243E054
117 # define CONFIG_SYS_CLK 140000000 117 # define CONFIG_SYS_CLK 140000000
118 #else 118 #else
119 # define CONFIG_SYS_PLLCR 0x135a4140 119 # define CONFIG_SYS_PLLCR 0x135a4140
120 # define CONFIG_SYS_CLK 70000000 120 # define CONFIG_SYS_CLK 70000000
121 #endif 121 #endif
122 122
123 /* 123 /*
124 * Low Level Configuration Settings 124 * Low Level Configuration Settings
125 * (address mappings, register initial values, etc.) 125 * (address mappings, register initial values, etc.)
126 * You should know what you are doing if you make changes here. 126 * You should know what you are doing if you make changes here.
127 */ 127 */
128 128
129 #define CONFIG_SYS_MBAR 0x10000000 /* Register Base Addrs */ 129 #define CONFIG_SYS_MBAR 0x10000000 /* Register Base Addrs */
130 #define CONFIG_SYS_MBAR2 0x80000000 /* Module Base Addrs 2 */ 130 #define CONFIG_SYS_MBAR2 0x80000000 /* Module Base Addrs 2 */
131 131
132 /* 132 /*
133 * Definitions for initial stack pointer and data area (in DPRAM) 133 * Definitions for initial stack pointer and data area (in DPRAM)
134 */ 134 */
135 #define CONFIG_SYS_INIT_RAM_ADDR 0x20000000 135 #define CONFIG_SYS_INIT_RAM_ADDR 0x20000000
136 #define CONFIG_SYS_INIT_RAM_SIZE 0x10000 /* Size of used area in internal SRAM */ 136 #define CONFIG_SYS_INIT_RAM_SIZE 0x10000 /* Size of used area in internal SRAM */
137 #define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) 137 #define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
138 #define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_GBL_DATA_OFFSET 138 #define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_GBL_DATA_OFFSET
139 139
140 /* 140 /*
141 * Start addresses for the final memory configuration 141 * Start addresses for the final memory configuration
142 * (Set up by the startup code) 142 * (Set up by the startup code)
143 * Please note that CONFIG_SYS_SDRAM_BASE _must_ start at 0 143 * Please note that CONFIG_SYS_SDRAM_BASE _must_ start at 0
144 */ 144 */
145 #define CONFIG_SYS_SDRAM_BASE 0x00000000 145 #define CONFIG_SYS_SDRAM_BASE 0x00000000
146 #define CONFIG_SYS_SDRAM_SIZE 16 /* SDRAM size in MB */ 146 #define CONFIG_SYS_SDRAM_SIZE 16 /* SDRAM size in MB */
147 147
148 #ifdef CONFIG_MONITOR_IS_IN_RAM 148 #ifdef CONFIG_MONITOR_IS_IN_RAM
149 # define CONFIG_SYS_MONITOR_BASE 0x20000 149 # define CONFIG_SYS_MONITOR_BASE 0x20000
150 #else 150 #else
151 # define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_FLASH_BASE + 0x400) 151 # define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_FLASH_BASE + 0x400)
152 #endif 152 #endif
153 153
154 #define CONFIG_SYS_MONITOR_LEN 0x40000 154 #define CONFIG_SYS_MONITOR_LEN 0x40000
155 #define CONFIG_SYS_MALLOC_LEN (256 << 10) 155 #define CONFIG_SYS_MALLOC_LEN (256 << 10)
156 #define CONFIG_SYS_BOOTPARAMS_LEN (64*1024) 156 #define CONFIG_SYS_BOOTPARAMS_LEN (64*1024)
157 157
158 /* 158 /*
159 * For booting Linux, the board info and command line data 159 * For booting Linux, the board info and command line data
160 * have to be in the first 8 MB of memory, since this is 160 * have to be in the first 8 MB of memory, since this is
161 * the maximum mapped by the Linux kernel during initialization ?? 161 * the maximum mapped by the Linux kernel during initialization ??
162 */ 162 */
163 #define CONFIG_SYS_BOOTMAPSZ (CONFIG_SYS_SDRAM_BASE + (CONFIG_SYS_SDRAM_SIZE << 20)) 163 #define CONFIG_SYS_BOOTMAPSZ (CONFIG_SYS_SDRAM_BASE + (CONFIG_SYS_SDRAM_SIZE << 20))
164 #define CONFIG_SYS_BOOTM_LEN (CONFIG_SYS_SDRAM_SIZE << 20) 164 #define CONFIG_SYS_BOOTM_LEN (CONFIG_SYS_SDRAM_SIZE << 20)
165 165
166 /* FLASH organization */ 166 /* FLASH organization */
167 #define CONFIG_SYS_FLASH_BASE (CONFIG_SYS_CS0_BASE) 167 #define CONFIG_SYS_FLASH_BASE (CONFIG_SYS_CS0_BASE)
168 #define CONFIG_SYS_MAX_FLASH_BANKS 1 /* max number of memory banks */ 168 #define CONFIG_SYS_MAX_FLASH_BANKS 1 /* max number of memory banks */
169 #define CONFIG_SYS_MAX_FLASH_SECT 2048 /* max number of sectors on one chip */ 169 #define CONFIG_SYS_MAX_FLASH_SECT 2048 /* max number of sectors on one chip */
170 #define CONFIG_SYS_FLASH_ERASE_TOUT 1000 170 #define CONFIG_SYS_FLASH_ERASE_TOUT 1000
171 171
172 #define FLASH_SST6401B 0x200 172 #define FLASH_SST6401B 0x200
173 #define SST_ID_xF6401B 0x236D236D 173 #define SST_ID_xF6401B 0x236D236D
174 174
175 #undef CONFIG_SYS_FLASH_CFI 175 #undef CONFIG_SYS_FLASH_CFI
176 #ifdef CONFIG_SYS_FLASH_CFI 176 #ifdef CONFIG_SYS_FLASH_CFI
177 /* 177 /*
178 * Unable to use CFI driver, due to incompatible sector erase command by SST. 178 * Unable to use CFI driver, due to incompatible sector erase command by SST.
179 * Amd/Atmel use 0x30 for sector erase, SST use 0x50. 179 * Amd/Atmel use 0x30 for sector erase, SST use 0x50.
180 * 0x30 is block erase in SST 180 * 0x30 is block erase in SST
181 */ 181 */
182 # define CONFIG_FLASH_CFI_DRIVER 1 182 # define CONFIG_FLASH_CFI_DRIVER 1
183 # define CONFIG_SYS_FLASH_SIZE 0x800000 183 # define CONFIG_SYS_FLASH_SIZE 0x800000
184 # define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT 184 # define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT
185 # define CONFIG_FLASH_CFI_LEGACY 185 # define CONFIG_FLASH_CFI_LEGACY
186 #else 186 #else
187 # define CONFIG_SYS_SST_SECT 2048 187 # define CONFIG_SYS_SST_SECT 2048
188 # define CONFIG_SYS_SST_SECTSZ 0x1000 188 # define CONFIG_SYS_SST_SECTSZ 0x1000
189 # define CONFIG_SYS_FLASH_WRITE_TOUT 500 189 # define CONFIG_SYS_FLASH_WRITE_TOUT 500
190 #endif 190 #endif
191 191
192 /* Cache Configuration */ 192 /* Cache Configuration */
193 #define CONFIG_SYS_CACHELINE_SIZE 16 193 #define CONFIG_SYS_CACHELINE_SIZE 16
194 194
195 #define ICACHE_STATUS (CONFIG_SYS_INIT_RAM_ADDR + \ 195 #define ICACHE_STATUS (CONFIG_SYS_INIT_RAM_ADDR + \
196 CONFIG_SYS_INIT_RAM_SIZE - 8) 196 CONFIG_SYS_INIT_RAM_SIZE - 8)
197 #define DCACHE_STATUS (CONFIG_SYS_INIT_RAM_ADDR + \ 197 #define DCACHE_STATUS (CONFIG_SYS_INIT_RAM_ADDR + \
198 CONFIG_SYS_INIT_RAM_SIZE - 4) 198 CONFIG_SYS_INIT_RAM_SIZE - 4)
199 #define CONFIG_SYS_ICACHE_INV (CF_CACR_DCM) 199 #define CONFIG_SYS_ICACHE_INV (CF_CACR_DCM)
200 #define CONFIG_SYS_CACHE_ACR0 (CONFIG_SYS_FLASH_BASE | \ 200 #define CONFIG_SYS_CACHE_ACR0 (CONFIG_SYS_FLASH_BASE | \
201 CF_ADDRMASK(8) | \ 201 CF_ADDRMASK(8) | \
202 CF_ACR_EN | CF_ACR_SM_ALL) 202 CF_ACR_EN | CF_ACR_SM_ALL)
203 #define CONFIG_SYS_CACHE_ACR1 (CONFIG_SYS_SDRAM_BASE | \ 203 #define CONFIG_SYS_CACHE_ACR1 (CONFIG_SYS_SDRAM_BASE | \
204 CF_ADDRMASK(CONFIG_SYS_SDRAM_SIZE) | \ 204 CF_ADDRMASK(CONFIG_SYS_SDRAM_SIZE) | \
205 CF_ACR_EN | CF_ACR_SM_ALL) 205 CF_ACR_EN | CF_ACR_SM_ALL)
206 #define CONFIG_SYS_CACHE_ICACR (CF_CACR_CENB | CF_CACR_CEIB | \ 206 #define CONFIG_SYS_CACHE_ICACR (CF_CACR_CENB | CF_CACR_CEIB | \
207 CF_CACR_DBWE) 207 CF_CACR_DBWE)
208 208
209 /* Port configuration */ 209 /* Port configuration */
210 #define CONFIG_SYS_FECI2C 0xF0 210 #define CONFIG_SYS_FECI2C 0xF0
211 211
212 #define CONFIG_SYS_CS0_BASE 0xFF800000 212 #define CONFIG_SYS_CS0_BASE 0xFF800000
213 #define CONFIG_SYS_CS0_MASK 0x007F0021 213 #define CONFIG_SYS_CS0_MASK 0x007F0021
214 #define CONFIG_SYS_CS0_CTRL 0x00001D80 214 #define CONFIG_SYS_CS0_CTRL 0x00001D80
215 215
216 #define CONFIG_SYS_CS1_BASE 0xE0000000 216 #define CONFIG_SYS_CS1_BASE 0xE0000000
217 #define CONFIG_SYS_CS1_MASK 0x00000001 217 #define CONFIG_SYS_CS1_MASK 0x00000001
218 #define CONFIG_SYS_CS1_CTRL 0x00003DD8 218 #define CONFIG_SYS_CS1_CTRL 0x00003DD8
219 219
220 /*----------------------------------------------------------------------- 220 /*-----------------------------------------------------------------------
221 * Port configuration 221 * Port configuration
222 */ 222 */
223 #define CONFIG_SYS_GPIO_FUNC 0x00000008 /* Set gpio pins: none */ 223 #define CONFIG_SYS_GPIO_FUNC 0x00000008 /* Set gpio pins: none */
224 #define CONFIG_SYS_GPIO1_FUNC 0x00df00f0 /* 36-39(SWITCH),48-52(FPGAs),54 */ 224 #define CONFIG_SYS_GPIO1_FUNC 0x00df00f0 /* 36-39(SWITCH),48-52(FPGAs),54 */
225 #define CONFIG_SYS_GPIO_EN 0x00000008 /* Set gpio output enable */ 225 #define CONFIG_SYS_GPIO_EN 0x00000008 /* Set gpio output enable */
226 #define CONFIG_SYS_GPIO1_EN 0x00c70000 /* Set gpio output enable */ 226 #define CONFIG_SYS_GPIO1_EN 0x00c70000 /* Set gpio output enable */
227 #define CONFIG_SYS_GPIO_OUT 0x00000008 /* Set outputs to default state */ 227 #define CONFIG_SYS_GPIO_OUT 0x00000008 /* Set outputs to default state */
228 #define CONFIG_SYS_GPIO1_OUT 0x00c70000 /* Set outputs to default state */ 228 #define CONFIG_SYS_GPIO1_OUT 0x00c70000 /* Set outputs to default state */
229 #define CONFIG_SYS_GPIO1_LED 0x00400000 /* user led */ 229 #define CONFIG_SYS_GPIO1_LED 0x00400000 /* user led */
230 230
231 #endif /* _M5253DEMO_H */ 231 #endif /* _M5253DEMO_H */
232 232
include/configs/edminiv2.h
1 /* 1 /*
2 * Copyright (C) 2010 Albert ARIBAUD <albert.u.boot@aribaud.net> 2 * Copyright (C) 2010 Albert ARIBAUD <albert.u.boot@aribaud.net>
3 * 3 *
4 * Based on original Kirkwood support which is 4 * Based on original Kirkwood support which is
5 * (C) Copyright 2009 5 * (C) Copyright 2009
6 * Marvell Semiconductor <www.marvell.com> 6 * Marvell Semiconductor <www.marvell.com>
7 * Written-by: Prafulla Wadaskar <prafulla@marvell.com> 7 * Written-by: Prafulla Wadaskar <prafulla@marvell.com>
8 * 8 *
9 * SPDX-License-Identifier: GPL-2.0+ 9 * SPDX-License-Identifier: GPL-2.0+
10 */ 10 */
11 11
12 #ifndef _CONFIG_EDMINIV2_H 12 #ifndef _CONFIG_EDMINIV2_H
13 #define _CONFIG_EDMINIV2_H 13 #define _CONFIG_EDMINIV2_H
14 14
15 /* 15 /*
16 * SPL 16 * SPL
17 */ 17 */
18 18
19 #define CONFIG_SPL_FRAMEWORK 19 #define CONFIG_SPL_FRAMEWORK
20 #define CONFIG_SPL_TEXT_BASE 0xffff0000 20 #define CONFIG_SPL_TEXT_BASE 0xffff0000
21 #define CONFIG_SPL_MAX_SIZE 0x0000fff0 21 #define CONFIG_SPL_MAX_SIZE 0x0000fff0
22 #define CONFIG_SPL_STACK 0x00020000 22 #define CONFIG_SPL_STACK 0x00020000
23 #define CONFIG_SPL_BSS_START_ADDR 0x00020000 23 #define CONFIG_SPL_BSS_START_ADDR 0x00020000
24 #define CONFIG_SPL_BSS_MAX_SIZE 0x0001ffff 24 #define CONFIG_SPL_BSS_MAX_SIZE 0x0001ffff
25 #define CONFIG_SYS_SPL_MALLOC_START 0x00040000 25 #define CONFIG_SYS_SPL_MALLOC_START 0x00040000
26 #define CONFIG_SYS_SPL_MALLOC_SIZE 0x0001ffff 26 #define CONFIG_SYS_SPL_MALLOC_SIZE 0x0001ffff
27 #define CONFIG_SPL_LDSCRIPT "$(CPUDIR)/orion5x/u-boot-spl.lds" 27 #define CONFIG_SPL_LDSCRIPT "$(CPUDIR)/orion5x/u-boot-spl.lds"
28 #define CONFIG_SYS_UBOOT_BASE 0xfff90000 28 #define CONFIG_SYS_UBOOT_BASE 0xfff90000
29 #define CONFIG_SYS_UBOOT_START 0x00800000 29 #define CONFIG_SYS_UBOOT_START 0x00800000
30 #define CONFIG_SYS_TEXT_BASE 0x00800000 30 #define CONFIG_SYS_TEXT_BASE 0x00800000
31 31
32 /* 32 /*
33 * High Level Configuration Options (easy to change) 33 * High Level Configuration Options (easy to change)
34 */ 34 */
35 35
36 #define CONFIG_MARVELL 1 36 #define CONFIG_MARVELL 1
37 #define CONFIG_FEROCEON 1 /* CPU Core subversion */ 37 #define CONFIG_FEROCEON 1 /* CPU Core subversion */
38 #define CONFIG_88F5182 1 /* SOC Name */ 38 #define CONFIG_88F5182 1 /* SOC Name */
39 #define CONFIG_MACH_EDMINIV2 1 /* Machine type */ 39 #define CONFIG_MACH_EDMINIV2 1 /* Machine type */
40 40
41 #include <asm/arch/orion5x.h> 41 #include <asm/arch/orion5x.h>
42 /* 42 /*
43 * CLKs configurations 43 * CLKs configurations
44 */ 44 */
45 45
46 /* 46 /*
47 * Board-specific values for Orion5x MPP low level init: 47 * Board-specific values for Orion5x MPP low level init:
48 * - MPPs 12 to 15 are SATA LEDs (mode 5) 48 * - MPPs 12 to 15 are SATA LEDs (mode 5)
49 * - Others are GPIO/unused (mode 3 for MPP0, mode 5 for 49 * - Others are GPIO/unused (mode 3 for MPP0, mode 5 for
50 * MPP16 to MPP19, mode 0 for others 50 * MPP16 to MPP19, mode 0 for others
51 */ 51 */
52 52
53 #define ORION5X_MPP0_7 0x00000003 53 #define ORION5X_MPP0_7 0x00000003
54 #define ORION5X_MPP8_15 0x55550000 54 #define ORION5X_MPP8_15 0x55550000
55 #define ORION5X_MPP16_23 0x00005555 55 #define ORION5X_MPP16_23 0x00005555
56 56
57 /* 57 /*
58 * Board-specific values for Orion5x GPIO low level init: 58 * Board-specific values for Orion5x GPIO low level init:
59 * - GPIO3 is input (RTC interrupt) 59 * - GPIO3 is input (RTC interrupt)
60 * - GPIO16 is Power LED control (0 = on, 1 = off) 60 * - GPIO16 is Power LED control (0 = on, 1 = off)
61 * - GPIO17 is Power LED source select (0 = CPLD, 1 = GPIO16) 61 * - GPIO17 is Power LED source select (0 = CPLD, 1 = GPIO16)
62 * - GPIO18 is Power Button status (0 = Released, 1 = Pressed) 62 * - GPIO18 is Power Button status (0 = Released, 1 = Pressed)
63 * - GPIO19 is SATA disk power toggle (toggles on 0-to-1) 63 * - GPIO19 is SATA disk power toggle (toggles on 0-to-1)
64 * - GPIO22 is SATA disk power status () 64 * - GPIO22 is SATA disk power status ()
65 * - GPIO23 is supply status for SATA disk () 65 * - GPIO23 is supply status for SATA disk ()
66 * - GPIO24 is supply control for board (write 1 to power off) 66 * - GPIO24 is supply control for board (write 1 to power off)
67 * Last GPIO is 25, further bits are supposed to be 0. 67 * Last GPIO is 25, further bits are supposed to be 0.
68 * Enable mask has ones for INPUT, 0 for OUTPUT. 68 * Enable mask has ones for INPUT, 0 for OUTPUT.
69 * Default is LED ON, board ON :) 69 * Default is LED ON, board ON :)
70 */ 70 */
71 71
72 #define ORION5X_GPIO_OUT_ENABLE 0xfef4f0ca 72 #define ORION5X_GPIO_OUT_ENABLE 0xfef4f0ca
73 #define ORION5X_GPIO_OUT_VALUE 0x00000000 73 #define ORION5X_GPIO_OUT_VALUE 0x00000000
74 #define ORION5X_GPIO_IN_POLARITY 0x000000d0 74 #define ORION5X_GPIO_IN_POLARITY 0x000000d0
75 75
76 /* 76 /*
77 * NS16550 Configuration 77 * NS16550 Configuration
78 */ 78 */
79 79
80 #define CONFIG_SYS_NS16550_SERIAL 80 #define CONFIG_SYS_NS16550_SERIAL
81 #define CONFIG_SYS_NS16550_REG_SIZE (-4) 81 #define CONFIG_SYS_NS16550_REG_SIZE (-4)
82 #define CONFIG_SYS_NS16550_CLK CONFIG_SYS_TCLK 82 #define CONFIG_SYS_NS16550_CLK CONFIG_SYS_TCLK
83 #define CONFIG_SYS_NS16550_COM1 ORION5X_UART0_BASE 83 #define CONFIG_SYS_NS16550_COM1 ORION5X_UART0_BASE
84 84
85 /* 85 /*
86 * Serial Port configuration 86 * Serial Port configuration
87 * The following definitions let you select what serial you want to use 87 * The following definitions let you select what serial you want to use
88 * for your console driver. 88 * for your console driver.
89 */ 89 */
90 90
91 #define CONFIG_CONS_INDEX 1 /*Console on UART0 */ 91 #define CONFIG_CONS_INDEX 1 /*Console on UART0 */
92 #define CONFIG_SYS_BAUDRATE_TABLE \ 92 #define CONFIG_SYS_BAUDRATE_TABLE \
93 { 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600 } 93 { 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600 }
94 94
95 /* 95 /*
96 * FLASH configuration 96 * FLASH configuration
97 */ 97 */
98 98
99 #define CONFIG_SYS_FLASH_CFI 99 #define CONFIG_SYS_FLASH_CFI
100 #define CONFIG_FLASH_CFI_DRIVER 100 #define CONFIG_FLASH_CFI_DRIVER
101 #define CONFIG_SYS_MAX_FLASH_BANKS 1 /* max num of flash banks */ 101 #define CONFIG_SYS_MAX_FLASH_BANKS 1 /* max num of flash banks */
102 #define CONFIG_SYS_MAX_FLASH_SECT 11 /* max num of sects on one chip */ 102 #define CONFIG_SYS_MAX_FLASH_SECT 11 /* max num of sects on one chip */
103 #define CONFIG_SYS_FLASH_BASE 0xfff80000 103 #define CONFIG_SYS_FLASH_BASE 0xfff80000
104 104
105 /* auto boot */ 105 /* auto boot */
106 106
107 /* 107 /*
108 * For booting Linux, the board info and command line data 108 * For booting Linux, the board info and command line data
109 * have to be in the first 8 MB of memory, since this is 109 * have to be in the first 8 MB of memory, since this is
110 * the maximum mapped by the Linux kernel during initialization. 110 * the maximum mapped by the Linux kernel during initialization.
111 */ 111 */
112 #define CONFIG_CMDLINE_TAG 1 /* enable passing of ATAGs */ 112 #define CONFIG_CMDLINE_TAG 1 /* enable passing of ATAGs */
113 #define CONFIG_INITRD_TAG 1 /* enable INITRD tag */ 113 #define CONFIG_INITRD_TAG 1 /* enable INITRD tag */
114 #define CONFIG_SETUP_MEMORY_TAGS 1 /* enable memory tag */ 114 #define CONFIG_SETUP_MEMORY_TAGS 1 /* enable memory tag */
115 115
116 #define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buff Size */ 116 #define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buff Size */
117 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE \ 117 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE \
118 +sizeof(CONFIG_SYS_PROMPT) + 16) /* Print Buff */ 118 +sizeof(CONFIG_SYS_PROMPT) + 16) /* Print Buff */
119 /* 119 /*
120 * Commands configuration 120 * Commands configuration
121 */ 121 */
122 122
123 /* 123 /*
124 * Network 124 * Network
125 */ 125 */
126 126
127 #ifdef CONFIG_CMD_NET 127 #ifdef CONFIG_CMD_NET
128 #define CONFIG_MVGBE /* Enable Marvell GbE Driver */ 128 #define CONFIG_MVGBE /* Enable Marvell GbE Driver */
129 #define CONFIG_MVGBE_PORTS {1} /* enable port 0 only */ 129 #define CONFIG_MVGBE_PORTS {1} /* enable port 0 only */
130 #define CONFIG_SKIP_LOCAL_MAC_RANDOMIZATION /* don't randomize MAC */ 130 #define CONFIG_SKIP_LOCAL_MAC_RANDOMIZATION /* don't randomize MAC */
131 #define CONFIG_PHY_BASE_ADR 0x8 131 #define CONFIG_PHY_BASE_ADR 0x8
132 #define CONFIG_RESET_PHY_R /* use reset_phy() to init mv8831116 PHY */ 132 #define CONFIG_RESET_PHY_R /* use reset_phy() to init mv8831116 PHY */
133 #define CONFIG_NETCONSOLE /* include NetConsole support */ 133 #define CONFIG_NETCONSOLE /* include NetConsole support */
134 #define CONFIG_MII /* expose smi ove miiphy interface */ 134 #define CONFIG_MII /* expose smi ove miiphy interface */
135 #define CONFIG_SYS_FAULT_ECHO_LINK_DOWN /* detect link using phy */ 135 #define CONFIG_SYS_FAULT_ECHO_LINK_DOWN /* detect link using phy */
136 #define CONFIG_ENV_OVERWRITE /* ethaddr can be reprogrammed */ 136 #define CONFIG_ENV_OVERWRITE /* ethaddr can be reprogrammed */
137 #endif 137 #endif
138 138
139 /* 139 /*
140 * IDE 140 * IDE
141 */ 141 */
142 #ifdef CONFIG_CMD_IDE 142 #ifdef CONFIG_IDE
143 #define __io 143 #define __io
144 #define CONFIG_IDE_PREINIT 144 #define CONFIG_IDE_PREINIT
145 /* ED Mini V has an IDE-compatible SATA connector for port 1 */ 145 /* ED Mini V has an IDE-compatible SATA connector for port 1 */
146 #define CONFIG_MVSATA_IDE 146 #define CONFIG_MVSATA_IDE
147 #define CONFIG_MVSATA_IDE_USE_PORT1 147 #define CONFIG_MVSATA_IDE_USE_PORT1
148 /* Needs byte-swapping for ATA data register */ 148 /* Needs byte-swapping for ATA data register */
149 #define CONFIG_IDE_SWAP_IO 149 #define CONFIG_IDE_SWAP_IO
150 /* Data, registers and alternate blocks are at the same offset */ 150 /* Data, registers and alternate blocks are at the same offset */
151 #define CONFIG_SYS_ATA_DATA_OFFSET (0x0100) 151 #define CONFIG_SYS_ATA_DATA_OFFSET (0x0100)
152 #define CONFIG_SYS_ATA_REG_OFFSET (0x0100) 152 #define CONFIG_SYS_ATA_REG_OFFSET (0x0100)
153 #define CONFIG_SYS_ATA_ALT_OFFSET (0x0100) 153 #define CONFIG_SYS_ATA_ALT_OFFSET (0x0100)
154 /* Each 8-bit ATA register is aligned to a 4-bytes address */ 154 /* Each 8-bit ATA register is aligned to a 4-bytes address */
155 #define CONFIG_SYS_ATA_STRIDE 4 155 #define CONFIG_SYS_ATA_STRIDE 4
156 /* Controller supports 48-bits LBA addressing */ 156 /* Controller supports 48-bits LBA addressing */
157 #define CONFIG_LBA48 157 #define CONFIG_LBA48
158 /* A single bus, a single device */ 158 /* A single bus, a single device */
159 #define CONFIG_SYS_IDE_MAXBUS 1 159 #define CONFIG_SYS_IDE_MAXBUS 1
160 #define CONFIG_SYS_IDE_MAXDEVICE 1 160 #define CONFIG_SYS_IDE_MAXDEVICE 1
161 /* ATA registers base is at SATA controller base */ 161 /* ATA registers base is at SATA controller base */
162 #define CONFIG_SYS_ATA_BASE_ADDR ORION5X_SATA_BASE 162 #define CONFIG_SYS_ATA_BASE_ADDR ORION5X_SATA_BASE
163 /* ATA bus 0 is orion5x port 1 on ED Mini V2 */ 163 /* ATA bus 0 is orion5x port 1 on ED Mini V2 */
164 #define CONFIG_SYS_ATA_IDE0_OFFSET ORION5X_SATA_PORT1_OFFSET 164 #define CONFIG_SYS_ATA_IDE0_OFFSET ORION5X_SATA_PORT1_OFFSET
165 /* end of IDE defines */ 165 /* end of IDE defines */
166 #endif /* CMD_IDE */ 166 #endif /* CMD_IDE */
167 167
168 /* 168 /*
169 * Common USB/EHCI configuration 169 * Common USB/EHCI configuration
170 */ 170 */
171 #ifdef CONFIG_CMD_USB 171 #ifdef CONFIG_CMD_USB
172 #define ORION5X_USB20_HOST_PORT_BASE ORION5X_USB20_PORT0_BASE 172 #define ORION5X_USB20_HOST_PORT_BASE ORION5X_USB20_PORT0_BASE
173 #define CONFIG_SUPPORT_VFAT 173 #define CONFIG_SUPPORT_VFAT
174 #endif /* CONFIG_CMD_USB */ 174 #endif /* CONFIG_CMD_USB */
175 175
176 /* 176 /*
177 * I2C related stuff 177 * I2C related stuff
178 */ 178 */
179 #ifdef CONFIG_CMD_I2C 179 #ifdef CONFIG_CMD_I2C
180 #define CONFIG_SYS_I2C 180 #define CONFIG_SYS_I2C
181 #define CONFIG_SYS_I2C_MVTWSI 181 #define CONFIG_SYS_I2C_MVTWSI
182 #define CONFIG_I2C_MVTWSI_BASE0 ORION5X_TWSI_BASE 182 #define CONFIG_I2C_MVTWSI_BASE0 ORION5X_TWSI_BASE
183 #define CONFIG_SYS_I2C_SLAVE 0x0 183 #define CONFIG_SYS_I2C_SLAVE 0x0
184 #define CONFIG_SYS_I2C_SPEED 100000 184 #define CONFIG_SYS_I2C_SPEED 100000
185 #endif 185 #endif
186 186
187 /* 187 /*
188 * Environment variables configurations 188 * Environment variables configurations
189 */ 189 */
190 #define CONFIG_ENV_IS_IN_FLASH 1 190 #define CONFIG_ENV_IS_IN_FLASH 1
191 #define CONFIG_ENV_SECT_SIZE 0x2000 /* 16K */ 191 #define CONFIG_ENV_SECT_SIZE 0x2000 /* 16K */
192 #define CONFIG_ENV_SIZE 0x2000 192 #define CONFIG_ENV_SIZE 0x2000
193 #define CONFIG_ENV_OFFSET 0x4000 /* env starts here */ 193 #define CONFIG_ENV_OFFSET 0x4000 /* env starts here */
194 194
195 /* 195 /*
196 * Size of malloc() pool 196 * Size of malloc() pool
197 */ 197 */
198 #define CONFIG_SYS_MALLOC_LEN (1024 * 256) /* 256kB for malloc() */ 198 #define CONFIG_SYS_MALLOC_LEN (1024 * 256) /* 256kB for malloc() */
199 199
200 /* 200 /*
201 * Other required minimal configurations 201 * Other required minimal configurations
202 */ 202 */
203 #define CONFIG_ARCH_CPU_INIT /* call arch_cpu_init() */ 203 #define CONFIG_ARCH_CPU_INIT /* call arch_cpu_init() */
204 #define CONFIG_NR_DRAM_BANKS 1 204 #define CONFIG_NR_DRAM_BANKS 1
205 205
206 #define CONFIG_SYS_LOAD_ADDR 0x00800000 206 #define CONFIG_SYS_LOAD_ADDR 0x00800000
207 #define CONFIG_SYS_MEMTEST_START 0x00400000 207 #define CONFIG_SYS_MEMTEST_START 0x00400000
208 #define CONFIG_SYS_MEMTEST_END 0x007fffff 208 #define CONFIG_SYS_MEMTEST_END 0x007fffff
209 #define CONFIG_SYS_RESET_ADDRESS 0xffff0000 209 #define CONFIG_SYS_RESET_ADDRESS 0xffff0000
210 #define CONFIG_SYS_MAXARGS 16 210 #define CONFIG_SYS_MAXARGS 16
211 211
212 /* Enable command line editing */ 212 /* Enable command line editing */
213 #define CONFIG_CMDLINE_EDITING 213 #define CONFIG_CMDLINE_EDITING
214 214
215 /* provide extensive help */ 215 /* provide extensive help */
216 #define CONFIG_SYS_LONGHELP 216 #define CONFIG_SYS_LONGHELP
217 217
218 /* additions for new relocation code, must be added to all boards */ 218 /* additions for new relocation code, must be added to all boards */
219 #define CONFIG_SYS_SDRAM_BASE 0 219 #define CONFIG_SYS_SDRAM_BASE 0
220 #define CONFIG_SYS_INIT_SP_ADDR \ 220 #define CONFIG_SYS_INIT_SP_ADDR \
221 (CONFIG_SYS_SDRAM_BASE + 0x1000 - GENERATED_GBL_DATA_SIZE) 221 (CONFIG_SYS_SDRAM_BASE + 0x1000 - GENERATED_GBL_DATA_SIZE)
222 222
223 #endif /* _CONFIG_EDMINIV2_H */ 223 #endif /* _CONFIG_EDMINIV2_H */
224 224
include/configs/ib62x0.h
1 /* 1 /*
2 * Copyright (C) 2011-2012 2 * Copyright (C) 2011-2012
3 * Gerald Kerma <dreagle@doukki.net> 3 * Gerald Kerma <dreagle@doukki.net>
4 * Luka Perkov <luka@openwrt.org> 4 * Luka Perkov <luka@openwrt.org>
5 * 5 *
6 * SPDX-License-Identifier: GPL-2.0+ 6 * SPDX-License-Identifier: GPL-2.0+
7 */ 7 */
8 8
9 #ifndef _CONFIG_IB62x0_H 9 #ifndef _CONFIG_IB62x0_H
10 #define _CONFIG_IB62x0_H 10 #define _CONFIG_IB62x0_H
11 11
12 /* 12 /*
13 * High level configuration options 13 * High level configuration options
14 */ 14 */
15 #define CONFIG_FEROCEON_88FR131 /* CPU Core subversion */ 15 #define CONFIG_FEROCEON_88FR131 /* CPU Core subversion */
16 #define CONFIG_KW88F6281 /* SOC Name */ 16 #define CONFIG_KW88F6281 /* SOC Name */
17 #define CONFIG_SKIP_LOWLEVEL_INIT /* disable board lowlevel_init */ 17 #define CONFIG_SKIP_LOWLEVEL_INIT /* disable board lowlevel_init */
18 18
19 /* Add target to build it automatically upon "make" */ 19 /* Add target to build it automatically upon "make" */
20 #define CONFIG_BUILD_TARGET "u-boot.kwb" 20 #define CONFIG_BUILD_TARGET "u-boot.kwb"
21 21
22 /* 22 /*
23 * Compression configuration 23 * Compression configuration
24 */ 24 */
25 #define CONFIG_BZIP2 25 #define CONFIG_BZIP2
26 #define CONFIG_LZMA 26 #define CONFIG_LZMA
27 27
28 /* 28 /*
29 * Commands configuration 29 * Commands configuration
30 */ 30 */
31 #define CONFIG_SYS_MVFS 31 #define CONFIG_SYS_MVFS
32 32
33 /* 33 /*
34 * mv-common.h should be defined after CMD configs since it used them 34 * mv-common.h should be defined after CMD configs since it used them
35 * to enable certain macros 35 * to enable certain macros
36 */ 36 */
37 #include "mv-common.h" 37 #include "mv-common.h"
38 38
39 /* 39 /*
40 * Environment variables configuration 40 * Environment variables configuration
41 */ 41 */
42 #ifdef CONFIG_CMD_NAND 42 #ifdef CONFIG_CMD_NAND
43 #define CONFIG_ENV_IS_IN_NAND 43 #define CONFIG_ENV_IS_IN_NAND
44 #define CONFIG_ENV_SECT_SIZE 0x20000 44 #define CONFIG_ENV_SECT_SIZE 0x20000
45 #else 45 #else
46 #define CONFIG_ENV_IS_NOWHERE 46 #define CONFIG_ENV_IS_NOWHERE
47 #endif 47 #endif
48 #define CONFIG_ENV_SIZE 0x20000 48 #define CONFIG_ENV_SIZE 0x20000
49 #define CONFIG_ENV_OFFSET 0xe0000 49 #define CONFIG_ENV_OFFSET 0xe0000
50 50
51 /* 51 /*
52 * Default environment variables 52 * Default environment variables
53 */ 53 */
54 #define CONFIG_BOOTCOMMAND \ 54 #define CONFIG_BOOTCOMMAND \
55 "setenv bootargs ${console} ${mtdparts} ${bootargs_root}; " \ 55 "setenv bootargs ${console} ${mtdparts} ${bootargs_root}; " \
56 "ubi part root; " \ 56 "ubi part root; " \
57 "ubifsmount ubi:rootfs; " \ 57 "ubifsmount ubi:rootfs; " \
58 "ubifsload 0x800000 ${kernel}; " \ 58 "ubifsload 0x800000 ${kernel}; " \
59 "ubifsload 0x700000 ${fdt}; " \ 59 "ubifsload 0x700000 ${fdt}; " \
60 "ubifsumount; " \ 60 "ubifsumount; " \
61 "fdt addr 0x700000; fdt resize; fdt chosen; " \ 61 "fdt addr 0x700000; fdt resize; fdt chosen; " \
62 "bootz 0x800000 - 0x700000" 62 "bootz 0x800000 - 0x700000"
63 63
64 #define CONFIG_MTDPARTS \ 64 #define CONFIG_MTDPARTS \
65 "mtdparts=orion_nand:" \ 65 "mtdparts=orion_nand:" \
66 "0xe0000@0x0(uboot)," \ 66 "0xe0000@0x0(uboot)," \
67 "0x20000@0xe0000(uboot_env)," \ 67 "0x20000@0xe0000(uboot_env)," \
68 "-@0x100000(root)\0" 68 "-@0x100000(root)\0"
69 69
70 #define CONFIG_EXTRA_ENV_SETTINGS \ 70 #define CONFIG_EXTRA_ENV_SETTINGS \
71 "console=console=ttyS0,115200\0" \ 71 "console=console=ttyS0,115200\0" \
72 "mtdids=nand0=orion_nand\0" \ 72 "mtdids=nand0=orion_nand\0" \
73 "mtdparts="CONFIG_MTDPARTS \ 73 "mtdparts="CONFIG_MTDPARTS \
74 "kernel=/boot/zImage\0" \ 74 "kernel=/boot/zImage\0" \
75 "fdt=/boot/ib62x0.dtb\0" \ 75 "fdt=/boot/ib62x0.dtb\0" \
76 "bootargs_root=ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs rw\0" 76 "bootargs_root=ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs rw\0"
77 77
78 /* 78 /*
79 * Ethernet driver configuration 79 * Ethernet driver configuration
80 */ 80 */
81 #ifdef CONFIG_CMD_NET 81 #ifdef CONFIG_CMD_NET
82 #define CONFIG_MVGBE_PORTS {1, 0} /* enable port 0 only */ 82 #define CONFIG_MVGBE_PORTS {1, 0} /* enable port 0 only */
83 #define CONFIG_PHY_BASE_ADR 0 83 #define CONFIG_PHY_BASE_ADR 0
84 #undef CONFIG_RESET_PHY_R 84 #undef CONFIG_RESET_PHY_R
85 #endif /* CONFIG_CMD_NET */ 85 #endif /* CONFIG_CMD_NET */
86 86
87 /* 87 /*
88 * SATA driver configuration 88 * SATA driver configuration
89 */ 89 */
90 #ifdef CONFIG_CMD_IDE 90 #ifdef CONFIG_IDE
91 #define __io 91 #define __io
92 #define CONFIG_IDE_PREINIT 92 #define CONFIG_IDE_PREINIT
93 #define CONFIG_MVSATA_IDE_USE_PORT0 93 #define CONFIG_MVSATA_IDE_USE_PORT0
94 #define CONFIG_MVSATA_IDE_USE_PORT1 94 #define CONFIG_MVSATA_IDE_USE_PORT1
95 #define CONFIG_SYS_ATA_IDE0_OFFSET MV_SATA_PORT0_OFFSET 95 #define CONFIG_SYS_ATA_IDE0_OFFSET MV_SATA_PORT0_OFFSET
96 #define CONFIG_SYS_ATA_IDE1_OFFSET MV_SATA_PORT1_OFFSET 96 #define CONFIG_SYS_ATA_IDE1_OFFSET MV_SATA_PORT1_OFFSET
97 #endif /* CONFIG_CMD_IDE */ 97 #endif /* CONFIG_IDE */
98 98
99 /* 99 /*
100 * RTC driver configuration 100 * RTC driver configuration
101 */ 101 */
102 #ifdef CONFIG_CMD_DATE 102 #ifdef CONFIG_CMD_DATE
103 #define CONFIG_RTC_MV 103 #define CONFIG_RTC_MV
104 #endif /* CONFIG_CMD_DATE */ 104 #endif /* CONFIG_CMD_DATE */
105 105
106 #endif /* _CONFIG_IB62x0_H */ 106 #endif /* _CONFIG_IB62x0_H */
107 107
include/configs/lsxl.h
1 /* 1 /*
2 * Copyright (c) 2012 Michael Walle 2 * Copyright (c) 2012 Michael Walle
3 * Michael Walle <michael@walle.cc> 3 * Michael Walle <michael@walle.cc>
4 * 4 *
5 * SPDX-License-Identifier: GPL-2.0+ 5 * SPDX-License-Identifier: GPL-2.0+
6 */ 6 */
7 7
8 #ifndef _CONFIG_LSXL_H 8 #ifndef _CONFIG_LSXL_H
9 #define _CONFIG_LSXL_H 9 #define _CONFIG_LSXL_H
10 10
11 /* 11 /*
12 * Version number information 12 * Version number information
13 */ 13 */
14 #if defined(CONFIG_LSCHLV2) 14 #if defined(CONFIG_LSCHLV2)
15 #define CONFIG_SYS_KWD_CONFIG $(CONFIG_BOARDDIR)/kwbimage-lschl.cfg 15 #define CONFIG_SYS_KWD_CONFIG $(CONFIG_BOARDDIR)/kwbimage-lschl.cfg
16 #define CONFIG_MACH_TYPE 3006 16 #define CONFIG_MACH_TYPE 3006
17 #define CONFIG_SYS_TCLK 166666667 /* 166 MHz */ 17 #define CONFIG_SYS_TCLK 166666667 /* 166 MHz */
18 #elif defined(CONFIG_LSXHL) 18 #elif defined(CONFIG_LSXHL)
19 #define CONFIG_SYS_KWD_CONFIG $(CONFIG_BOARDDIR)/kwbimage-lsxhl.cfg 19 #define CONFIG_SYS_KWD_CONFIG $(CONFIG_BOARDDIR)/kwbimage-lsxhl.cfg
20 #define CONFIG_MACH_TYPE 2663 20 #define CONFIG_MACH_TYPE 2663
21 /* CONFIG_SYS_TCLK is 200000000 by default */ 21 /* CONFIG_SYS_TCLK is 200000000 by default */
22 #else 22 #else
23 #error "unknown board" 23 #error "unknown board"
24 #endif 24 #endif
25 25
26 /* 26 /*
27 * General configuration options 27 * General configuration options
28 */ 28 */
29 #define CONFIG_FEROCEON_88FR131 /* CPU Core subversion */ 29 #define CONFIG_FEROCEON_88FR131 /* CPU Core subversion */
30 #define CONFIG_KW88F6281 /* SOC Name */ 30 #define CONFIG_KW88F6281 /* SOC Name */
31 31
32 #define CONFIG_SKIP_LOWLEVEL_INIT /* disable board lowlevel_init */ 32 #define CONFIG_SKIP_LOWLEVEL_INIT /* disable board lowlevel_init */
33 #define CONFIG_MISC_INIT_R 33 #define CONFIG_MISC_INIT_R
34 #define CONFIG_SHOW_BOOT_PROGRESS 34 #define CONFIG_SHOW_BOOT_PROGRESS
35 35
36 #define CONFIG_KIRKWOOD_GPIO 36 #define CONFIG_KIRKWOOD_GPIO
37 37
38 /* 38 /*
39 * Commands configuration 39 * Commands configuration
40 */ 40 */
41 41
42 /* 42 /*
43 * mv-common.h should be defined after CMD configs since it used them 43 * mv-common.h should be defined after CMD configs since it used them
44 * to enable certain macros 44 * to enable certain macros
45 */ 45 */
46 #include "mv-common.h" 46 #include "mv-common.h"
47 47
48 /* loading initramfs images without uimage header */ 48 /* loading initramfs images without uimage header */
49 #define CONFIG_SUPPORT_RAW_INITRD 49 #define CONFIG_SUPPORT_RAW_INITRD
50 50
51 /* ST M25P40 */ 51 /* ST M25P40 */
52 #undef CONFIG_ENV_SPI_MAX_HZ 52 #undef CONFIG_ENV_SPI_MAX_HZ
53 #define CONFIG_ENV_SPI_MAX_HZ 25000000 53 #define CONFIG_ENV_SPI_MAX_HZ 25000000
54 #undef CONFIG_SF_DEFAULT_SPEED 54 #undef CONFIG_SF_DEFAULT_SPEED
55 #define CONFIG_SF_DEFAULT_SPEED 25000000 55 #define CONFIG_SF_DEFAULT_SPEED 25000000
56 56
57 /* 57 /*
58 * Environment variables configurations 58 * Environment variables configurations
59 */ 59 */
60 #ifdef CONFIG_SPI_FLASH 60 #ifdef CONFIG_SPI_FLASH
61 #define CONFIG_SYS_MAX_FLASH_BANKS 1 61 #define CONFIG_SYS_MAX_FLASH_BANKS 1
62 #define CONFIG_SYS_MAX_FLASH_SECT 8 62 #define CONFIG_SYS_MAX_FLASH_SECT 8
63 #define CONFIG_ENV_IS_IN_SPI_FLASH 1 63 #define CONFIG_ENV_IS_IN_SPI_FLASH 1
64 #define CONFIG_ENV_SECT_SIZE 0x10000 /* 64K */ 64 #define CONFIG_ENV_SECT_SIZE 0x10000 /* 64K */
65 #else 65 #else
66 #define CONFIG_ENV_IS_NOWHERE 66 #define CONFIG_ENV_IS_NOWHERE
67 #endif 67 #endif
68 68
69 #define CONFIG_ENV_SIZE 0x10000 /* 64k */ 69 #define CONFIG_ENV_SIZE 0x10000 /* 64k */
70 #define CONFIG_ENV_OFFSET 0x70000 /* env starts here */ 70 #define CONFIG_ENV_OFFSET 0x70000 /* env starts here */
71 71
72 /* 72 /*
73 * Default environment variables 73 * Default environment variables
74 */ 74 */
75 #define CONFIG_LOADADDR 0x00800000 75 #define CONFIG_LOADADDR 0x00800000
76 #define CONFIG_BOOTCOMMAND "run bootcmd_${bootsource}" 76 #define CONFIG_BOOTCOMMAND "run bootcmd_${bootsource}"
77 #define CONFIG_BOOTARGS "console=ttyS0,115200 root=/dev/sda2" 77 #define CONFIG_BOOTARGS "console=ttyS0,115200 root=/dev/sda2"
78 78
79 #if defined(CONFIG_LSXHL) 79 #if defined(CONFIG_LSXHL)
80 #define CONFIG_FDTFILE "kirkwood-lsxhl.dtb" 80 #define CONFIG_FDTFILE "kirkwood-lsxhl.dtb"
81 #elif defined(CONFIG_LSCHLV2) 81 #elif defined(CONFIG_LSCHLV2)
82 #define CONFIG_FDTFILE "kirkwood-lschlv2.dtb" 82 #define CONFIG_FDTFILE "kirkwood-lschlv2.dtb"
83 #else 83 #else
84 #error "Unsupported board" 84 #error "Unsupported board"
85 #endif 85 #endif
86 86
87 #define CONFIG_EXTRA_ENV_SETTINGS \ 87 #define CONFIG_EXTRA_ENV_SETTINGS \
88 "bootsource=legacy\0" \ 88 "bootsource=legacy\0" \
89 "hdpart=0:1\0" \ 89 "hdpart=0:1\0" \
90 "kernel_addr=0x00800000\0" \ 90 "kernel_addr=0x00800000\0" \
91 "ramdisk_addr=0x01000000\0" \ 91 "ramdisk_addr=0x01000000\0" \
92 "fdt_addr=0x00ff0000\0" \ 92 "fdt_addr=0x00ff0000\0" \
93 "bootcmd_legacy=ide reset " \ 93 "bootcmd_legacy=ide reset " \
94 "&& load ide ${hdpart} ${kernel_addr} /uImage.buffalo " \ 94 "&& load ide ${hdpart} ${kernel_addr} /uImage.buffalo " \
95 "&& load ide ${hdpart} ${ramdisk_addr} /initrd.buffalo "\ 95 "&& load ide ${hdpart} ${ramdisk_addr} /initrd.buffalo "\
96 "&& bootm ${kernel_addr} ${ramdisk_addr}\0" \ 96 "&& bootm ${kernel_addr} ${ramdisk_addr}\0" \
97 "bootcmd_net=bootp ${kernel_addr} vmlinuz " \ 97 "bootcmd_net=bootp ${kernel_addr} vmlinuz " \
98 "&& tftpboot ${ramdisk_addr} initrd.img " \ 98 "&& tftpboot ${ramdisk_addr} initrd.img " \
99 "&& setenv ramdisk_len ${filesize} " \ 99 "&& setenv ramdisk_len ${filesize} " \
100 "&& tftpboot ${fdt_addr} " CONFIG_FDTFILE " " \ 100 "&& tftpboot ${fdt_addr} " CONFIG_FDTFILE " " \
101 "&& bootz ${kernel_addr} " \ 101 "&& bootz ${kernel_addr} " \
102 "${ramdisk_addr}:${ramdisk_len} ${fdt_addr}\0" \ 102 "${ramdisk_addr}:${ramdisk_len} ${fdt_addr}\0" \
103 "bootcmd_hdd=ide reset " \ 103 "bootcmd_hdd=ide reset " \
104 "&& load ide ${hdpart} ${kernel_addr} /vmlinuz " \ 104 "&& load ide ${hdpart} ${kernel_addr} /vmlinuz " \
105 "&& load ide ${hdpart} ${ramdisk_addr} /initrd.img " \ 105 "&& load ide ${hdpart} ${ramdisk_addr} /initrd.img " \
106 "&& setenv ramdisk_len ${filesize} " \ 106 "&& setenv ramdisk_len ${filesize} " \
107 "&& load ide ${hdpart} ${fdt_addr} /dtb " \ 107 "&& load ide ${hdpart} ${fdt_addr} /dtb " \
108 "&& bootz ${kernel_addr} " \ 108 "&& bootz ${kernel_addr} " \
109 "${ramdisk_addr}:${ramdisk_len} ${fdt_addr}\0" \ 109 "${ramdisk_addr}:${ramdisk_len} ${fdt_addr}\0" \
110 "bootcmd_usb=usb start " \ 110 "bootcmd_usb=usb start " \
111 "&& load usb 0:1 ${kernel_addr} /vmlinuz " \ 111 "&& load usb 0:1 ${kernel_addr} /vmlinuz " \
112 "&& load usb 0:1 ${ramdisk_addr} /initrd.img " \ 112 "&& load usb 0:1 ${ramdisk_addr} /initrd.img " \
113 "&& setenv ramdisk_len ${filesize} " \ 113 "&& setenv ramdisk_len ${filesize} " \
114 "&& load usb 0:1 ${fdt_addr} " CONFIG_FDTFILE " " \ 114 "&& load usb 0:1 ${fdt_addr} " CONFIG_FDTFILE " " \
115 "&& bootz ${kernel_addr} " \ 115 "&& bootz ${kernel_addr} " \
116 "${ramdisk_addr}:${ramdisk_len} ${fdt_addr}\0" \ 116 "${ramdisk_addr}:${ramdisk_len} ${fdt_addr}\0" \
117 "bootcmd_rescue=run config_nc_dhcp; run nc\0" \ 117 "bootcmd_rescue=run config_nc_dhcp; run nc\0" \
118 "eraseenv=sf probe 0 " \ 118 "eraseenv=sf probe 0 " \
119 "&& sf erase " __stringify(CONFIG_ENV_OFFSET) \ 119 "&& sf erase " __stringify(CONFIG_ENV_OFFSET) \
120 " +" __stringify(CONFIG_ENV_SIZE) "\0" \ 120 " +" __stringify(CONFIG_ENV_SIZE) "\0" \
121 "config_nc_dhcp=setenv autoload_old ${autoload}; " \ 121 "config_nc_dhcp=setenv autoload_old ${autoload}; " \
122 "setenv autoload no " \ 122 "setenv autoload no " \
123 "&& bootp " \ 123 "&& bootp " \
124 "&& setenv ncip " \ 124 "&& setenv ncip " \
125 "&& setenv autoload ${autoload_old}; " \ 125 "&& setenv autoload ${autoload_old}; " \
126 "setenv autoload_old\0" \ 126 "setenv autoload_old\0" \
127 "standard_env=setenv ipaddr; setenv netmask; setenv serverip; " \ 127 "standard_env=setenv ipaddr; setenv netmask; setenv serverip; " \
128 "setenv ncip; setenv gatewayip; setenv ethact; " \ 128 "setenv ncip; setenv gatewayip; setenv ethact; " \
129 "setenv bootfile; setenv dnsip; " \ 129 "setenv bootfile; setenv dnsip; " \
130 "setenv bootsource legacy; run ser\0" \ 130 "setenv bootsource legacy; run ser\0" \
131 "restore_env=run standard_env; saveenv; reset\0" \ 131 "restore_env=run standard_env; saveenv; reset\0" \
132 "ser=setenv stdin serial; setenv stdout serial; " \ 132 "ser=setenv stdin serial; setenv stdout serial; " \
133 "setenv stderr serial\0" \ 133 "setenv stderr serial\0" \
134 "nc=setenv stdin nc; setenv stdout nc; setenv stderr nc\0" \ 134 "nc=setenv stdin nc; setenv stdout nc; setenv stderr nc\0" \
135 "stdin=serial\0" \ 135 "stdin=serial\0" \
136 "stdout=serial\0" \ 136 "stdout=serial\0" \
137 "stderr=serial\0" 137 "stderr=serial\0"
138 138
139 /* 139 /*
140 * Ethernet Driver configuration 140 * Ethernet Driver configuration
141 */ 141 */
142 #ifdef CONFIG_CMD_NET 142 #ifdef CONFIG_CMD_NET
143 #define CONFIG_MVGBE_PORTS {0, 1} /* enable port 1 only */ 143 #define CONFIG_MVGBE_PORTS {0, 1} /* enable port 1 only */
144 #define CONFIG_PHY_BASE_ADR 7 144 #define CONFIG_PHY_BASE_ADR 7
145 #undef CONFIG_RESET_PHY_R 145 #undef CONFIG_RESET_PHY_R
146 #endif /* CONFIG_CMD_NET */ 146 #endif /* CONFIG_CMD_NET */
147 147
148 #ifdef CONFIG_CMD_IDE 148 #ifdef CONFIG_IDE
149 #undef CONFIG_IDE_LED 149 #undef CONFIG_IDE_LED
150 #undef CONFIG_SYS_IDE_MAXBUS 150 #undef CONFIG_SYS_IDE_MAXBUS
151 #define CONFIG_SYS_IDE_MAXBUS 1 151 #define CONFIG_SYS_IDE_MAXBUS 1
152 #undef CONFIG_SYS_IDE_MAXDEVICE 152 #undef CONFIG_SYS_IDE_MAXDEVICE
153 #define CONFIG_SYS_IDE_MAXDEVICE 1 153 #define CONFIG_SYS_IDE_MAXDEVICE 1
154 #define CONFIG_SYS_ATA_IDE0_OFFSET MV_SATA_PORT0_OFFSET 154 #define CONFIG_SYS_ATA_IDE0_OFFSET MV_SATA_PORT0_OFFSET
155 #define CONFIG_SYS_64BIT_LBA 155 #define CONFIG_SYS_64BIT_LBA
156 #endif 156 #endif
157 157
158 #endif /* _CONFIG_LSXL_H */ 158 #endif /* _CONFIG_LSXL_H */
159 159
include/configs/mpc5121ads.h
1 /* 1 /*
2 * (C) Copyright 2007-2009 DENX Software Engineering 2 * (C) Copyright 2007-2009 DENX Software Engineering
3 * 3 *
4 * SPDX-License-Identifier: GPL-2.0+ 4 * SPDX-License-Identifier: GPL-2.0+
5 */ 5 */
6 6
7 /* 7 /*
8 * MPC5121ADS board configuration file 8 * MPC5121ADS board configuration file
9 */ 9 */
10 10
11 #ifndef __CONFIG_H 11 #ifndef __CONFIG_H
12 #define __CONFIG_H 12 #define __CONFIG_H
13 13
14 #define CONFIG_MPC5121ADS 1 14 #define CONFIG_MPC5121ADS 1
15 15
16 /* 16 /*
17 * Memory map for the MPC5121ADS board: 17 * Memory map for the MPC5121ADS board:
18 * 18 *
19 * 0x0000_0000 - 0x0FFF_FFFF DDR RAM (256 MB) 19 * 0x0000_0000 - 0x0FFF_FFFF DDR RAM (256 MB)
20 * 0x3000_0000 - 0x3001_FFFF SRAM (128 KB) 20 * 0x3000_0000 - 0x3001_FFFF SRAM (128 KB)
21 * 0x8000_0000 - 0x803F_FFFF IMMR (4 MB) 21 * 0x8000_0000 - 0x803F_FFFF IMMR (4 MB)
22 * 0x8200_0000 - 0x8200_001F CPLD (32 B) 22 * 0x8200_0000 - 0x8200_001F CPLD (32 B)
23 * 0x8400_0000 - 0x82FF_FFFF PCI I/O space (16 MB) 23 * 0x8400_0000 - 0x82FF_FFFF PCI I/O space (16 MB)
24 * 0xA000_0000 - 0xAFFF_FFFF PCI memory space (256 MB) 24 * 0xA000_0000 - 0xAFFF_FFFF PCI memory space (256 MB)
25 * 0xB000_0000 - 0xBFFF_FFFF PCI memory mapped I/O space (256 MB) 25 * 0xB000_0000 - 0xBFFF_FFFF PCI memory mapped I/O space (256 MB)
26 * 0xFC00_0000 - 0xFFFF_FFFF NOR Boot FLASH (64 MB) 26 * 0xFC00_0000 - 0xFFFF_FFFF NOR Boot FLASH (64 MB)
27 */ 27 */
28 28
29 /* 29 /*
30 * High Level Configuration Options 30 * High Level Configuration Options
31 */ 31 */
32 #define CONFIG_E300 1 /* E300 Family */ 32 #define CONFIG_E300 1 /* E300 Family */
33 33
34 #define CONFIG_SYS_TEXT_BASE 0xFFF00000 34 #define CONFIG_SYS_TEXT_BASE 0xFFF00000
35 35
36 /* video */ 36 /* video */
37 #ifdef CONFIG_FSL_DIU_FB 37 #ifdef CONFIG_FSL_DIU_FB
38 #define CONFIG_SYS_DIU_ADDR (CONFIG_SYS_IMMR + 0x2100) 38 #define CONFIG_SYS_DIU_ADDR (CONFIG_SYS_IMMR + 0x2100)
39 #define CONFIG_VIDEO_LOGO 39 #define CONFIG_VIDEO_LOGO
40 #define CONFIG_VIDEO_BMP_LOGO 40 #define CONFIG_VIDEO_BMP_LOGO
41 #endif 41 #endif
42 42
43 /* CONFIG_PCI is defined at config time */ 43 /* CONFIG_PCI is defined at config time */
44 44
45 #ifdef CONFIG_MPC5121ADS_REV2 45 #ifdef CONFIG_MPC5121ADS_REV2
46 #define CONFIG_SYS_MPC512X_CLKIN 66000000 /* in Hz */ 46 #define CONFIG_SYS_MPC512X_CLKIN 66000000 /* in Hz */
47 #else 47 #else
48 #define CONFIG_SYS_MPC512X_CLKIN 33333333 /* in Hz */ 48 #define CONFIG_SYS_MPC512X_CLKIN 33333333 /* in Hz */
49 #endif 49 #endif
50 50
51 #define CONFIG_MISC_INIT_R 51 #define CONFIG_MISC_INIT_R
52 52
53 #define CONFIG_SYS_IMMR 0x80000000 53 #define CONFIG_SYS_IMMR 0x80000000
54 54
55 #define CONFIG_SYS_MEMTEST_START 0x00200000 /* memtest region */ 55 #define CONFIG_SYS_MEMTEST_START 0x00200000 /* memtest region */
56 #define CONFIG_SYS_MEMTEST_END 0x00400000 56 #define CONFIG_SYS_MEMTEST_END 0x00400000
57 57
58 /* 58 /*
59 * DDR Setup - manually set all parameters as there's no SPD etc. 59 * DDR Setup - manually set all parameters as there's no SPD etc.
60 */ 60 */
61 #ifdef CONFIG_MPC5121ADS_REV2 61 #ifdef CONFIG_MPC5121ADS_REV2
62 #define CONFIG_SYS_DDR_SIZE 256 /* MB */ 62 #define CONFIG_SYS_DDR_SIZE 256 /* MB */
63 #else 63 #else
64 #define CONFIG_SYS_DDR_SIZE 512 /* MB */ 64 #define CONFIG_SYS_DDR_SIZE 512 /* MB */
65 #endif 65 #endif
66 #define CONFIG_SYS_DDR_BASE 0x00000000 /* DDR is system memory*/ 66 #define CONFIG_SYS_DDR_BASE 0x00000000 /* DDR is system memory*/
67 #define CONFIG_SYS_SDRAM_BASE CONFIG_SYS_DDR_BASE 67 #define CONFIG_SYS_SDRAM_BASE CONFIG_SYS_DDR_BASE
68 #define CONFIG_SYS_MAX_RAM_SIZE 0x20000000 68 #define CONFIG_SYS_MAX_RAM_SIZE 0x20000000
69 69
70 #define CONFIG_SYS_IOCTRL_MUX_DDR 0x00000036 70 #define CONFIG_SYS_IOCTRL_MUX_DDR 0x00000036
71 71
72 /* DDR Controller Configuration 72 /* DDR Controller Configuration
73 * 73 *
74 * SYS_CFG: 74 * SYS_CFG:
75 * [31:31] MDDRC Soft Reset: Diabled 75 * [31:31] MDDRC Soft Reset: Diabled
76 * [30:30] DRAM CKE pin: Enabled 76 * [30:30] DRAM CKE pin: Enabled
77 * [29:29] DRAM CLK: Enabled 77 * [29:29] DRAM CLK: Enabled
78 * [28:28] Command Mode: Enabled (For initialization only) 78 * [28:28] Command Mode: Enabled (For initialization only)
79 * [27:25] DRAM Row Select: dram_row[15:0] = magenta_address[25:10] 79 * [27:25] DRAM Row Select: dram_row[15:0] = magenta_address[25:10]
80 * [24:21] DRAM Bank Select: dram_bank[1:0] = magenta_address[11:10] 80 * [24:21] DRAM Bank Select: dram_bank[1:0] = magenta_address[11:10]
81 * [20:19] Read Test: DON'T USE 81 * [20:19] Read Test: DON'T USE
82 * [18:18] Self Refresh: Enabled 82 * [18:18] Self Refresh: Enabled
83 * [17:17] 16bit Mode: Disabled 83 * [17:17] 16bit Mode: Disabled
84 * [16:13] Ready Delay: 2 84 * [16:13] Ready Delay: 2
85 * [12:12] Half DQS Delay: Disabled 85 * [12:12] Half DQS Delay: Disabled
86 * [11:11] Quarter DQS Delay: Disabled 86 * [11:11] Quarter DQS Delay: Disabled
87 * [10:08] Write Delay: 2 87 * [10:08] Write Delay: 2
88 * [07:07] Early ODT: Disabled 88 * [07:07] Early ODT: Disabled
89 * [06:06] On DIE Termination: Disabled 89 * [06:06] On DIE Termination: Disabled
90 * [05:05] FIFO Overflow Clear: DON'T USE here 90 * [05:05] FIFO Overflow Clear: DON'T USE here
91 * [04:04] FIFO Underflow Clear: DON'T USE here 91 * [04:04] FIFO Underflow Clear: DON'T USE here
92 * [03:03] FIFO Overflow Pending: DON'T USE here 92 * [03:03] FIFO Overflow Pending: DON'T USE here
93 * [02:02] FIFO Underlfow Pending: DON'T USE here 93 * [02:02] FIFO Underlfow Pending: DON'T USE here
94 * [01:01] FIFO Overlfow Enabled: Enabled 94 * [01:01] FIFO Overlfow Enabled: Enabled
95 * [00:00] FIFO Underflow Enabled: Enabled 95 * [00:00] FIFO Underflow Enabled: Enabled
96 * TIME_CFG0 96 * TIME_CFG0
97 * [31:16] DRAM Refresh Time: 0 CSB clocks 97 * [31:16] DRAM Refresh Time: 0 CSB clocks
98 * [15:8] DRAM Command Time: 0 CSB clocks 98 * [15:8] DRAM Command Time: 0 CSB clocks
99 * [07:00] DRAM Precharge Time: 0 CSB clocks 99 * [07:00] DRAM Precharge Time: 0 CSB clocks
100 * TIME_CFG1 100 * TIME_CFG1
101 * [31:26] DRAM tRFC: 101 * [31:26] DRAM tRFC:
102 * [25:21] DRAM tWR1: 102 * [25:21] DRAM tWR1:
103 * [20:17] DRAM tWRT1: 103 * [20:17] DRAM tWRT1:
104 * [16:11] DRAM tDRR: 104 * [16:11] DRAM tDRR:
105 * [10:05] DRAM tRC: 105 * [10:05] DRAM tRC:
106 * [04:00] DRAM tRAS: 106 * [04:00] DRAM tRAS:
107 * TIME_CFG2 107 * TIME_CFG2
108 * [31:28] DRAM tRCD: 108 * [31:28] DRAM tRCD:
109 * [27:23] DRAM tFAW: 109 * [27:23] DRAM tFAW:
110 * [22:19] DRAM tRTW1: 110 * [22:19] DRAM tRTW1:
111 * [18:15] DRAM tCCD: 111 * [18:15] DRAM tCCD:
112 * [14:10] DRAM tRTP: 112 * [14:10] DRAM tRTP:
113 * [09:05] DRAM tRP: 113 * [09:05] DRAM tRP:
114 * [04:00] DRAM tRPA 114 * [04:00] DRAM tRPA
115 */ 115 */
116 #ifdef CONFIG_MPC5121ADS_REV2 116 #ifdef CONFIG_MPC5121ADS_REV2
117 #define CONFIG_SYS_MDDRC_SYS_CFG 0xE8604A00 117 #define CONFIG_SYS_MDDRC_SYS_CFG 0xE8604A00
118 #define CONFIG_SYS_MDDRC_TIME_CFG1 0x54EC1168 118 #define CONFIG_SYS_MDDRC_TIME_CFG1 0x54EC1168
119 #define CONFIG_SYS_MDDRC_TIME_CFG2 0x35210864 119 #define CONFIG_SYS_MDDRC_TIME_CFG2 0x35210864
120 #else 120 #else
121 #define CONFIG_SYS_MDDRC_SYS_CFG 0xEA804A00 121 #define CONFIG_SYS_MDDRC_SYS_CFG 0xEA804A00
122 #define CONFIG_SYS_MDDRC_TIME_CFG1 0x68EC1168 122 #define CONFIG_SYS_MDDRC_TIME_CFG1 0x68EC1168
123 #define CONFIG_SYS_MDDRC_TIME_CFG2 0x34310864 123 #define CONFIG_SYS_MDDRC_TIME_CFG2 0x34310864
124 #endif 124 #endif
125 #define CONFIG_SYS_MDDRC_TIME_CFG0 0x06183D2E 125 #define CONFIG_SYS_MDDRC_TIME_CFG0 0x06183D2E
126 126
127 #define CONFIG_SYS_MDDRC_SYS_CFG_ELPIDA 0xEA802B00 127 #define CONFIG_SYS_MDDRC_SYS_CFG_ELPIDA 0xEA802B00
128 #define CONFIG_SYS_MDDRC_TIME_CFG1_ELPIDA 0x690e1189 128 #define CONFIG_SYS_MDDRC_TIME_CFG1_ELPIDA 0x690e1189
129 #define CONFIG_SYS_MDDRC_TIME_CFG2_ELPIDA 0x35310864 129 #define CONFIG_SYS_MDDRC_TIME_CFG2_ELPIDA 0x35310864
130 130
131 #define CONFIG_SYS_DDRCMD_NOP 0x01380000 131 #define CONFIG_SYS_DDRCMD_NOP 0x01380000
132 #define CONFIG_SYS_DDRCMD_PCHG_ALL 0x01100400 132 #define CONFIG_SYS_DDRCMD_PCHG_ALL 0x01100400
133 #define CONFIG_SYS_DDRCMD_EM2 0x01020000 133 #define CONFIG_SYS_DDRCMD_EM2 0x01020000
134 #define CONFIG_SYS_DDRCMD_EM3 0x01030000 134 #define CONFIG_SYS_DDRCMD_EM3 0x01030000
135 #define CONFIG_SYS_DDRCMD_EN_DLL 0x01010000 135 #define CONFIG_SYS_DDRCMD_EN_DLL 0x01010000
136 #define CONFIG_SYS_DDRCMD_RFSH 0x01080000 136 #define CONFIG_SYS_DDRCMD_RFSH 0x01080000
137 137
138 #define DDRCMD_EMR_OCD(pr, ohm) ( \ 138 #define DDRCMD_EMR_OCD(pr, ohm) ( \
139 (1 << 24) | /* MDDRC Command Request */ \ 139 (1 << 24) | /* MDDRC Command Request */ \
140 (1 << 16) | /* MODE Reg BA[2:0] */ \ 140 (1 << 16) | /* MODE Reg BA[2:0] */ \
141 (0 << 12) | /* Outputs 0=Enabled */ \ 141 (0 << 12) | /* Outputs 0=Enabled */ \
142 (0 << 11) | /* RDQS */ \ 142 (0 << 11) | /* RDQS */ \
143 (1 << 10) | /* DQS# */ \ 143 (1 << 10) | /* DQS# */ \
144 (pr << 7) | /* OCD prog 7=deflt,0=exit */ \ 144 (pr << 7) | /* OCD prog 7=deflt,0=exit */ \
145 /* ODT Rtt[1:0] 0=0,1=75,2=150,3=50 */ \ 145 /* ODT Rtt[1:0] 0=0,1=75,2=150,3=50 */ \
146 ((ohm & 0x2) << 5)| /* Rtt1 */ \ 146 ((ohm & 0x2) << 5)| /* Rtt1 */ \
147 (0 << 3) | /* additive posted CAS# */ \ 147 (0 << 3) | /* additive posted CAS# */ \
148 ((ohm & 0x1) << 2)| /* Rtt0 */ \ 148 ((ohm & 0x1) << 2)| /* Rtt0 */ \
149 (0 << 0) | /* Output Drive Strength */ \ 149 (0 << 0) | /* Output Drive Strength */ \
150 (0 << 0)) /* DLL Enable 0=Normal */ 150 (0 << 0)) /* DLL Enable 0=Normal */
151 151
152 #define CONFIG_SYS_DDRCMD_OCD_DEFAULT DDRCMD_EMR_OCD(7, 0) 152 #define CONFIG_SYS_DDRCMD_OCD_DEFAULT DDRCMD_EMR_OCD(7, 0)
153 #define CONFIG_SYS_ELPIDA_OCD_EXIT DDRCMD_EMR_OCD(0, 0) 153 #define CONFIG_SYS_ELPIDA_OCD_EXIT DDRCMD_EMR_OCD(0, 0)
154 154
155 #define DDRCMD_MODE_REG(cas, wr) ( \ 155 #define DDRCMD_MODE_REG(cas, wr) ( \
156 (1 << 24) | /* MDDRC Command Request */ \ 156 (1 << 24) | /* MDDRC Command Request */ \
157 (0 << 16) | /* MODE Reg BA[2:0] */ \ 157 (0 << 16) | /* MODE Reg BA[2:0] */ \
158 ((wr-1) << 9)| /* Write Recovery */ \ 158 ((wr-1) << 9)| /* Write Recovery */ \
159 (cas << 4) | /* CAS */ \ 159 (cas << 4) | /* CAS */ \
160 (0 << 3) | /* Burst Type:0=Sequential,1=Interleaved */ \ 160 (0 << 3) | /* Burst Type:0=Sequential,1=Interleaved */ \
161 (2 << 0)) /* 4 or 8 Burst Length:0x2=4 0x3=8 */ 161 (2 << 0)) /* 4 or 8 Burst Length:0x2=4 0x3=8 */
162 162
163 #define CONFIG_SYS_MICRON_INIT_DEV_OP DDRCMD_MODE_REG(3, 3) 163 #define CONFIG_SYS_MICRON_INIT_DEV_OP DDRCMD_MODE_REG(3, 3)
164 #define CONFIG_SYS_ELPIDA_INIT_DEV_OP DDRCMD_MODE_REG(4, 4) 164 #define CONFIG_SYS_ELPIDA_INIT_DEV_OP DDRCMD_MODE_REG(4, 4)
165 #define CONFIG_SYS_ELPIDA_RES_DLL (DDRCMD_MODE_REG(4, 4) | (1 << 8)) 165 #define CONFIG_SYS_ELPIDA_RES_DLL (DDRCMD_MODE_REG(4, 4) | (1 << 8))
166 166
167 /* DDR Priority Manager Configuration */ 167 /* DDR Priority Manager Configuration */
168 #define CONFIG_SYS_MDDRCGRP_PM_CFG1 0x00077777 168 #define CONFIG_SYS_MDDRCGRP_PM_CFG1 0x00077777
169 #define CONFIG_SYS_MDDRCGRP_PM_CFG2 0x00000000 169 #define CONFIG_SYS_MDDRCGRP_PM_CFG2 0x00000000
170 #define CONFIG_SYS_MDDRCGRP_HIPRIO_CFG 0x00000001 170 #define CONFIG_SYS_MDDRCGRP_HIPRIO_CFG 0x00000001
171 #define CONFIG_SYS_MDDRCGRP_LUT0_MU 0xFFEEDDCC 171 #define CONFIG_SYS_MDDRCGRP_LUT0_MU 0xFFEEDDCC
172 #define CONFIG_SYS_MDDRCGRP_LUT0_ML 0xBBAAAAAA 172 #define CONFIG_SYS_MDDRCGRP_LUT0_ML 0xBBAAAAAA
173 #define CONFIG_SYS_MDDRCGRP_LUT1_MU 0x66666666 173 #define CONFIG_SYS_MDDRCGRP_LUT1_MU 0x66666666
174 #define CONFIG_SYS_MDDRCGRP_LUT1_ML 0x55555555 174 #define CONFIG_SYS_MDDRCGRP_LUT1_ML 0x55555555
175 #define CONFIG_SYS_MDDRCGRP_LUT2_MU 0x44444444 175 #define CONFIG_SYS_MDDRCGRP_LUT2_MU 0x44444444
176 #define CONFIG_SYS_MDDRCGRP_LUT2_ML 0x44444444 176 #define CONFIG_SYS_MDDRCGRP_LUT2_ML 0x44444444
177 #define CONFIG_SYS_MDDRCGRP_LUT3_MU 0x55555555 177 #define CONFIG_SYS_MDDRCGRP_LUT3_MU 0x55555555
178 #define CONFIG_SYS_MDDRCGRP_LUT3_ML 0x55555558 178 #define CONFIG_SYS_MDDRCGRP_LUT3_ML 0x55555558
179 #define CONFIG_SYS_MDDRCGRP_LUT4_MU 0x11111111 179 #define CONFIG_SYS_MDDRCGRP_LUT4_MU 0x11111111
180 #define CONFIG_SYS_MDDRCGRP_LUT4_ML 0x11111122 180 #define CONFIG_SYS_MDDRCGRP_LUT4_ML 0x11111122
181 #define CONFIG_SYS_MDDRCGRP_LUT0_AU 0xaaaaaaaa 181 #define CONFIG_SYS_MDDRCGRP_LUT0_AU 0xaaaaaaaa
182 #define CONFIG_SYS_MDDRCGRP_LUT0_AL 0xaaaaaaaa 182 #define CONFIG_SYS_MDDRCGRP_LUT0_AL 0xaaaaaaaa
183 #define CONFIG_SYS_MDDRCGRP_LUT1_AU 0x66666666 183 #define CONFIG_SYS_MDDRCGRP_LUT1_AU 0x66666666
184 #define CONFIG_SYS_MDDRCGRP_LUT1_AL 0x66666666 184 #define CONFIG_SYS_MDDRCGRP_LUT1_AL 0x66666666
185 #define CONFIG_SYS_MDDRCGRP_LUT2_AU 0x11111111 185 #define CONFIG_SYS_MDDRCGRP_LUT2_AU 0x11111111
186 #define CONFIG_SYS_MDDRCGRP_LUT2_AL 0x11111111 186 #define CONFIG_SYS_MDDRCGRP_LUT2_AL 0x11111111
187 #define CONFIG_SYS_MDDRCGRP_LUT3_AU 0x11111111 187 #define CONFIG_SYS_MDDRCGRP_LUT3_AU 0x11111111
188 #define CONFIG_SYS_MDDRCGRP_LUT3_AL 0x11111111 188 #define CONFIG_SYS_MDDRCGRP_LUT3_AL 0x11111111
189 #define CONFIG_SYS_MDDRCGRP_LUT4_AU 0x11111111 189 #define CONFIG_SYS_MDDRCGRP_LUT4_AU 0x11111111
190 #define CONFIG_SYS_MDDRCGRP_LUT4_AL 0x11111111 190 #define CONFIG_SYS_MDDRCGRP_LUT4_AL 0x11111111
191 191
192 /* 192 /*
193 * NOR FLASH on the Local Bus 193 * NOR FLASH on the Local Bus
194 */ 194 */
195 #undef CONFIG_BKUP_FLASH 195 #undef CONFIG_BKUP_FLASH
196 #define CONFIG_SYS_FLASH_CFI /* use the Common Flash Interface */ 196 #define CONFIG_SYS_FLASH_CFI /* use the Common Flash Interface */
197 #define CONFIG_FLASH_CFI_DRIVER /* use the CFI driver */ 197 #define CONFIG_FLASH_CFI_DRIVER /* use the CFI driver */
198 #ifdef CONFIG_BKUP_FLASH 198 #ifdef CONFIG_BKUP_FLASH
199 #define CONFIG_SYS_FLASH_BASE 0xFF800000 /* start of FLASH */ 199 #define CONFIG_SYS_FLASH_BASE 0xFF800000 /* start of FLASH */
200 #define CONFIG_SYS_FLASH_SIZE 0x00800000 /* max flash size in bytes */ 200 #define CONFIG_SYS_FLASH_SIZE 0x00800000 /* max flash size in bytes */
201 #else 201 #else
202 #define CONFIG_SYS_FLASH_BASE 0xFC000000 /* start of FLASH */ 202 #define CONFIG_SYS_FLASH_BASE 0xFC000000 /* start of FLASH */
203 #define CONFIG_SYS_FLASH_SIZE 0x04000000 /* max flash size in bytes */ 203 #define CONFIG_SYS_FLASH_SIZE 0x04000000 /* max flash size in bytes */
204 #endif 204 #endif
205 #define CONFIG_SYS_FLASH_USE_BUFFER_WRITE 205 #define CONFIG_SYS_FLASH_USE_BUFFER_WRITE
206 #define CONFIG_SYS_MAX_FLASH_BANKS 1 /* number of banks */ 206 #define CONFIG_SYS_MAX_FLASH_BANKS 1 /* number of banks */
207 #define CONFIG_SYS_FLASH_BANKS_LIST {CONFIG_SYS_FLASH_BASE} 207 #define CONFIG_SYS_FLASH_BANKS_LIST {CONFIG_SYS_FLASH_BASE}
208 #define CONFIG_SYS_MAX_FLASH_SECT 256 /* max sectors per device */ 208 #define CONFIG_SYS_MAX_FLASH_SECT 256 /* max sectors per device */
209 209
210 #undef CONFIG_SYS_FLASH_CHECKSUM 210 #undef CONFIG_SYS_FLASH_CHECKSUM
211 211
212 /* 212 /*
213 * NAND FLASH 213 * NAND FLASH
214 * drivers/mtd/nand/mpc5121_nfc.c (rev 2 silicon only) 214 * drivers/mtd/nand/mpc5121_nfc.c (rev 2 silicon only)
215 */ 215 */
216 #define CONFIG_CMD_NAND /* enable NAND support */ 216 #define CONFIG_CMD_NAND /* enable NAND support */
217 #define CONFIG_JFFS2_NAND /* with JFFS2 on it */ 217 #define CONFIG_JFFS2_NAND /* with JFFS2 on it */
218 #define CONFIG_NAND_MPC5121_NFC 218 #define CONFIG_NAND_MPC5121_NFC
219 #define CONFIG_SYS_NAND_BASE 0x40000000 219 #define CONFIG_SYS_NAND_BASE 0x40000000
220 220
221 #define CONFIG_SYS_MAX_NAND_DEVICE 2 221 #define CONFIG_SYS_MAX_NAND_DEVICE 2
222 #define CONFIG_SYS_NAND_SELECT_DEVICE /* driver supports mutipl. chips */ 222 #define CONFIG_SYS_NAND_SELECT_DEVICE /* driver supports mutipl. chips */
223 223
224 /* 224 /*
225 * Configuration parameters for MPC5121 NAND driver 225 * Configuration parameters for MPC5121 NAND driver
226 */ 226 */
227 #define CONFIG_FSL_NFC_WIDTH 1 227 #define CONFIG_FSL_NFC_WIDTH 1
228 #define CONFIG_FSL_NFC_WRITE_SIZE 2048 228 #define CONFIG_FSL_NFC_WRITE_SIZE 2048
229 #define CONFIG_FSL_NFC_SPARE_SIZE 64 229 #define CONFIG_FSL_NFC_SPARE_SIZE 64
230 #define CONFIG_FSL_NFC_CHIPS CONFIG_SYS_MAX_NAND_DEVICE 230 #define CONFIG_FSL_NFC_CHIPS CONFIG_SYS_MAX_NAND_DEVICE
231 231
232 /* 232 /*
233 * CPLD registers area is really only 32 bytes in size, but the smallest possible LP 233 * CPLD registers area is really only 32 bytes in size, but the smallest possible LP
234 * window is 64KB 234 * window is 64KB
235 */ 235 */
236 #define CONFIG_SYS_CPLD_BASE 0x82000000 236 #define CONFIG_SYS_CPLD_BASE 0x82000000
237 #define CONFIG_SYS_CPLD_SIZE 0x00010000 /* 64 KB */ 237 #define CONFIG_SYS_CPLD_SIZE 0x00010000 /* 64 KB */
238 #define CONFIG_SYS_CS2_START CONFIG_SYS_CPLD_BASE 238 #define CONFIG_SYS_CS2_START CONFIG_SYS_CPLD_BASE
239 #define CONFIG_SYS_CS2_SIZE CONFIG_SYS_CPLD_SIZE 239 #define CONFIG_SYS_CS2_SIZE CONFIG_SYS_CPLD_SIZE
240 240
241 #define CONFIG_SYS_SRAM_BASE 0x30000000 241 #define CONFIG_SYS_SRAM_BASE 0x30000000
242 #define CONFIG_SYS_SRAM_SIZE 0x00020000 /* 128 KB */ 242 #define CONFIG_SYS_SRAM_SIZE 0x00020000 /* 128 KB */
243 243
244 #define CONFIG_SYS_CS0_CFG 0x05059310 /* ALE active low, data size 4bytes */ 244 #define CONFIG_SYS_CS0_CFG 0x05059310 /* ALE active low, data size 4bytes */
245 #define CONFIG_SYS_CS2_CFG 0x05059010 /* ALE active low, data size 1byte */ 245 #define CONFIG_SYS_CS2_CFG 0x05059010 /* ALE active low, data size 1byte */
246 #define CONFIG_SYS_CS_ALETIMING 0x00000005 /* Use alternative CS timing for CS0 and CS2 */ 246 #define CONFIG_SYS_CS_ALETIMING 0x00000005 /* Use alternative CS timing for CS0 and CS2 */
247 247
248 /* Use SRAM for initial stack */ 248 /* Use SRAM for initial stack */
249 #define CONFIG_SYS_INIT_RAM_ADDR CONFIG_SYS_SRAM_BASE /* Initial RAM address */ 249 #define CONFIG_SYS_INIT_RAM_ADDR CONFIG_SYS_SRAM_BASE /* Initial RAM address */
250 #define CONFIG_SYS_INIT_RAM_SIZE CONFIG_SYS_SRAM_SIZE /* Size of used area in RAM */ 250 #define CONFIG_SYS_INIT_RAM_SIZE CONFIG_SYS_SRAM_SIZE /* Size of used area in RAM */
251 251
252 #define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) 252 #define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
253 #define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_GBL_DATA_OFFSET 253 #define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_GBL_DATA_OFFSET
254 254
255 #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE /* Start of monitor */ 255 #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE /* Start of monitor */
256 #define CONFIG_SYS_MONITOR_LEN (512 * 1024) /* Reserve 512 kB for Mon */ 256 #define CONFIG_SYS_MONITOR_LEN (512 * 1024) /* Reserve 512 kB for Mon */
257 #ifdef CONFIG_FSL_DIU_FB 257 #ifdef CONFIG_FSL_DIU_FB
258 #define CONFIG_SYS_MALLOC_LEN (6 * 1024 * 1024) /* Reserved for malloc */ 258 #define CONFIG_SYS_MALLOC_LEN (6 * 1024 * 1024) /* Reserved for malloc */
259 #else 259 #else
260 #define CONFIG_SYS_MALLOC_LEN (512 * 1024) 260 #define CONFIG_SYS_MALLOC_LEN (512 * 1024)
261 #endif 261 #endif
262 262
263 /* 263 /*
264 * Serial Port 264 * Serial Port
265 */ 265 */
266 #define CONFIG_CONS_INDEX 1 266 #define CONFIG_CONS_INDEX 1
267 267
268 /* 268 /*
269 * Serial console configuration 269 * Serial console configuration
270 */ 270 */
271 #define CONFIG_PSC_CONSOLE 3 /* console is on PSC3 */ 271 #define CONFIG_PSC_CONSOLE 3 /* console is on PSC3 */
272 #define CONFIG_SYS_PSC3 272 #define CONFIG_SYS_PSC3
273 #if CONFIG_PSC_CONSOLE != 3 273 #if CONFIG_PSC_CONSOLE != 3
274 #error CONFIG_PSC_CONSOLE must be 3 274 #error CONFIG_PSC_CONSOLE must be 3
275 #endif 275 #endif
276 #define CONFIG_SYS_BAUDRATE_TABLE \ 276 #define CONFIG_SYS_BAUDRATE_TABLE \
277 {300, 600, 1200, 2400, 4800, 9600, 19200, 38400,115200} 277 {300, 600, 1200, 2400, 4800, 9600, 19200, 38400,115200}
278 278
279 #define CONSOLE_FIFO_TX_SIZE FIFOC_PSC3_TX_SIZE 279 #define CONSOLE_FIFO_TX_SIZE FIFOC_PSC3_TX_SIZE
280 #define CONSOLE_FIFO_TX_ADDR FIFOC_PSC3_TX_ADDR 280 #define CONSOLE_FIFO_TX_ADDR FIFOC_PSC3_TX_ADDR
281 #define CONSOLE_FIFO_RX_SIZE FIFOC_PSC3_RX_SIZE 281 #define CONSOLE_FIFO_RX_SIZE FIFOC_PSC3_RX_SIZE
282 #define CONSOLE_FIFO_RX_ADDR FIFOC_PSC3_RX_ADDR 282 #define CONSOLE_FIFO_RX_ADDR FIFOC_PSC3_RX_ADDR
283 283
284 #define CONFIG_CMDLINE_EDITING 1 /* add command line history */ 284 #define CONFIG_CMDLINE_EDITING 1 /* add command line history */
285 285
286 /* 286 /*
287 * Clocks in use 287 * Clocks in use
288 */ 288 */
289 #define SCCR1_CLOCKS_EN (CLOCK_SCCR1_CFG_EN | \ 289 #define SCCR1_CLOCKS_EN (CLOCK_SCCR1_CFG_EN | \
290 CLOCK_SCCR1_DDR_EN | \ 290 CLOCK_SCCR1_DDR_EN | \
291 CLOCK_SCCR1_FEC_EN | \ 291 CLOCK_SCCR1_FEC_EN | \
292 CLOCK_SCCR1_LPC_EN | \ 292 CLOCK_SCCR1_LPC_EN | \
293 CLOCK_SCCR1_NFC_EN | \ 293 CLOCK_SCCR1_NFC_EN | \
294 CLOCK_SCCR1_PATA_EN | \ 294 CLOCK_SCCR1_PATA_EN | \
295 CLOCK_SCCR1_PCI_EN | \ 295 CLOCK_SCCR1_PCI_EN | \
296 CLOCK_SCCR1_PSC_EN(CONFIG_PSC_CONSOLE) | \ 296 CLOCK_SCCR1_PSC_EN(CONFIG_PSC_CONSOLE) | \
297 CLOCK_SCCR1_PSCFIFO_EN | \ 297 CLOCK_SCCR1_PSCFIFO_EN | \
298 CLOCK_SCCR1_TPR_EN) 298 CLOCK_SCCR1_TPR_EN)
299 299
300 #define SCCR2_CLOCKS_EN (CLOCK_SCCR2_DIU_EN | \ 300 #define SCCR2_CLOCKS_EN (CLOCK_SCCR2_DIU_EN | \
301 CLOCK_SCCR2_I2C_EN | \ 301 CLOCK_SCCR2_I2C_EN | \
302 CLOCK_SCCR2_MEM_EN | \ 302 CLOCK_SCCR2_MEM_EN | \
303 CLOCK_SCCR2_SPDIF_EN | \ 303 CLOCK_SCCR2_SPDIF_EN | \
304 CLOCK_SCCR2_USB1_EN | \ 304 CLOCK_SCCR2_USB1_EN | \
305 CLOCK_SCCR2_USB2_EN) 305 CLOCK_SCCR2_USB2_EN)
306 306
307 /* 307 /*
308 * PCI 308 * PCI
309 */ 309 */
310 #ifdef CONFIG_PCI 310 #ifdef CONFIG_PCI
311 #define CONFIG_PCI_INDIRECT_BRIDGE 311 #define CONFIG_PCI_INDIRECT_BRIDGE
312 312
313 /* 313 /*
314 * General PCI 314 * General PCI
315 */ 315 */
316 #define CONFIG_SYS_PCI_MEM_BASE 0xA0000000 316 #define CONFIG_SYS_PCI_MEM_BASE 0xA0000000
317 #define CONFIG_SYS_PCI_MEM_PHYS CONFIG_SYS_PCI_MEM_BASE 317 #define CONFIG_SYS_PCI_MEM_PHYS CONFIG_SYS_PCI_MEM_BASE
318 #define CONFIG_SYS_PCI_MEM_SIZE 0x10000000 /* 256M */ 318 #define CONFIG_SYS_PCI_MEM_SIZE 0x10000000 /* 256M */
319 #define CONFIG_SYS_PCI_MMIO_BASE (CONFIG_SYS_PCI_MEM_BASE + CONFIG_SYS_PCI_MEM_SIZE) 319 #define CONFIG_SYS_PCI_MMIO_BASE (CONFIG_SYS_PCI_MEM_BASE + CONFIG_SYS_PCI_MEM_SIZE)
320 #define CONFIG_SYS_PCI_MMIO_PHYS CONFIG_SYS_PCI_MMIO_BASE 320 #define CONFIG_SYS_PCI_MMIO_PHYS CONFIG_SYS_PCI_MMIO_BASE
321 #define CONFIG_SYS_PCI_MMIO_SIZE 0x10000000 /* 256M */ 321 #define CONFIG_SYS_PCI_MMIO_SIZE 0x10000000 /* 256M */
322 #define CONFIG_SYS_PCI_IO_BASE 0x00000000 322 #define CONFIG_SYS_PCI_IO_BASE 0x00000000
323 #define CONFIG_SYS_PCI_IO_PHYS 0x84000000 323 #define CONFIG_SYS_PCI_IO_PHYS 0x84000000
324 #define CONFIG_SYS_PCI_IO_SIZE 0x01000000 /* 16M */ 324 #define CONFIG_SYS_PCI_IO_SIZE 0x01000000 /* 16M */
325 325
326 #define CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */ 326 #define CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */
327 327
328 #endif 328 #endif
329 329
330 /* 330 /*
331 * IIM - IC Identification Module 331 * IIM - IC Identification Module
332 */ 332 */
333 #undef CONFIG_FSL_IIM 333 #undef CONFIG_FSL_IIM
334 334
335 /* 335 /*
336 * Ethernet configuration 336 * Ethernet configuration
337 */ 337 */
338 #define CONFIG_MPC512x_FEC 1 338 #define CONFIG_MPC512x_FEC 1
339 #define CONFIG_PHY_ADDR 0x1 339 #define CONFIG_PHY_ADDR 0x1
340 #define CONFIG_MII 1 /* MII PHY management */ 340 #define CONFIG_MII 1 /* MII PHY management */
341 #define CONFIG_FEC_AN_TIMEOUT 1 341 #define CONFIG_FEC_AN_TIMEOUT 1
342 #define CONFIG_HAS_ETH0 342 #define CONFIG_HAS_ETH0
343 343
344 /* 344 /*
345 * Configure on-board RTC 345 * Configure on-board RTC
346 */ 346 */
347 #define CONFIG_RTC_M41T62 /* use M41T62 rtc via i2 */ 347 #define CONFIG_RTC_M41T62 /* use M41T62 rtc via i2 */
348 #define CONFIG_SYS_I2C_RTC_ADDR 0x68 /* at address 0x68 */ 348 #define CONFIG_SYS_I2C_RTC_ADDR 0x68 /* at address 0x68 */
349 349
350 /* 350 /*
351 * USB Support 351 * USB Support
352 */ 352 */
353 353
354 #if defined(CONFIG_CMD_USB) 354 #if defined(CONFIG_CMD_USB)
355 #define CONFIG_USB_EHCI_FSL /* On a FSL platform */ 355 #define CONFIG_USB_EHCI_FSL /* On a FSL platform */
356 #define CONFIG_EHCI_MMIO_BIG_ENDIAN /* With big-endian regs */ 356 #define CONFIG_EHCI_MMIO_BIG_ENDIAN /* With big-endian regs */
357 #define CONFIG_EHCI_DESC_BIG_ENDIAN 357 #define CONFIG_EHCI_DESC_BIG_ENDIAN
358 #define CONFIG_EHCI_IS_TDI 358 #define CONFIG_EHCI_IS_TDI
359 #endif 359 #endif
360 360
361 /* 361 /*
362 * Environment 362 * Environment
363 */ 363 */
364 #define CONFIG_ENV_IS_IN_FLASH 1 364 #define CONFIG_ENV_IS_IN_FLASH 1
365 /* This has to be a multiple of the Flash sector size */ 365 /* This has to be a multiple of the Flash sector size */
366 #define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) 366 #define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)
367 #define CONFIG_ENV_SIZE 0x2000 367 #define CONFIG_ENV_SIZE 0x2000
368 #ifdef CONFIG_BKUP_FLASH 368 #ifdef CONFIG_BKUP_FLASH
369 #define CONFIG_ENV_SECT_SIZE 0x20000 /* one sector (256K) for env */ 369 #define CONFIG_ENV_SECT_SIZE 0x20000 /* one sector (256K) for env */
370 #else 370 #else
371 #define CONFIG_ENV_SECT_SIZE 0x40000 /* one sector (256K) for env */ 371 #define CONFIG_ENV_SECT_SIZE 0x40000 /* one sector (256K) for env */
372 #endif 372 #endif
373 373
374 /* Address and size of Redundant Environment Sector */ 374 /* Address and size of Redundant Environment Sector */
375 #define CONFIG_ENV_ADDR_REDUND (CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE) 375 #define CONFIG_ENV_ADDR_REDUND (CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE)
376 #define CONFIG_ENV_SIZE_REDUND (CONFIG_ENV_SIZE) 376 #define CONFIG_ENV_SIZE_REDUND (CONFIG_ENV_SIZE)
377 377
378 #define CONFIG_LOADS_ECHO 1 /* echo on for serial download */ 378 #define CONFIG_LOADS_ECHO 1 /* echo on for serial download */
379 #define CONFIG_SYS_LOADS_BAUD_CHANGE 1 /* allow baudrate change */ 379 #define CONFIG_SYS_LOADS_BAUD_CHANGE 1 /* allow baudrate change */
380 380
381 #define CONFIG_CMD_JFFS2 381 #define CONFIG_CMD_JFFS2
382 #define CONFIG_CMD_REGINFO 382 #define CONFIG_CMD_REGINFO
383 383
384 #if defined(CONFIG_PCI) 384 #if defined(CONFIG_PCI)
385 #define CONFIG_CMD_PCI 385 #define CONFIG_CMD_PCI
386 #endif 386 #endif
387 387
388 /* 388 /*
389 * Dynamic MTD partition support 389 * Dynamic MTD partition support
390 */ 390 */
391 #define CONFIG_CMD_MTDPARTS 391 #define CONFIG_CMD_MTDPARTS
392 #define CONFIG_MTD_DEVICE /* needed for mtdparts commands */ 392 #define CONFIG_MTD_DEVICE /* needed for mtdparts commands */
393 #define CONFIG_FLASH_CFI_MTD 393 #define CONFIG_FLASH_CFI_MTD
394 #define MTDIDS_DEFAULT "nor0=fc000000.flash,nand0=mpc5121.nand" 394 #define MTDIDS_DEFAULT "nor0=fc000000.flash,nand0=mpc5121.nand"
395 395
396 /* 396 /*
397 * NOR flash layout: 397 * NOR flash layout:
398 * 398 *
399 * FC000000 - FEABFFFF 42.75 MiB User Data 399 * FC000000 - FEABFFFF 42.75 MiB User Data
400 * FEAC0000 - FFABFFFF 16 MiB Root File System 400 * FEAC0000 - FFABFFFF 16 MiB Root File System
401 * FFAC0000 - FFEBFFFF 4 MiB Linux Kernel 401 * FFAC0000 - FFEBFFFF 4 MiB Linux Kernel
402 * FFEC0000 - FFEFFFFF 256 KiB Device Tree 402 * FFEC0000 - FFEFFFFF 256 KiB Device Tree
403 * FFF00000 - FFFFFFFF 1 MiB U-Boot (up to 512 KiB) and 2 x * env 403 * FFF00000 - FFFFFFFF 1 MiB U-Boot (up to 512 KiB) and 2 x * env
404 * 404 *
405 * NAND flash layout: one big partition 405 * NAND flash layout: one big partition
406 */ 406 */
407 #define MTDPARTS_DEFAULT "mtdparts=fc000000.flash:43776k(user)," \ 407 #define MTDPARTS_DEFAULT "mtdparts=fc000000.flash:43776k(user)," \
408 "16m(rootfs)," \ 408 "16m(rootfs)," \
409 "4m(kernel)," \ 409 "4m(kernel)," \
410 "256k(dtb)," \ 410 "256k(dtb)," \
411 "1m(u-boot);" \ 411 "1m(u-boot);" \
412 "mpc5121.nand:-(data)" 412 "mpc5121.nand:-(data)"
413 413
414 #if defined(CONFIG_CMD_IDE) || defined(CONFIG_CMD_EXT2) || defined(CONFIG_CMD_USB) 414 #if defined(CONFIG_IDE) || defined(CONFIG_CMD_EXT2) || defined(CONFIG_CMD_USB)
415 #define CONFIG_SUPPORT_VFAT 415 #define CONFIG_SUPPORT_VFAT
416 416
417 #endif /* defined(CONFIG_CMD_IDE) */ 417 #endif /* defined(CONFIG_IDE) */
418 418
419 /* 419 /*
420 * Watchdog timeout = CONFIG_SYS_WATCHDOG_VALUE * 65536 / IPS clock. 420 * Watchdog timeout = CONFIG_SYS_WATCHDOG_VALUE * 65536 / IPS clock.
421 * For example, when IPS is set to 66MHz and CONFIG_SYS_WATCHDOG_VALUE is set 421 * For example, when IPS is set to 66MHz and CONFIG_SYS_WATCHDOG_VALUE is set
422 * to 0xFFFF, watchdog timeouts after about 64s. For details refer 422 * to 0xFFFF, watchdog timeouts after about 64s. For details refer
423 * to chapter 36 of the MPC5121e Reference Manual. 423 * to chapter 36 of the MPC5121e Reference Manual.
424 */ 424 */
425 /* #define CONFIG_WATCHDOG */ /* enable watchdog */ 425 /* #define CONFIG_WATCHDOG */ /* enable watchdog */
426 #define CONFIG_SYS_WATCHDOG_VALUE 0xFFFF 426 #define CONFIG_SYS_WATCHDOG_VALUE 0xFFFF
427 427
428 /* 428 /*
429 * Miscellaneous configurable options 429 * Miscellaneous configurable options
430 */ 430 */
431 #define CONFIG_SYS_LONGHELP /* undef to save memory */ 431 #define CONFIG_SYS_LONGHELP /* undef to save memory */
432 #define CONFIG_SYS_LOAD_ADDR 0x2000000 /* default load address */ 432 #define CONFIG_SYS_LOAD_ADDR 0x2000000 /* default load address */
433 433
434 #ifdef CONFIG_CMD_KGDB 434 #ifdef CONFIG_CMD_KGDB
435 #define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */ 435 #define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
436 #else 436 #else
437 #define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */ 437 #define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */
438 #endif 438 #endif
439 439
440 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16) /* Print Buffer Size */ 440 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16) /* Print Buffer Size */
441 #define CONFIG_SYS_MAXARGS 16 /* max number of command args */ 441 #define CONFIG_SYS_MAXARGS 16 /* max number of command args */
442 #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE /* Boot Argument Buffer Size */ 442 #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE /* Boot Argument Buffer Size */
443 443
444 /* 444 /*
445 * For booting Linux, the board info and command line data 445 * For booting Linux, the board info and command line data
446 * have to be in the first 256 MB of memory, since this is 446 * have to be in the first 256 MB of memory, since this is
447 * the maximum mapped by the Linux kernel during initialization. 447 * the maximum mapped by the Linux kernel during initialization.
448 */ 448 */
449 #define CONFIG_SYS_BOOTMAPSZ (256 << 20) /* Initial Memory map for Linux*/ 449 #define CONFIG_SYS_BOOTMAPSZ (256 << 20) /* Initial Memory map for Linux*/
450 450
451 /* Cache Configuration */ 451 /* Cache Configuration */
452 #define CONFIG_SYS_DCACHE_SIZE 32768 452 #define CONFIG_SYS_DCACHE_SIZE 32768
453 #define CONFIG_SYS_CACHELINE_SIZE 32 453 #define CONFIG_SYS_CACHELINE_SIZE 32
454 #ifdef CONFIG_CMD_KGDB 454 #ifdef CONFIG_CMD_KGDB
455 #define CONFIG_SYS_CACHELINE_SHIFT 5 /*log base 2 of the above value*/ 455 #define CONFIG_SYS_CACHELINE_SHIFT 5 /*log base 2 of the above value*/
456 #endif 456 #endif
457 457
458 #define CONFIG_SYS_HID0_INIT 0x000000000 458 #define CONFIG_SYS_HID0_INIT 0x000000000
459 #define CONFIG_SYS_HID0_FINAL (HID0_ENABLE_MACHINE_CHECK | HID0_ICE) 459 #define CONFIG_SYS_HID0_FINAL (HID0_ENABLE_MACHINE_CHECK | HID0_ICE)
460 #define CONFIG_SYS_HID2 HID2_HBE 460 #define CONFIG_SYS_HID2 HID2_HBE
461 461
462 #define CONFIG_HIGH_BATS 1 /* High BATs supported */ 462 #define CONFIG_HIGH_BATS 1 /* High BATs supported */
463 463
464 #ifdef CONFIG_CMD_KGDB 464 #ifdef CONFIG_CMD_KGDB
465 #define CONFIG_KGDB_BAUDRATE 230400 /* speed of kgdb serial port */ 465 #define CONFIG_KGDB_BAUDRATE 230400 /* speed of kgdb serial port */
466 #endif 466 #endif
467 467
468 /* 468 /*
469 * Environment Configuration 469 * Environment Configuration
470 */ 470 */
471 #define CONFIG_TIMESTAMP 471 #define CONFIG_TIMESTAMP
472 472
473 #define CONFIG_HOSTNAME mpc5121ads 473 #define CONFIG_HOSTNAME mpc5121ads
474 #define CONFIG_BOOTFILE "mpc5121ads/uImage" 474 #define CONFIG_BOOTFILE "mpc5121ads/uImage"
475 #define CONFIG_ROOTPATH "/opt/eldk/ppc_6xx" 475 #define CONFIG_ROOTPATH "/opt/eldk/ppc_6xx"
476 476
477 #define CONFIG_LOADADDR 400000 /* default location for tftp and bootm */ 477 #define CONFIG_LOADADDR 400000 /* default location for tftp and bootm */
478 478
479 #undef CONFIG_BOOTARGS /* the boot command will set bootargs */ 479 #undef CONFIG_BOOTARGS /* the boot command will set bootargs */
480 480
481 #define CONFIG_PREBOOT "echo;" \ 481 #define CONFIG_PREBOOT "echo;" \
482 "echo Type \\\"run flash_nfs\\\" to mount root filesystem over NFS;" \ 482 "echo Type \\\"run flash_nfs\\\" to mount root filesystem over NFS;" \
483 "echo" 483 "echo"
484 484
485 #define CONFIG_EXTRA_ENV_SETTINGS \ 485 #define CONFIG_EXTRA_ENV_SETTINGS \
486 "u-boot_addr_r=200000\0" \ 486 "u-boot_addr_r=200000\0" \
487 "kernel_addr_r=600000\0" \ 487 "kernel_addr_r=600000\0" \
488 "fdt_addr_r=880000\0" \ 488 "fdt_addr_r=880000\0" \
489 "ramdisk_addr_r=900000\0" \ 489 "ramdisk_addr_r=900000\0" \
490 "u-boot_addr=FFF00000\0" \ 490 "u-boot_addr=FFF00000\0" \
491 "kernel_addr=FFAC0000\0" \ 491 "kernel_addr=FFAC0000\0" \
492 "fdt_addr=FFEC0000\0" \ 492 "fdt_addr=FFEC0000\0" \
493 "ramdisk_addr=FEAC0000\0" \ 493 "ramdisk_addr=FEAC0000\0" \
494 "ramdiskfile=mpc5121ads/uRamdisk\0" \ 494 "ramdiskfile=mpc5121ads/uRamdisk\0" \
495 "u-boot=mpc5121ads/u-boot.bin\0" \ 495 "u-boot=mpc5121ads/u-boot.bin\0" \
496 "bootfile=mpc5121ads/uImage\0" \ 496 "bootfile=mpc5121ads/uImage\0" \
497 "fdtfile=mpc5121ads/mpc5121ads.dtb\0" \ 497 "fdtfile=mpc5121ads/mpc5121ads.dtb\0" \
498 "rootpath=/opt/eldk/ppc_6xx\n" \ 498 "rootpath=/opt/eldk/ppc_6xx\n" \
499 "netdev=eth0\0" \ 499 "netdev=eth0\0" \
500 "consdev=ttyPSC0\0" \ 500 "consdev=ttyPSC0\0" \
501 "nfsargs=setenv bootargs root=/dev/nfs rw " \ 501 "nfsargs=setenv bootargs root=/dev/nfs rw " \
502 "nfsroot=${serverip}:${rootpath}\0" \ 502 "nfsroot=${serverip}:${rootpath}\0" \
503 "ramargs=setenv bootargs root=/dev/ram rw\0" \ 503 "ramargs=setenv bootargs root=/dev/ram rw\0" \
504 "addip=setenv bootargs ${bootargs} " \ 504 "addip=setenv bootargs ${bootargs} " \
505 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \ 505 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
506 ":${hostname}:${netdev}:off panic=1\0" \ 506 ":${hostname}:${netdev}:off panic=1\0" \
507 "addtty=setenv bootargs ${bootargs} " \ 507 "addtty=setenv bootargs ${bootargs} " \
508 "console=${consdev},${baudrate}\0" \ 508 "console=${consdev},${baudrate}\0" \
509 "flash_nfs=run nfsargs addip addtty;" \ 509 "flash_nfs=run nfsargs addip addtty;" \
510 "bootm ${kernel_addr} - ${fdt_addr}\0" \ 510 "bootm ${kernel_addr} - ${fdt_addr}\0" \
511 "flash_self=run ramargs addip addtty;" \ 511 "flash_self=run ramargs addip addtty;" \
512 "bootm ${kernel_addr} ${ramdisk_addr} ${fdt_addr}\0" \ 512 "bootm ${kernel_addr} ${ramdisk_addr} ${fdt_addr}\0" \
513 "net_nfs=tftp ${kernel_addr_r} ${bootfile};" \ 513 "net_nfs=tftp ${kernel_addr_r} ${bootfile};" \
514 "tftp ${fdt_addr_r} ${fdtfile};" \ 514 "tftp ${fdt_addr_r} ${fdtfile};" \
515 "run nfsargs addip addtty;" \ 515 "run nfsargs addip addtty;" \
516 "bootm ${kernel_addr_r} - ${fdt_addr_r}\0" \ 516 "bootm ${kernel_addr_r} - ${fdt_addr_r}\0" \
517 "net_self=tftp ${kernel_addr_r} ${bootfile};" \ 517 "net_self=tftp ${kernel_addr_r} ${bootfile};" \
518 "tftp ${ramdisk_addr_r} ${ramdiskfile};" \ 518 "tftp ${ramdisk_addr_r} ${ramdiskfile};" \
519 "tftp ${fdt_addr_r} ${fdtfile};" \ 519 "tftp ${fdt_addr_r} ${fdtfile};" \
520 "run ramargs addip addtty;" \ 520 "run ramargs addip addtty;" \
521 "bootm ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}\0"\ 521 "bootm ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}\0"\
522 "load=tftp ${u-boot_addr_r} ${u-boot}\0" \ 522 "load=tftp ${u-boot_addr_r} ${u-boot}\0" \
523 "update=protect off ${u-boot_addr} +${filesize};" \ 523 "update=protect off ${u-boot_addr} +${filesize};" \
524 "era ${u-boot_addr} +${filesize};" \ 524 "era ${u-boot_addr} +${filesize};" \
525 "cp.b ${u-boot_addr_r} ${u-boot_addr} ${filesize}\0" \ 525 "cp.b ${u-boot_addr_r} ${u-boot_addr} ${filesize}\0" \
526 "upd=run load update\0" \ 526 "upd=run load update\0" \
527 "" 527 ""
528 528
529 #define CONFIG_BOOTCOMMAND "run flash_self" 529 #define CONFIG_BOOTCOMMAND "run flash_self"
530 530
531 #define CONFIG_OF_SUPPORT_OLD_DEVICE_TREES 1 531 #define CONFIG_OF_SUPPORT_OLD_DEVICE_TREES 1
532 532
533 #define OF_CPU "PowerPC,5121@0" 533 #define OF_CPU "PowerPC,5121@0"
534 #define OF_SOC_COMPAT "fsl,mpc5121-immr" 534 #define OF_SOC_COMPAT "fsl,mpc5121-immr"
535 #define OF_TBCLK (bd->bi_busfreq / 4) 535 #define OF_TBCLK (bd->bi_busfreq / 4)
536 #define OF_STDOUT_PATH "/soc@80000000/serial@11300" 536 #define OF_STDOUT_PATH "/soc@80000000/serial@11300"
537 537
538 /*----------------------------------------------------------------------- 538 /*-----------------------------------------------------------------------
539 * IDE/ATA stuff 539 * IDE/ATA stuff
540 *----------------------------------------------------------------------- 540 *-----------------------------------------------------------------------
541 */ 541 */
542 542
543 #undef CONFIG_IDE_8xx_PCCARD /* Use IDE with PC Card Adapter */ 543 #undef CONFIG_IDE_8xx_PCCARD /* Use IDE with PC Card Adapter */
544 #undef CONFIG_IDE_8xx_DIRECT /* Direct IDE not supported */ 544 #undef CONFIG_IDE_8xx_DIRECT /* Direct IDE not supported */
545 #undef CONFIG_IDE_LED /* LED for IDE not supported */ 545 #undef CONFIG_IDE_LED /* LED for IDE not supported */
546 546
547 #define CONFIG_IDE_RESET /* reset for IDE supported */ 547 #define CONFIG_IDE_RESET /* reset for IDE supported */
548 #define CONFIG_IDE_PREINIT 548 #define CONFIG_IDE_PREINIT
549 549
550 #define CONFIG_SYS_IDE_MAXBUS 1 /* max. 1 IDE bus */ 550 #define CONFIG_SYS_IDE_MAXBUS 1 /* max. 1 IDE bus */
551 #define CONFIG_SYS_IDE_MAXDEVICE 2 /* max. 1 drive per IDE bus */ 551 #define CONFIG_SYS_IDE_MAXDEVICE 2 /* max. 1 drive per IDE bus */
552 552
553 #define CONFIG_SYS_ATA_IDE0_OFFSET 0x0000 553 #define CONFIG_SYS_ATA_IDE0_OFFSET 0x0000
554 #define CONFIG_SYS_ATA_BASE_ADDR get_pata_base() 554 #define CONFIG_SYS_ATA_BASE_ADDR get_pata_base()
555 555
556 /* Offset for data I/O RefMan MPC5121EE Table 28-10 */ 556 /* Offset for data I/O RefMan MPC5121EE Table 28-10 */
557 #define CONFIG_SYS_ATA_DATA_OFFSET (0x00A0) 557 #define CONFIG_SYS_ATA_DATA_OFFSET (0x00A0)
558 558
559 /* Offset for normal register accesses */ 559 /* Offset for normal register accesses */
560 #define CONFIG_SYS_ATA_REG_OFFSET (CONFIG_SYS_ATA_DATA_OFFSET) 560 #define CONFIG_SYS_ATA_REG_OFFSET (CONFIG_SYS_ATA_DATA_OFFSET)
561 561
562 /* Offset for alternate registers RefMan MPC5121EE Table 28-23 */ 562 /* Offset for alternate registers RefMan MPC5121EE Table 28-23 */
563 #define CONFIG_SYS_ATA_ALT_OFFSET (0x00D8) 563 #define CONFIG_SYS_ATA_ALT_OFFSET (0x00D8)
564 564
565 /* Interval between registers */ 565 /* Interval between registers */
566 #define CONFIG_SYS_ATA_STRIDE 4 566 #define CONFIG_SYS_ATA_STRIDE 4
567 567
568 #define ATA_BASE_ADDR get_pata_base() 568 #define ATA_BASE_ADDR get_pata_base()
569 569
570 /* 570 /*
571 * Control register bit definitions 571 * Control register bit definitions
572 */ 572 */
573 #define FSL_ATA_CTRL_FIFO_RST_B 0x80000000 573 #define FSL_ATA_CTRL_FIFO_RST_B 0x80000000
574 #define FSL_ATA_CTRL_ATA_RST_B 0x40000000 574 #define FSL_ATA_CTRL_ATA_RST_B 0x40000000
575 #define FSL_ATA_CTRL_FIFO_TX_EN 0x20000000 575 #define FSL_ATA_CTRL_FIFO_TX_EN 0x20000000
576 #define FSL_ATA_CTRL_FIFO_RCV_EN 0x10000000 576 #define FSL_ATA_CTRL_FIFO_RCV_EN 0x10000000
577 #define FSL_ATA_CTRL_DMA_PENDING 0x08000000 577 #define FSL_ATA_CTRL_DMA_PENDING 0x08000000
578 #define FSL_ATA_CTRL_DMA_ULTRA 0x04000000 578 #define FSL_ATA_CTRL_DMA_ULTRA 0x04000000
579 #define FSL_ATA_CTRL_DMA_WRITE 0x02000000 579 #define FSL_ATA_CTRL_DMA_WRITE 0x02000000
580 #define FSL_ATA_CTRL_IORDY_EN 0x01000000 580 #define FSL_ATA_CTRL_IORDY_EN 0x01000000
581 581
582 #endif /* __CONFIG_H */ 582 #endif /* __CONFIG_H */
583 583
include/configs/nsa310s.h
1 /* 1 /*
2 * Copyright (C) 2015 2 * Copyright (C) 2015
3 * Gerald Kerma <dreagle@doukki.net> 3 * Gerald Kerma <dreagle@doukki.net>
4 * Tony Dinh <mibodhi@gmail.com> 4 * Tony Dinh <mibodhi@gmail.com>
5 * Luka Perkov <luka.perkov@sartura.hr> 5 * Luka Perkov <luka.perkov@sartura.hr>
6 * 6 *
7 * SPDX-License-Identifier: GPL-2.0+ 7 * SPDX-License-Identifier: GPL-2.0+
8 */ 8 */
9 9
10 #ifndef _CONFIG_NSA310S_H 10 #ifndef _CONFIG_NSA310S_H
11 #define _CONFIG_NSA310S_H 11 #define _CONFIG_NSA310S_H
12 12
13 /* high level configuration options */ 13 /* high level configuration options */
14 #define CONFIG_FEROCEON_88FR131 1 /* CPU Core subversion */ 14 #define CONFIG_FEROCEON_88FR131 1 /* CPU Core subversion */
15 #define CONFIG_KW88F6192 1 /* SOC Name */ 15 #define CONFIG_KW88F6192 1 /* SOC Name */
16 #define CONFIG_KW88F6702 1 /* SOC Name */ 16 #define CONFIG_KW88F6702 1 /* SOC Name */
17 #define CONFIG_SKIP_LOWLEVEL_INIT /* disable board lowlevel_init */ 17 #define CONFIG_SKIP_LOWLEVEL_INIT /* disable board lowlevel_init */
18 18
19 /* add target to build it automatically upon "make" */ 19 /* add target to build it automatically upon "make" */
20 #define CONFIG_BUILD_TARGET "u-boot.kwb" 20 #define CONFIG_BUILD_TARGET "u-boot.kwb"
21 21
22 /* compression configuration */ 22 /* compression configuration */
23 #define CONFIG_BZIP2 23 #define CONFIG_BZIP2
24 #define CONFIG_LZMA 24 #define CONFIG_LZMA
25 25
26 /* commands configuration */ 26 /* commands configuration */
27 #define CONFIG_SYS_MVFS 27 #define CONFIG_SYS_MVFS
28 28
29 /* 29 /*
30 * mv-common.h should be defined after CMD configs since it used them 30 * mv-common.h should be defined after CMD configs since it used them
31 * to enable certain macros 31 * to enable certain macros
32 */ 32 */
33 #include "mv-common.h" 33 #include "mv-common.h"
34 34
35 /* environment variables configuration */ 35 /* environment variables configuration */
36 #ifdef CONFIG_CMD_NAND 36 #ifdef CONFIG_CMD_NAND
37 #define CONFIG_ENV_IS_IN_NAND 37 #define CONFIG_ENV_IS_IN_NAND
38 #define CONFIG_ENV_SECT_SIZE 0x20000 38 #define CONFIG_ENV_SECT_SIZE 0x20000
39 #else 39 #else
40 #define CONFIG_ENV_IS_NOWHERE 40 #define CONFIG_ENV_IS_NOWHERE
41 #endif 41 #endif
42 #define CONFIG_ENV_SIZE 0x20000 42 #define CONFIG_ENV_SIZE 0x20000
43 #define CONFIG_ENV_OFFSET 0xe0000 43 #define CONFIG_ENV_OFFSET 0xe0000
44 44
45 /* default environment variables */ 45 /* default environment variables */
46 #define CONFIG_BOOTCOMMAND \ 46 #define CONFIG_BOOTCOMMAND \
47 "setenv bootargs ${console} ${mtdparts} ${bootargs_root}; " \ 47 "setenv bootargs ${console} ${mtdparts} ${bootargs_root}; " \
48 "ubi part root; " \ 48 "ubi part root; " \
49 "ubifsmount ubi:rootfs; " \ 49 "ubifsmount ubi:rootfs; " \
50 "ubifsload 0x800000 ${kernel}; " \ 50 "ubifsload 0x800000 ${kernel}; " \
51 "ubifsload 0x700000 ${fdt}; " \ 51 "ubifsload 0x700000 ${fdt}; " \
52 "ubifsumount; " \ 52 "ubifsumount; " \
53 "fdt addr 0x700000; fdt resize; fdt chosen; " \ 53 "fdt addr 0x700000; fdt resize; fdt chosen; " \
54 "bootz 0x800000 - 0x700000" 54 "bootz 0x800000 - 0x700000"
55 55
56 #define CONFIG_MTDPARTS \ 56 #define CONFIG_MTDPARTS \
57 "mtdparts=orion_nand:" \ 57 "mtdparts=orion_nand:" \
58 "0xe0000@0x0(uboot)," \ 58 "0xe0000@0x0(uboot)," \
59 "0x20000@0xe0000(uboot_env)," \ 59 "0x20000@0xe0000(uboot_env)," \
60 "0x100000@0x100000(second_stage_uboot)," \ 60 "0x100000@0x100000(second_stage_uboot)," \
61 "-@0x200000(root)\0" 61 "-@0x200000(root)\0"
62 62
63 #define CONFIG_EXTRA_ENV_SETTINGS \ 63 #define CONFIG_EXTRA_ENV_SETTINGS \
64 "console=console=ttyS0,115200\0" \ 64 "console=console=ttyS0,115200\0" \
65 "mtdids=nand0=orion_nand\0" \ 65 "mtdids=nand0=orion_nand\0" \
66 "mtdparts="CONFIG_MTDPARTS \ 66 "mtdparts="CONFIG_MTDPARTS \
67 "kernel=/boot/zImage\0" \ 67 "kernel=/boot/zImage\0" \
68 "fdt=/boot/nsa310s.dtb\0" \ 68 "fdt=/boot/nsa310s.dtb\0" \
69 "bootargs_root=ubi.mtd=3 root=ubi0:rootfs rootfstype=ubifs rw\0" 69 "bootargs_root=ubi.mtd=3 root=ubi0:rootfs rootfstype=ubifs rw\0"
70 70
71 /* Ethernet driver configuration */ 71 /* Ethernet driver configuration */
72 #ifdef CONFIG_CMD_NET 72 #ifdef CONFIG_CMD_NET
73 #define CONFIG_NETCONSOLE 73 #define CONFIG_NETCONSOLE
74 #define CONFIG_NET_MULTI 74 #define CONFIG_NET_MULTI
75 #define CONFIG_MVGBE_PORTS {1, 0} /* enable port 0 only */ 75 #define CONFIG_MVGBE_PORTS {1, 0} /* enable port 0 only */
76 #define CONFIG_PHY_BASE_ADR 1 76 #define CONFIG_PHY_BASE_ADR 1
77 #define CONFIG_PHY_GIGE 77 #define CONFIG_PHY_GIGE
78 #define CONFIG_RESET_PHY_R 78 #define CONFIG_RESET_PHY_R
79 #endif /* CONFIG_CMD_NET */ 79 #endif /* CONFIG_CMD_NET */
80 80
81 /* SATA driver configuration */ 81 /* SATA driver configuration */
82 #ifdef CONFIG_CMD_IDE 82 #ifdef CONFIG_IDE
83 #define __io 83 #define __io
84 #define CONFIG_IDE_PREINIT 84 #define CONFIG_IDE_PREINIT
85 #define CONFIG_MVSATA_IDE_USE_PORT0 85 #define CONFIG_MVSATA_IDE_USE_PORT0
86 #define CONFIG_SYS_ATA_IDE0_OFFSET MV_SATA_PORT0_OFFSET 86 #define CONFIG_SYS_ATA_IDE0_OFFSET MV_SATA_PORT0_OFFSET
87 #endif /* CONFIG_CMD_IDE */ 87 #endif /* CONFIG_IDE */
88 88
89 /* RTC driver configuration */ 89 /* RTC driver configuration */
90 #ifdef CONFIG_CMD_DATE 90 #ifdef CONFIG_CMD_DATE
91 #define CONFIG_RTC_MV 91 #define CONFIG_RTC_MV
92 #endif /* CONFIG_CMD_DATE */ 92 #endif /* CONFIG_CMD_DATE */
93 93
94 #endif /* _CONFIG_NSA310S_H */ 94 #endif /* _CONFIG_NSA310S_H */
95 95
include/configs/qemu-x86.h
1 /* 1 /*
2 * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com> 2 * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
3 * 3 *
4 * SPDX-License-Identifier: GPL-2.0+ 4 * SPDX-License-Identifier: GPL-2.0+
5 */ 5 */
6 6
7 /* 7 /*
8 * board/config.h - configuration options, board specific 8 * board/config.h - configuration options, board specific
9 */ 9 */
10 10
11 #ifndef __CONFIG_H 11 #ifndef __CONFIG_H
12 #define __CONFIG_H 12 #define __CONFIG_H
13 13
14 #include <configs/x86-common.h> 14 #include <configs/x86-common.h>
15 15
16 #define CONFIG_SYS_MONITOR_LEN (1 << 20) 16 #define CONFIG_SYS_MONITOR_LEN (1 << 20)
17 17
18 #define CONFIG_STD_DEVICES_SETTINGS "stdin=serial,i8042-kbd\0" \ 18 #define CONFIG_STD_DEVICES_SETTINGS "stdin=serial,i8042-kbd\0" \
19 "stdout=serial,vidconsole\0" \ 19 "stdout=serial,vidconsole\0" \
20 "stderr=serial,vidconsole\0" 20 "stderr=serial,vidconsole\0"
21 21
22 /* 22 /*
23 * ATA/SATA support for QEMU x86 targets 23 * ATA/SATA support for QEMU x86 targets
24 * - Only legacy IDE controller is supported for QEMU '-M pc' target 24 * - Only legacy IDE controller is supported for QEMU '-M pc' target
25 * - AHCI controller is supported for QEMU '-M q35' target 25 * - AHCI controller is supported for QEMU '-M q35' target
26 * 26 *
27 * Default configuraion is to support the QEMU default x86 target 27 * Default configuraion is to support the QEMU default x86 target
28 * Undefine CONFIG_CMD_IDE to support q35 target 28 * Undefine CONFIG_IDE to support q35 target
29 */ 29 */
30 #ifdef CONFIG_CMD_IDE 30 #ifdef CONFIG_IDE
31 #define CONFIG_SYS_IDE_MAXBUS 2 31 #define CONFIG_SYS_IDE_MAXBUS 2
32 #define CONFIG_SYS_IDE_MAXDEVICE 4 32 #define CONFIG_SYS_IDE_MAXDEVICE 4
33 #define CONFIG_SYS_ATA_BASE_ADDR 0 33 #define CONFIG_SYS_ATA_BASE_ADDR 0
34 #define CONFIG_SYS_ATA_DATA_OFFSET 0 34 #define CONFIG_SYS_ATA_DATA_OFFSET 0
35 #define CONFIG_SYS_ATA_REG_OFFSET 0 35 #define CONFIG_SYS_ATA_REG_OFFSET 0
36 #define CONFIG_SYS_ATA_ALT_OFFSET 0 36 #define CONFIG_SYS_ATA_ALT_OFFSET 0
37 #define CONFIG_SYS_ATA_IDE0_OFFSET 0x1f0 37 #define CONFIG_SYS_ATA_IDE0_OFFSET 0x1f0
38 #define CONFIG_SYS_ATA_IDE1_OFFSET 0x170 38 #define CONFIG_SYS_ATA_IDE1_OFFSET 0x170
39 #define CONFIG_ATAPI 39 #define CONFIG_ATAPI
40 40
41 #undef CONFIG_SCSI_AHCI 41 #undef CONFIG_SCSI_AHCI
42 #undef CONFIG_SCSI 42 #undef CONFIG_SCSI
43 #else 43 #else
44 #define CONFIG_SCSI_DEV_LIST \ 44 #define CONFIG_SCSI_DEV_LIST \
45 {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_AHCI} 45 {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_AHCI}
46 #endif 46 #endif
47 47
48 /* GPIO is not supported */ 48 /* GPIO is not supported */
49 #undef CONFIG_INTEL_ICH6_GPIO 49 #undef CONFIG_INTEL_ICH6_GPIO
50 50
51 /* SPI is not supported */ 51 /* SPI is not supported */
52 #undef CONFIG_ENV_IS_IN_SPI_FLASH 52 #undef CONFIG_ENV_IS_IN_SPI_FLASH
53 #define CONFIG_ENV_IS_NOWHERE 53 #define CONFIG_ENV_IS_NOWHERE
54 54
55 #define CONFIG_SPL_FRAMEWORK 55 #define CONFIG_SPL_FRAMEWORK
56 56
57 #define CONFIG_SPL_TEXT_BASE 0xfffd0000 57 #define CONFIG_SPL_TEXT_BASE 0xfffd0000
58 58
59 #define BOOT_DEVICE_SPI 10 59 #define BOOT_DEVICE_SPI 10
60 60
61 #define CONFIG_SPL_BOARD_LOAD_IMAGE 61 #define CONFIG_SPL_BOARD_LOAD_IMAGE
62 #define BOOT_DEVICE_BOARD 11 62 #define BOOT_DEVICE_BOARD 11
63 63
64 #endif /* __CONFIG_H */ 64 #endif /* __CONFIG_H */
65 65
include/configs/r7780mp.h
1 /* 1 /*
2 * Configuation settings for the Renesas R7780MP board 2 * Configuation settings for the Renesas R7780MP board
3 * 3 *
4 * Copyright (C) 2007,2008 Nobuhiro Iwamatsu <iwamatsu@nigauri.org> 4 * Copyright (C) 2007,2008 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
5 * Copyright (C) 2008 Yusuke Goda <goda.yusuke@renesas.com> 5 * Copyright (C) 2008 Yusuke Goda <goda.yusuke@renesas.com>
6 * 6 *
7 * SPDX-License-Identifier: GPL-2.0+ 7 * SPDX-License-Identifier: GPL-2.0+
8 */ 8 */
9 9
10 #ifndef __R7780RP_H 10 #ifndef __R7780RP_H
11 #define __R7780RP_H 11 #define __R7780RP_H
12 12
13 #define CONFIG_CPU_SH7780 1 13 #define CONFIG_CPU_SH7780 1
14 #define CONFIG_R7780MP 1 14 #define CONFIG_R7780MP 1
15 #define CONFIG_SYS_R7780MP_OLD_FLASH 1 15 #define CONFIG_SYS_R7780MP_OLD_FLASH 1
16 #define __LITTLE_ENDIAN__ 1 16 #define __LITTLE_ENDIAN__ 1
17 17
18 #define CONFIG_DISPLAY_BOARDINFO 18 #define CONFIG_DISPLAY_BOARDINFO
19 19
20 /* 20 /*
21 * Command line configuration. 21 * Command line configuration.
22 */ 22 */
23 #define CONFIG_CMD_SDRAM 23 #define CONFIG_CMD_SDRAM
24 #define CONFIG_CMD_PCI 24 #define CONFIG_CMD_PCI
25 25
26 #define CONFIG_SCIF_CONSOLE 1 26 #define CONFIG_SCIF_CONSOLE 1
27 #define CONFIG_CONS_SCIF0 1 27 #define CONFIG_CONS_SCIF0 1
28 28
29 #define CONFIG_BOOTARGS "console=ttySC0,115200" 29 #define CONFIG_BOOTARGS "console=ttySC0,115200"
30 #define CONFIG_ENV_OVERWRITE 1 30 #define CONFIG_ENV_OVERWRITE 1
31 31
32 #define CONFIG_SYS_TEXT_BASE 0x0FFC0000 32 #define CONFIG_SYS_TEXT_BASE 0x0FFC0000
33 #define CONFIG_SYS_SDRAM_BASE (0x08000000) 33 #define CONFIG_SYS_SDRAM_BASE (0x08000000)
34 #define CONFIG_SYS_SDRAM_SIZE (128 * 1024 * 1024) 34 #define CONFIG_SYS_SDRAM_SIZE (128 * 1024 * 1024)
35 35
36 #define CONFIG_SYS_LONGHELP 36 #define CONFIG_SYS_LONGHELP
37 #define CONFIG_SYS_CBSIZE 256 37 #define CONFIG_SYS_CBSIZE 256
38 #define CONFIG_SYS_PBSIZE 256 38 #define CONFIG_SYS_PBSIZE 256
39 #define CONFIG_SYS_MAXARGS 16 39 #define CONFIG_SYS_MAXARGS 16
40 #define CONFIG_SYS_BARGSIZE 512 40 #define CONFIG_SYS_BARGSIZE 512
41 41
42 #define CONFIG_SYS_MEMTEST_START (CONFIG_SYS_SDRAM_BASE) 42 #define CONFIG_SYS_MEMTEST_START (CONFIG_SYS_SDRAM_BASE)
43 #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_TEXT_BASE - 0x100000) 43 #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_TEXT_BASE - 0x100000)
44 44
45 /* Flash board support */ 45 /* Flash board support */
46 #define CONFIG_SYS_FLASH_BASE (0xA0000000) 46 #define CONFIG_SYS_FLASH_BASE (0xA0000000)
47 #ifdef CONFIG_SYS_R7780MP_OLD_FLASH 47 #ifdef CONFIG_SYS_R7780MP_OLD_FLASH
48 /* NOR Flash (S29PL127J60TFI130) */ 48 /* NOR Flash (S29PL127J60TFI130) */
49 # define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_32BIT 49 # define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_32BIT
50 # define CONFIG_SYS_MAX_FLASH_BANKS (2) 50 # define CONFIG_SYS_MAX_FLASH_BANKS (2)
51 # define CONFIG_SYS_MAX_FLASH_SECT 270 51 # define CONFIG_SYS_MAX_FLASH_SECT 270
52 # define CONFIG_SYS_FLASH_BANKS_LIST { CONFIG_SYS_FLASH_BASE,\ 52 # define CONFIG_SYS_FLASH_BANKS_LIST { CONFIG_SYS_FLASH_BASE,\
53 CONFIG_SYS_FLASH_BASE + 0x100000,\ 53 CONFIG_SYS_FLASH_BASE + 0x100000,\
54 CONFIG_SYS_FLASH_BASE + 0x400000,\ 54 CONFIG_SYS_FLASH_BASE + 0x400000,\
55 CONFIG_SYS_FLASH_BASE + 0x700000, } 55 CONFIG_SYS_FLASH_BASE + 0x700000, }
56 #else /* CONFIG_SYS_R7780MP_OLD_FLASH */ 56 #else /* CONFIG_SYS_R7780MP_OLD_FLASH */
57 /* NOR Flash (Spantion S29GL256P) */ 57 /* NOR Flash (Spantion S29GL256P) */
58 # define CONFIG_SYS_MAX_FLASH_BANKS (1) 58 # define CONFIG_SYS_MAX_FLASH_BANKS (1)
59 # define CONFIG_SYS_MAX_FLASH_SECT 256 59 # define CONFIG_SYS_MAX_FLASH_SECT 256
60 # define CONFIG_SYS_FLASH_BANKS_LIST { CONFIG_SYS_FLASH_BASE } 60 # define CONFIG_SYS_FLASH_BANKS_LIST { CONFIG_SYS_FLASH_BASE }
61 #endif /* CONFIG_SYS_R7780MP_OLD_FLASH */ 61 #endif /* CONFIG_SYS_R7780MP_OLD_FLASH */
62 62
63 #define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + 4 * 1024 * 1024) 63 #define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + 4 * 1024 * 1024)
64 /* Address of u-boot image in Flash */ 64 /* Address of u-boot image in Flash */
65 #define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_FLASH_BASE) 65 #define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_FLASH_BASE)
66 #define CONFIG_SYS_MONITOR_LEN (256 * 1024) 66 #define CONFIG_SYS_MONITOR_LEN (256 * 1024)
67 /* Size of DRAM reserved for malloc() use */ 67 /* Size of DRAM reserved for malloc() use */
68 #define CONFIG_SYS_MALLOC_LEN (1204 * 1024) 68 #define CONFIG_SYS_MALLOC_LEN (1204 * 1024)
69 69
70 #define CONFIG_SYS_BOOTMAPSZ (8 * 1024 * 1024) 70 #define CONFIG_SYS_BOOTMAPSZ (8 * 1024 * 1024)
71 #define CONFIG_SYS_RX_ETH_BUFFER (8) 71 #define CONFIG_SYS_RX_ETH_BUFFER (8)
72 72
73 #define CONFIG_SYS_FLASH_CFI 73 #define CONFIG_SYS_FLASH_CFI
74 #define CONFIG_FLASH_CFI_DRIVER 74 #define CONFIG_FLASH_CFI_DRIVER
75 #undef CONFIG_SYS_FLASH_CFI_BROKEN_TABLE 75 #undef CONFIG_SYS_FLASH_CFI_BROKEN_TABLE
76 #undef CONFIG_SYS_FLASH_QUIET_TEST 76 #undef CONFIG_SYS_FLASH_QUIET_TEST
77 /* print 'E' for empty sector on flinfo */ 77 /* print 'E' for empty sector on flinfo */
78 #define CONFIG_SYS_FLASH_EMPTY_INFO 78 #define CONFIG_SYS_FLASH_EMPTY_INFO
79 79
80 #define CONFIG_ENV_IS_IN_FLASH 80 #define CONFIG_ENV_IS_IN_FLASH
81 #define CONFIG_ENV_SECT_SIZE (256 * 1024) 81 #define CONFIG_ENV_SECT_SIZE (256 * 1024)
82 #define CONFIG_ENV_SIZE (CONFIG_ENV_SECT_SIZE) 82 #define CONFIG_ENV_SIZE (CONFIG_ENV_SECT_SIZE)
83 #define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) 83 #define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)
84 #define CONFIG_SYS_FLASH_ERASE_TOUT 120000 84 #define CONFIG_SYS_FLASH_ERASE_TOUT 120000
85 #define CONFIG_SYS_FLASH_WRITE_TOUT 500 85 #define CONFIG_SYS_FLASH_WRITE_TOUT 500
86 86
87 /* Board Clock */ 87 /* Board Clock */
88 #define CONFIG_SYS_CLK_FREQ 33333333 88 #define CONFIG_SYS_CLK_FREQ 33333333
89 #define CONFIG_SH_TMU_CLK_FREQ CONFIG_SYS_CLK_FREQ 89 #define CONFIG_SH_TMU_CLK_FREQ CONFIG_SYS_CLK_FREQ
90 #define CONFIG_SH_SCIF_CLK_FREQ CONFIG_SYS_CLK_FREQ 90 #define CONFIG_SH_SCIF_CLK_FREQ CONFIG_SYS_CLK_FREQ
91 #define CONFIG_SYS_TMU_CLK_DIV 4 91 #define CONFIG_SYS_TMU_CLK_DIV 4
92 92
93 /* PCI Controller */ 93 /* PCI Controller */
94 #if defined(CONFIG_CMD_PCI) 94 #if defined(CONFIG_CMD_PCI)
95 #define CONFIG_SH4_PCI 95 #define CONFIG_SH4_PCI
96 #define CONFIG_SH7780_PCI 96 #define CONFIG_SH7780_PCI
97 #define CONFIG_SH7780_PCI_LSR 0x07f00001 97 #define CONFIG_SH7780_PCI_LSR 0x07f00001
98 #define CONFIG_SH7780_PCI_LAR CONFIG_SYS_SDRAM_SIZE 98 #define CONFIG_SH7780_PCI_LAR CONFIG_SYS_SDRAM_SIZE
99 #define CONFIG_SH7780_PCI_BAR CONFIG_SYS_SDRAM_SIZE 99 #define CONFIG_SH7780_PCI_BAR CONFIG_SYS_SDRAM_SIZE
100 #define CONFIG_PCI_SCAN_SHOW 1 100 #define CONFIG_PCI_SCAN_SHOW 1
101 #define __mem_pci 101 #define __mem_pci
102 102
103 #define CONFIG_PCI_MEM_BUS 0xFD000000 /* Memory space base addr */ 103 #define CONFIG_PCI_MEM_BUS 0xFD000000 /* Memory space base addr */
104 #define CONFIG_PCI_MEM_PHYS CONFIG_PCI_MEM_BUS 104 #define CONFIG_PCI_MEM_PHYS CONFIG_PCI_MEM_BUS
105 #define CONFIG_PCI_MEM_SIZE 0x01000000 /* Size of Memory window */ 105 #define CONFIG_PCI_MEM_SIZE 0x01000000 /* Size of Memory window */
106 106
107 #define CONFIG_PCI_IO_BUS 0xFE200000 /* IO space base address */ 107 #define CONFIG_PCI_IO_BUS 0xFE200000 /* IO space base address */
108 #define CONFIG_PCI_IO_PHYS CONFIG_PCI_IO_BUS 108 #define CONFIG_PCI_IO_PHYS CONFIG_PCI_IO_BUS
109 #define CONFIG_PCI_IO_SIZE 0x00200000 /* Size of IO window */ 109 #define CONFIG_PCI_IO_SIZE 0x00200000 /* Size of IO window */
110 #define CONFIG_PCI_SYS_PHYS CONFIG_SYS_SDRAM_BASE 110 #define CONFIG_PCI_SYS_PHYS CONFIG_SYS_SDRAM_BASE
111 #define CONFIG_PCI_SYS_BUS CONFIG_SYS_SDRAM_BASE 111 #define CONFIG_PCI_SYS_BUS CONFIG_SYS_SDRAM_BASE
112 #define CONFIG_PCI_SYS_SIZE CONFIG_SYS_SDRAM_SIZE 112 #define CONFIG_PCI_SYS_SIZE CONFIG_SYS_SDRAM_SIZE
113 #endif /* CONFIG_CMD_PCI */ 113 #endif /* CONFIG_CMD_PCI */
114 114
115 #if defined(CONFIG_CMD_NET) 115 #if defined(CONFIG_CMD_NET)
116 /* AX88796L Support(NE2000 base chip) */ 116 /* AX88796L Support(NE2000 base chip) */
117 #define CONFIG_DRIVER_AX88796L 117 #define CONFIG_DRIVER_AX88796L
118 #define CONFIG_DRIVER_NE2000_BASE 0xA4100000 118 #define CONFIG_DRIVER_NE2000_BASE 0xA4100000
119 #endif 119 #endif
120 120
121 /* Compact flash Support */ 121 /* Compact flash Support */
122 #if defined(CONFIG_CMD_IDE) 122 #if defined(CONFIG_IDE)
123 #define CONFIG_IDE_RESET 1 123 #define CONFIG_IDE_RESET 1
124 #define CONFIG_SYS_PIO_MODE 1 124 #define CONFIG_SYS_PIO_MODE 1
125 #define CONFIG_SYS_IDE_MAXBUS 1 /* IDE bus */ 125 #define CONFIG_SYS_IDE_MAXBUS 1 /* IDE bus */
126 #define CONFIG_SYS_IDE_MAXDEVICE 1 126 #define CONFIG_SYS_IDE_MAXDEVICE 1
127 #define CONFIG_SYS_ATA_BASE_ADDR 0xb4000000 127 #define CONFIG_SYS_ATA_BASE_ADDR 0xb4000000
128 #define CONFIG_SYS_ATA_STRIDE 2 /* 1bit shift */ 128 #define CONFIG_SYS_ATA_STRIDE 2 /* 1bit shift */
129 #define CONFIG_SYS_ATA_DATA_OFFSET 0x1000 /* data reg offset */ 129 #define CONFIG_SYS_ATA_DATA_OFFSET 0x1000 /* data reg offset */
130 #define CONFIG_SYS_ATA_REG_OFFSET 0x1000 /* reg offset */ 130 #define CONFIG_SYS_ATA_REG_OFFSET 0x1000 /* reg offset */
131 #define CONFIG_SYS_ATA_ALT_OFFSET 0x800 /* alternate register offset */ 131 #define CONFIG_SYS_ATA_ALT_OFFSET 0x800 /* alternate register offset */
132 #define CONFIG_IDE_SWAP_IO 132 #define CONFIG_IDE_SWAP_IO
133 #endif /* CONFIG_CMD_IDE */ 133 #endif /* CONFIG_IDE */
134 134
135 #endif /* __R7780RP_H */ 135 #endif /* __R7780RP_H */
136 136
include/configs/sheevaplug.h
1 /* 1 /*
2 * (C) Copyright 2009-2014 2 * (C) Copyright 2009-2014
3 * Gerald Kerma <dreagle@doukki.net> 3 * Gerald Kerma <dreagle@doukki.net>
4 * Marvell Semiconductor <www.marvell.com> 4 * Marvell Semiconductor <www.marvell.com>
5 * Written-by: Prafulla Wadaskar <prafulla@marvell.com> 5 * Written-by: Prafulla Wadaskar <prafulla@marvell.com>
6 * 6 *
7 * SPDX-License-Identifier: GPL-2.0+ 7 * SPDX-License-Identifier: GPL-2.0+
8 */ 8 */
9 9
10 #ifndef _CONFIG_SHEEVAPLUG_H 10 #ifndef _CONFIG_SHEEVAPLUG_H
11 #define _CONFIG_SHEEVAPLUG_H 11 #define _CONFIG_SHEEVAPLUG_H
12 12
13 /* 13 /*
14 * High Level Configuration Options (easy to change) 14 * High Level Configuration Options (easy to change)
15 */ 15 */
16 #define CONFIG_FEROCEON_88FR131 1 /* CPU Core subversion */ 16 #define CONFIG_FEROCEON_88FR131 1 /* CPU Core subversion */
17 #define CONFIG_MACH_SHEEVAPLUG /* Machine type */ 17 #define CONFIG_MACH_SHEEVAPLUG /* Machine type */
18 18
19 /* 19 /*
20 * Commands configuration 20 * Commands configuration
21 */ 21 */
22 22
23 /* 23 /*
24 * Standard filesystems 24 * Standard filesystems
25 */ 25 */
26 #define CONFIG_SYS_MVFS 26 #define CONFIG_SYS_MVFS
27 27
28 /* 28 /*
29 * mv-plug-common.h should be defined after CMD configs since it used them 29 * mv-plug-common.h should be defined after CMD configs since it used them
30 * to enable certain macros 30 * to enable certain macros
31 */ 31 */
32 #include "mv-plug-common.h" 32 #include "mv-plug-common.h"
33 33
34 /* 34 /*
35 * Environment variables configurations 35 * Environment variables configurations
36 */ 36 */
37 #ifdef CONFIG_CMD_NAND 37 #ifdef CONFIG_CMD_NAND
38 #define CONFIG_ENV_IS_IN_NAND 1 38 #define CONFIG_ENV_IS_IN_NAND 1
39 #define CONFIG_ENV_SECT_SIZE 0x20000 /* 128K */ 39 #define CONFIG_ENV_SECT_SIZE 0x20000 /* 128K */
40 #else 40 #else
41 #define CONFIG_ENV_IS_NOWHERE 1 /* if env in SDRAM */ 41 #define CONFIG_ENV_IS_NOWHERE 1 /* if env in SDRAM */
42 #endif 42 #endif
43 /* 43 /*
44 * max 4k env size is enough, but in case of nand 44 * max 4k env size is enough, but in case of nand
45 * it has to be rounded to sector size 45 * it has to be rounded to sector size
46 */ 46 */
47 #define CONFIG_ENV_SIZE 0x20000 /* 128k */ 47 #define CONFIG_ENV_SIZE 0x20000 /* 128k */
48 #define CONFIG_ENV_ADDR 0x80000 48 #define CONFIG_ENV_ADDR 0x80000
49 #define CONFIG_ENV_OFFSET 0x80000 /* env starts here */ 49 #define CONFIG_ENV_OFFSET 0x80000 /* env starts here */
50 50
51 /* 51 /*
52 * Default environment variables 52 * Default environment variables
53 */ 53 */
54 #define CONFIG_BOOTCOMMAND "${x_bootcmd_kernel}; " \ 54 #define CONFIG_BOOTCOMMAND "${x_bootcmd_kernel}; " \
55 "setenv bootargs ${x_bootargs} ${x_bootargs_root}; " \ 55 "setenv bootargs ${x_bootargs} ${x_bootargs_root}; " \
56 "bootm 0x6400000;" 56 "bootm 0x6400000;"
57 57
58 #define CONFIG_MTDPARTS \ 58 #define CONFIG_MTDPARTS \
59 "orion_nand:512K(uboot)," \ 59 "orion_nand:512K(uboot)," \
60 "512K(env),4M(kernel)," \ 60 "512K(env),4M(kernel)," \
61 "-(rootfs)\0" 61 "-(rootfs)\0"
62 62
63 #define CONFIG_EXTRA_ENV_SETTINGS "x_bootargs=console" \ 63 #define CONFIG_EXTRA_ENV_SETTINGS "x_bootargs=console" \
64 "=ttyS0,115200 mtdparts="CONFIG_MTDPARTS \ 64 "=ttyS0,115200 mtdparts="CONFIG_MTDPARTS \
65 "x_bootcmd_kernel=nand read 0x6400000 0x100000 0x400000\0" \ 65 "x_bootcmd_kernel=nand read 0x6400000 0x100000 0x400000\0" \
66 "x_bootcmd_usb=usb start\0" \ 66 "x_bootcmd_usb=usb start\0" \
67 "x_bootargs_root=root=/dev/mtdblock3 rw rootfstype=jffs2\0" 67 "x_bootargs_root=root=/dev/mtdblock3 rw rootfstype=jffs2\0"
68 68
69 #define MTDIDS_DEFAULT "nand0=orion_nand" 69 #define MTDIDS_DEFAULT "nand0=orion_nand"
70 70
71 #define MTDPARTS_DEFAULT \ 71 #define MTDPARTS_DEFAULT \
72 "mtdparts="CONFIG_MTDPARTS 72 "mtdparts="CONFIG_MTDPARTS
73 73
74 /* 74 /*
75 * Ethernet Driver configuration 75 * Ethernet Driver configuration
76 */ 76 */
77 #ifdef CONFIG_CMD_NET 77 #ifdef CONFIG_CMD_NET
78 #define CONFIG_MVGBE_PORTS {1, 0} /* enable port 0 only */ 78 #define CONFIG_MVGBE_PORTS {1, 0} /* enable port 0 only */
79 #define CONFIG_PHY_BASE_ADR 0 79 #define CONFIG_PHY_BASE_ADR 0
80 #endif /* CONFIG_CMD_NET */ 80 #endif /* CONFIG_CMD_NET */
81 81
82 /* 82 /*
83 * SDIO/MMC Card Configuration 83 * SDIO/MMC Card Configuration
84 */ 84 */
85 #ifdef CONFIG_CMD_MMC 85 #ifdef CONFIG_CMD_MMC
86 #define CONFIG_MVEBU_MMC 86 #define CONFIG_MVEBU_MMC
87 #define CONFIG_SYS_MMC_BASE KW_SDIO_BASE 87 #define CONFIG_SYS_MMC_BASE KW_SDIO_BASE
88 #endif /* CONFIG_CMD_MMC */ 88 #endif /* CONFIG_CMD_MMC */
89 89
90 /* 90 /*
91 * SATA driver configuration 91 * SATA driver configuration
92 */ 92 */
93 #ifdef CONFIG_CMD_IDE 93 #ifdef CONFIG_IDE
94 #define __io 94 #define __io
95 #define CONFIG_IDE_PREINIT 95 #define CONFIG_IDE_PREINIT
96 #define CONFIG_MVSATA_IDE_USE_PORT0 96 #define CONFIG_MVSATA_IDE_USE_PORT0
97 #define CONFIG_MVSATA_IDE_USE_PORT1 97 #define CONFIG_MVSATA_IDE_USE_PORT1
98 #define CONFIG_SYS_ATA_IDE0_OFFSET MV_SATA_PORT0_OFFSET 98 #define CONFIG_SYS_ATA_IDE0_OFFSET MV_SATA_PORT0_OFFSET
99 #define CONFIG_SYS_ATA_IDE1_OFFSET MV_SATA_PORT1_OFFSET 99 #define CONFIG_SYS_ATA_IDE1_OFFSET MV_SATA_PORT1_OFFSET
100 #endif /* CONFIG_CMD_IDE */ 100 #endif /* CONFIG_IDE */
101 101
102 #endif /* _CONFIG_SHEEVAPLUG_H */ 102 #endif /* _CONFIG_SHEEVAPLUG_H */
103 103
1 /* 1 /*
2 * (C) Copyright 2000-2004 2 * (C) Copyright 2000-2004
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 * 4 *
5 * SPDX-License-Identifier: GPL-2.0+ 5 * SPDX-License-Identifier: GPL-2.0+
6 */ 6 */
7 7
8 #ifndef _PCMCIA_H 8 #ifndef _PCMCIA_H
9 #define _PCMCIA_H 9 #define _PCMCIA_H
10 10
11 #include <common.h> 11 #include <common.h>
12 #include <config.h> 12 #include <config.h>
13 13
14 /* 14 /*
15 * Allow configuration to select PCMCIA slot, 15 * Allow configuration to select PCMCIA slot,
16 * or try to generate a useful default 16 * or try to generate a useful default
17 */ 17 */
18 #if defined(CONFIG_CMD_PCMCIA) || \ 18 #if defined(CONFIG_CMD_PCMCIA) || \
19 (defined(CONFIG_CMD_IDE) && \ 19 (defined(CONFIG_IDE) && \
20 (defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT) ) ) 20 (defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT) ) )
21 21
22 #if !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B) 22 #if !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B)
23 23
24 #if defined(CONFIG_TQM8xxL) 24 #if defined(CONFIG_TQM8xxL)
25 # define CONFIG_PCMCIA_SLOT_B /* The TQM8xxL use SLOT_B */ 25 # define CONFIG_PCMCIA_SLOT_B /* The TQM8xxL use SLOT_B */
26 #else 26 #else
27 # error "PCMCIA Slot not configured" 27 # error "PCMCIA Slot not configured"
28 #endif 28 #endif
29 29
30 #endif /* !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B) */ 30 #endif /* !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B) */
31 31
32 /* Make sure exactly one slot is defined - we support only one for now */ 32 /* Make sure exactly one slot is defined - we support only one for now */
33 #if !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B) 33 #if !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B)
34 #error Neither CONFIG_PCMCIA_SLOT_A nor CONFIG_PCMCIA_SLOT_B configured 34 #error Neither CONFIG_PCMCIA_SLOT_A nor CONFIG_PCMCIA_SLOT_B configured
35 #endif 35 #endif
36 #if defined(CONFIG_PCMCIA_SLOT_A) && defined(CONFIG_PCMCIA_SLOT_B) 36 #if defined(CONFIG_PCMCIA_SLOT_A) && defined(CONFIG_PCMCIA_SLOT_B)
37 #error Both CONFIG_PCMCIA_SLOT_A and CONFIG_PCMCIA_SLOT_B configured 37 #error Both CONFIG_PCMCIA_SLOT_A and CONFIG_PCMCIA_SLOT_B configured
38 #endif 38 #endif
39 39
40 #ifndef PCMCIA_SOCKETS_NO 40 #ifndef PCMCIA_SOCKETS_NO
41 #define PCMCIA_SOCKETS_NO 1 41 #define PCMCIA_SOCKETS_NO 1
42 #endif 42 #endif
43 #ifndef PCMCIA_MEM_WIN_NO 43 #ifndef PCMCIA_MEM_WIN_NO
44 #define PCMCIA_MEM_WIN_NO 4 44 #define PCMCIA_MEM_WIN_NO 4
45 #endif 45 #endif
46 #define PCMCIA_IO_WIN_NO 2 46 #define PCMCIA_IO_WIN_NO 2
47 47
48 /* define _slot_ to be able to optimize macros */ 48 /* define _slot_ to be able to optimize macros */
49 #ifdef CONFIG_PCMCIA_SLOT_A 49 #ifdef CONFIG_PCMCIA_SLOT_A
50 # define _slot_ 0 50 # define _slot_ 0
51 # define PCMCIA_SLOT_MSG "slot A" 51 # define PCMCIA_SLOT_MSG "slot A"
52 # define PCMCIA_SLOT_x PCMCIA_PSLOT_A 52 # define PCMCIA_SLOT_x PCMCIA_PSLOT_A
53 #else 53 #else
54 # define _slot_ 1 54 # define _slot_ 1
55 # define PCMCIA_SLOT_MSG "slot B" 55 # define PCMCIA_SLOT_MSG "slot B"
56 # define PCMCIA_SLOT_x PCMCIA_PSLOT_B 56 # define PCMCIA_SLOT_x PCMCIA_PSLOT_B
57 #endif 57 #endif
58 58
59 /* 59 /*
60 * The TQM850L hardware has two pins swapped! Grrrrgh! 60 * The TQM850L hardware has two pins swapped! Grrrrgh!
61 */ 61 */
62 #ifdef CONFIG_TQM850L 62 #ifdef CONFIG_TQM850L
63 #define __MY_PCMCIA_GCRX_CXRESET PCMCIA_GCRX_CXOE 63 #define __MY_PCMCIA_GCRX_CXRESET PCMCIA_GCRX_CXOE
64 #define __MY_PCMCIA_GCRX_CXOE PCMCIA_GCRX_CXRESET 64 #define __MY_PCMCIA_GCRX_CXOE PCMCIA_GCRX_CXRESET
65 #else 65 #else
66 #define __MY_PCMCIA_GCRX_CXRESET PCMCIA_GCRX_CXRESET 66 #define __MY_PCMCIA_GCRX_CXRESET PCMCIA_GCRX_CXRESET
67 #define __MY_PCMCIA_GCRX_CXOE PCMCIA_GCRX_CXOE 67 #define __MY_PCMCIA_GCRX_CXOE PCMCIA_GCRX_CXOE
68 #endif 68 #endif
69 69
70 /* 70 /*
71 * This structure is used to address each window in the PCMCIA controller. 71 * This structure is used to address each window in the PCMCIA controller.
72 * 72 *
73 * Keep in mind that we assume that pcmcia_win_t[n+1] is mapped directly 73 * Keep in mind that we assume that pcmcia_win_t[n+1] is mapped directly
74 * after pcmcia_win_t[n]... 74 * after pcmcia_win_t[n]...
75 */ 75 */
76 76
77 typedef struct { 77 typedef struct {
78 ulong br; 78 ulong br;
79 ulong or; 79 ulong or;
80 } pcmcia_win_t; 80 } pcmcia_win_t;
81 81
82 /* 82 /*
83 * Definitions for PCMCIA control registers to operate in IDE mode 83 * Definitions for PCMCIA control registers to operate in IDE mode
84 * 84 *
85 * All timing related setup (PCMCIA_SHT, PCMCIA_SST, PCMCIA_SL) 85 * All timing related setup (PCMCIA_SHT, PCMCIA_SST, PCMCIA_SL)
86 * to be done later (depending on CPU clock) 86 * to be done later (depending on CPU clock)
87 */ 87 */
88 88
89 /* Window 0: 89 /* Window 0:
90 * Base: 0xFE100000 CS1 90 * Base: 0xFE100000 CS1
91 * Port Size: 2 Bytes 91 * Port Size: 2 Bytes
92 * Port Size: 16 Bit 92 * Port Size: 16 Bit
93 * Common Memory Space 93 * Common Memory Space
94 */ 94 */
95 95
96 #define CONFIG_SYS_PCMCIA_PBR0 0xFE100000 96 #define CONFIG_SYS_PCMCIA_PBR0 0xFE100000
97 #define CONFIG_SYS_PCMCIA_POR0 ( PCMCIA_BSIZE_2 \ 97 #define CONFIG_SYS_PCMCIA_POR0 ( PCMCIA_BSIZE_2 \
98 | PCMCIA_PPS_16 \ 98 | PCMCIA_PPS_16 \
99 | PCMCIA_PRS_MEM \ 99 | PCMCIA_PRS_MEM \
100 | PCMCIA_SLOT_x \ 100 | PCMCIA_SLOT_x \
101 | PCMCIA_PV \ 101 | PCMCIA_PV \
102 ) 102 )
103 103
104 /* Window 1: 104 /* Window 1:
105 * Base: 0xFE100080 CS1 105 * Base: 0xFE100080 CS1
106 * Port Size: 8 Bytes 106 * Port Size: 8 Bytes
107 * Port Size: 8 Bit 107 * Port Size: 8 Bit
108 * Common Memory Space 108 * Common Memory Space
109 */ 109 */
110 110
111 #define CONFIG_SYS_PCMCIA_PBR1 0xFE100080 111 #define CONFIG_SYS_PCMCIA_PBR1 0xFE100080
112 #define CONFIG_SYS_PCMCIA_POR1 ( PCMCIA_BSIZE_8 \ 112 #define CONFIG_SYS_PCMCIA_POR1 ( PCMCIA_BSIZE_8 \
113 | PCMCIA_PPS_8 \ 113 | PCMCIA_PPS_8 \
114 | PCMCIA_PRS_MEM \ 114 | PCMCIA_PRS_MEM \
115 | PCMCIA_SLOT_x \ 115 | PCMCIA_SLOT_x \
116 | PCMCIA_PV \ 116 | PCMCIA_PV \
117 ) 117 )
118 118
119 /* Window 2: 119 /* Window 2:
120 * Base: 0xFE100100 CS2 120 * Base: 0xFE100100 CS2
121 * Port Size: 8 Bytes 121 * Port Size: 8 Bytes
122 * Port Size: 8 Bit 122 * Port Size: 8 Bit
123 * Common Memory Space 123 * Common Memory Space
124 */ 124 */
125 125
126 #define CONFIG_SYS_PCMCIA_PBR2 0xFE100100 126 #define CONFIG_SYS_PCMCIA_PBR2 0xFE100100
127 #define CONFIG_SYS_PCMCIA_POR2 ( PCMCIA_BSIZE_8 \ 127 #define CONFIG_SYS_PCMCIA_POR2 ( PCMCIA_BSIZE_8 \
128 | PCMCIA_PPS_8 \ 128 | PCMCIA_PPS_8 \
129 | PCMCIA_PRS_MEM \ 129 | PCMCIA_PRS_MEM \
130 | PCMCIA_SLOT_x \ 130 | PCMCIA_SLOT_x \
131 | PCMCIA_PV \ 131 | PCMCIA_PV \
132 ) 132 )
133 133
134 /* Window 3: 134 /* Window 3:
135 * not used 135 * not used
136 */ 136 */
137 #define CONFIG_SYS_PCMCIA_PBR3 0 137 #define CONFIG_SYS_PCMCIA_PBR3 0
138 #define CONFIG_SYS_PCMCIA_POR3 0 138 #define CONFIG_SYS_PCMCIA_POR3 0
139 139
140 /* Window 4: 140 /* Window 4:
141 * Base: 0xFE100C00 CS1 141 * Base: 0xFE100C00 CS1
142 * Port Size: 2 Bytes 142 * Port Size: 2 Bytes
143 * Port Size: 16 Bit 143 * Port Size: 16 Bit
144 * Common Memory Space 144 * Common Memory Space
145 */ 145 */
146 146
147 #define CONFIG_SYS_PCMCIA_PBR4 0xFE100C00 147 #define CONFIG_SYS_PCMCIA_PBR4 0xFE100C00
148 #define CONFIG_SYS_PCMCIA_POR4 ( PCMCIA_BSIZE_2 \ 148 #define CONFIG_SYS_PCMCIA_POR4 ( PCMCIA_BSIZE_2 \
149 | PCMCIA_PPS_16 \ 149 | PCMCIA_PPS_16 \
150 | PCMCIA_PRS_MEM \ 150 | PCMCIA_PRS_MEM \
151 | PCMCIA_SLOT_x \ 151 | PCMCIA_SLOT_x \
152 | PCMCIA_PV \ 152 | PCMCIA_PV \
153 ) 153 )
154 154
155 /* Window 5: 155 /* Window 5:
156 * Base: 0xFE100C80 CS1 156 * Base: 0xFE100C80 CS1
157 * Port Size: 8 Bytes 157 * Port Size: 8 Bytes
158 * Port Size: 8 Bit 158 * Port Size: 8 Bit
159 * Common Memory Space 159 * Common Memory Space
160 */ 160 */
161 161
162 #define CONFIG_SYS_PCMCIA_PBR5 0xFE100C80 162 #define CONFIG_SYS_PCMCIA_PBR5 0xFE100C80
163 #define CONFIG_SYS_PCMCIA_POR5 ( PCMCIA_BSIZE_8 \ 163 #define CONFIG_SYS_PCMCIA_POR5 ( PCMCIA_BSIZE_8 \
164 | PCMCIA_PPS_8 \ 164 | PCMCIA_PPS_8 \
165 | PCMCIA_PRS_MEM \ 165 | PCMCIA_PRS_MEM \
166 | PCMCIA_SLOT_x \ 166 | PCMCIA_SLOT_x \
167 | PCMCIA_PV \ 167 | PCMCIA_PV \
168 ) 168 )
169 169
170 /* Window 6: 170 /* Window 6:
171 * Base: 0xFE100D00 CS2 171 * Base: 0xFE100D00 CS2
172 * Port Size: 8 Bytes 172 * Port Size: 8 Bytes
173 * Port Size: 8 Bit 173 * Port Size: 8 Bit
174 * Common Memory Space 174 * Common Memory Space
175 */ 175 */
176 176
177 #define CONFIG_SYS_PCMCIA_PBR6 0xFE100D00 177 #define CONFIG_SYS_PCMCIA_PBR6 0xFE100D00
178 #define CONFIG_SYS_PCMCIA_POR6 ( PCMCIA_BSIZE_8 \ 178 #define CONFIG_SYS_PCMCIA_POR6 ( PCMCIA_BSIZE_8 \
179 | PCMCIA_PPS_8 \ 179 | PCMCIA_PPS_8 \
180 | PCMCIA_PRS_MEM \ 180 | PCMCIA_PRS_MEM \
181 | PCMCIA_SLOT_x \ 181 | PCMCIA_SLOT_x \
182 | PCMCIA_PV \ 182 | PCMCIA_PV \
183 ) 183 )
184 184
185 /* Window 7: 185 /* Window 7:
186 * not used 186 * not used
187 */ 187 */
188 #define CONFIG_SYS_PCMCIA_PBR7 0 188 #define CONFIG_SYS_PCMCIA_PBR7 0
189 #define CONFIG_SYS_PCMCIA_POR7 0 189 #define CONFIG_SYS_PCMCIA_POR7 0
190 190
191 /**********************************************************************/ 191 /**********************************************************************/
192 192
193 /* 193 /*
194 * CIS Tupel codes 194 * CIS Tupel codes
195 */ 195 */
196 #define CISTPL_NULL 0x00 196 #define CISTPL_NULL 0x00
197 #define CISTPL_DEVICE 0x01 197 #define CISTPL_DEVICE 0x01
198 #define CISTPL_LONGLINK_CB 0x02 198 #define CISTPL_LONGLINK_CB 0x02
199 #define CISTPL_INDIRECT 0x03 199 #define CISTPL_INDIRECT 0x03
200 #define CISTPL_CONFIG_CB 0x04 200 #define CISTPL_CONFIG_CB 0x04
201 #define CISTPL_CFTABLE_ENTRY_CB 0x05 201 #define CISTPL_CFTABLE_ENTRY_CB 0x05
202 #define CISTPL_LONGLINK_MFC 0x06 202 #define CISTPL_LONGLINK_MFC 0x06
203 #define CISTPL_BAR 0x07 203 #define CISTPL_BAR 0x07
204 #define CISTPL_PWR_MGMNT 0x08 204 #define CISTPL_PWR_MGMNT 0x08
205 #define CISTPL_EXTDEVICE 0x09 205 #define CISTPL_EXTDEVICE 0x09
206 #define CISTPL_CHECKSUM 0x10 206 #define CISTPL_CHECKSUM 0x10
207 #define CISTPL_LONGLINK_A 0x11 207 #define CISTPL_LONGLINK_A 0x11
208 #define CISTPL_LONGLINK_C 0x12 208 #define CISTPL_LONGLINK_C 0x12
209 #define CISTPL_LINKTARGET 0x13 209 #define CISTPL_LINKTARGET 0x13
210 #define CISTPL_NO_LINK 0x14 210 #define CISTPL_NO_LINK 0x14
211 #define CISTPL_VERS_1 0x15 211 #define CISTPL_VERS_1 0x15
212 #define CISTPL_ALTSTR 0x16 212 #define CISTPL_ALTSTR 0x16
213 #define CISTPL_DEVICE_A 0x17 213 #define CISTPL_DEVICE_A 0x17
214 #define CISTPL_JEDEC_C 0x18 214 #define CISTPL_JEDEC_C 0x18
215 #define CISTPL_JEDEC_A 0x19 215 #define CISTPL_JEDEC_A 0x19
216 #define CISTPL_CONFIG 0x1a 216 #define CISTPL_CONFIG 0x1a
217 #define CISTPL_CFTABLE_ENTRY 0x1b 217 #define CISTPL_CFTABLE_ENTRY 0x1b
218 #define CISTPL_DEVICE_OC 0x1c 218 #define CISTPL_DEVICE_OC 0x1c
219 #define CISTPL_DEVICE_OA 0x1d 219 #define CISTPL_DEVICE_OA 0x1d
220 #define CISTPL_DEVICE_GEO 0x1e 220 #define CISTPL_DEVICE_GEO 0x1e
221 #define CISTPL_DEVICE_GEO_A 0x1f 221 #define CISTPL_DEVICE_GEO_A 0x1f
222 #define CISTPL_MANFID 0x20 222 #define CISTPL_MANFID 0x20
223 #define CISTPL_FUNCID 0x21 223 #define CISTPL_FUNCID 0x21
224 #define CISTPL_FUNCE 0x22 224 #define CISTPL_FUNCE 0x22
225 #define CISTPL_SWIL 0x23 225 #define CISTPL_SWIL 0x23
226 #define CISTPL_END 0xff 226 #define CISTPL_END 0xff
227 227
228 /* 228 /*
229 * CIS Function ID codes 229 * CIS Function ID codes
230 */ 230 */
231 #define CISTPL_FUNCID_MULTI 0x00 231 #define CISTPL_FUNCID_MULTI 0x00
232 #define CISTPL_FUNCID_MEMORY 0x01 232 #define CISTPL_FUNCID_MEMORY 0x01
233 #define CISTPL_FUNCID_SERIAL 0x02 233 #define CISTPL_FUNCID_SERIAL 0x02
234 #define CISTPL_FUNCID_PARALLEL 0x03 234 #define CISTPL_FUNCID_PARALLEL 0x03
235 #define CISTPL_FUNCID_FIXED 0x04 235 #define CISTPL_FUNCID_FIXED 0x04
236 #define CISTPL_FUNCID_VIDEO 0x05 236 #define CISTPL_FUNCID_VIDEO 0x05
237 #define CISTPL_FUNCID_NETWORK 0x06 237 #define CISTPL_FUNCID_NETWORK 0x06
238 #define CISTPL_FUNCID_AIMS 0x07 238 #define CISTPL_FUNCID_AIMS 0x07
239 #define CISTPL_FUNCID_SCSI 0x08 239 #define CISTPL_FUNCID_SCSI 0x08
240 240
241 /* 241 /*
242 * Fixed Disk FUNCE codes 242 * Fixed Disk FUNCE codes
243 */ 243 */
244 #define CISTPL_IDE_INTERFACE 0x01 244 #define CISTPL_IDE_INTERFACE 0x01
245 245
246 #define CISTPL_FUNCE_IDE_IFACE 0x01 246 #define CISTPL_FUNCE_IDE_IFACE 0x01
247 #define CISTPL_FUNCE_IDE_MASTER 0x02 247 #define CISTPL_FUNCE_IDE_MASTER 0x02
248 #define CISTPL_FUNCE_IDE_SLAVE 0x03 248 #define CISTPL_FUNCE_IDE_SLAVE 0x03
249 249
250 /* First feature byte */ 250 /* First feature byte */
251 #define CISTPL_IDE_SILICON 0x04 251 #define CISTPL_IDE_SILICON 0x04
252 #define CISTPL_IDE_UNIQUE 0x08 252 #define CISTPL_IDE_UNIQUE 0x08
253 #define CISTPL_IDE_DUAL 0x10 253 #define CISTPL_IDE_DUAL 0x10
254 254
255 /* Second feature byte */ 255 /* Second feature byte */
256 #define CISTPL_IDE_HAS_SLEEP 0x01 256 #define CISTPL_IDE_HAS_SLEEP 0x01
257 #define CISTPL_IDE_HAS_STANDBY 0x02 257 #define CISTPL_IDE_HAS_STANDBY 0x02
258 #define CISTPL_IDE_HAS_IDLE 0x04 258 #define CISTPL_IDE_HAS_IDLE 0x04
259 #define CISTPL_IDE_LOW_POWER 0x08 259 #define CISTPL_IDE_LOW_POWER 0x08
260 #define CISTPL_IDE_REG_INHIBIT 0x10 260 #define CISTPL_IDE_REG_INHIBIT 0x10
261 #define CISTPL_IDE_HAS_INDEX 0x20 261 #define CISTPL_IDE_HAS_INDEX 0x20
262 #define CISTPL_IDE_IOIS16 0x40 262 #define CISTPL_IDE_IOIS16 0x40
263 263
264 #endif 264 #endif
265 265
266 #ifdef CONFIG_8xx 266 #ifdef CONFIG_8xx
267 extern u_int *pcmcia_pgcrx[]; 267 extern u_int *pcmcia_pgcrx[];
268 #define PCMCIA_PGCRX(slot) (*pcmcia_pgcrx[slot]) 268 #define PCMCIA_PGCRX(slot) (*pcmcia_pgcrx[slot])
269 #endif 269 #endif
270 270
271 #if defined(CONFIG_CMD_IDE) && defined(CONFIG_IDE_8xx_PCCARD) 271 #if defined(CONFIG_IDE) && defined(CONFIG_IDE_8xx_PCCARD)
272 extern int check_ide_device(int slot); 272 extern int check_ide_device(int slot);
273 #endif 273 #endif
274 274
275 #endif /* _PCMCIA_H */ 275 #endif /* _PCMCIA_H */
276 276