📄 readme
字号:
This will allow you to use i2c commands at the u-boot command line (as long as you set CONFIG_CMD_I2C in CONFIG_COMMANDS) and communicate with i2c based realtime clock chips. See common/cmd_i2c.c for a description of the command line interface. CONFIG_I2C_CMD_TREE is a recommended option that places all I2C commands under a single 'i2c' root command. The older 'imm', 'imd', 'iprobe' etc. commands are considered deprecated and may disappear in the future. CONFIG_HARD_I2C selects a hardware I2C controller. CONFIG_SOFT_I2C configures u-boot to use a software (aka bit-banging) driver instead of CPM or similar hardware support for I2C. There are several other quantities that must also be defined when you define CONFIG_HARD_I2C or CONFIG_SOFT_I2C. In both cases you will need to define CFG_I2C_SPEED to be the frequency (in Hz) at which you wish your i2c bus to run and CFG_I2C_SLAVE to be the address of this node (ie the cpu's i2c node address). Now, the u-boot i2c code for the mpc8xx (cpu/mpc8xx/i2c.c) sets the cpu up as a master node and so its address should therefore be cleared to 0 (See, eg, MPC823e User's Manual p.16-473). So, set CFG_I2C_SLAVE to 0. That's all that's required for CONFIG_HARD_I2C. If you use the software i2c interface (CONFIG_SOFT_I2C) then the following macros need to be defined (examples are from include/configs/lwmon.h): I2C_INIT (Optional). Any commands necessary to enable the I2C controller or configure ports. eg: #define I2C_INIT (immr->im_cpm.cp_pbdir |= PB_SCL) I2C_PORT (Only for MPC8260 CPU). The I/O port to use (the code assumes both bits are on the same port). Valid values are 0..3 for ports A..D. I2C_ACTIVE The code necessary to make the I2C data line active (driven). If the data line is open collector, this define can be null. eg: #define I2C_ACTIVE (immr->im_cpm.cp_pbdir |= PB_SDA) I2C_TRISTATE The code necessary to make the I2C data line tri-stated (inactive). If the data line is open collector, this define can be null. eg: #define I2C_TRISTATE (immr->im_cpm.cp_pbdir &= ~PB_SDA) I2C_READ Code that returns TRUE if the I2C data line is high, FALSE if it is low. eg: #define I2C_READ ((immr->im_cpm.cp_pbdat & PB_SDA) != 0) I2C_SDA(bit) If <bit> is TRUE, sets the I2C data line high. If it is FALSE, it clears it (low). eg: #define I2C_SDA(bit) \ if(bit) immr->im_cpm.cp_pbdat |= PB_SDA; \ else immr->im_cpm.cp_pbdat &= ~PB_SDA I2C_SCL(bit) If <bit> is TRUE, sets the I2C clock line high. If it is FALSE, it clears it (low). eg: #define I2C_SCL(bit) \ if(bit) immr->im_cpm.cp_pbdat |= PB_SCL; \ else immr->im_cpm.cp_pbdat &= ~PB_SCL I2C_DELAY This delay is invoked four times per clock cycle so this controls the rate of data transfer. The data rate thus is 1 / (I2C_DELAY * 4). Often defined to be something like: #define I2C_DELAY udelay(2) CFG_I2C_INIT_BOARD When a board is reset during an i2c bus transfer chips might think that the current transfer is still in progress. On some boards it is possible to access the i2c SCLK line directly, either by using the processor pin as a GPIO or by having a second pin connected to the bus. If this option is defined a custom i2c_init_board() routine in boards/xxx/board.c is run early in the boot sequence. CONFIG_I2CFAST (PPC405GP|PPC405EP only) This option enables configuration of bi_iic_fast[] flags in u-boot bd_info structure based on u-boot environment variable "i2cfast". (see also i2cfast) CONFIG_I2C_MULTI_BUS This option allows the use of multiple I2C buses, each of which must have a controller. At any point in time, only one bus is active. To switch to a different bus, use the 'i2c dev' command. Note that bus numbering is zero-based. CFG_I2C_NOPROBES This option specifies a list of I2C devices that will be skipped when the 'i2c probe' command is issued (or 'iprobe' using the legacy command). If CONFIG_I2C_MULTI_BUS is set, specify a list of bus-device pairs. Otherwise, specify a 1D array of device addresses e.g. #undef CONFIG_I2C_MULTI_BUS #define CFG_I2C_NOPROBES {0x50,0x68} will skip addresses 0x50 and 0x68 on a board with one I2C bus #define CONFIG_I2C_MULTI_BUS #define CFG_I2C_MULTI_NOPROBES {{0,0x50},{0,0x68},{1,0x54}} will skip addresses 0x50 and 0x68 on bus 0 and address 0x54 on bus 1 CFG_SPD_BUS_NUM If defined, then this indicates the I2C bus number for DDR SPD. If not defined, then U-Boot assumes that SPD is on I2C bus 0. CFG_RTC_BUS_NUM If defined, then this indicates the I2C bus number for the RTC. If not defined, then U-Boot assumes that RTC is on I2C bus 0. CFG_DTT_BUS_NUM If defined, then this indicates the I2C bus number for the DTT. If not defined, then U-Boot assumes that DTT is on I2C bus 0. CONFIG_FSL_I2C Define this option if you want to use Freescale's I2C driver in drivers/fsl_i2c.c.- SPI Support: CONFIG_SPI Enables SPI driver (so far only tested with SPI EEPROM, also an instance works with Crystal A/D and D/As on the SACSng board) CONFIG_SPI_X Enables extended (16-bit) SPI EEPROM addressing. (symmetrical to CONFIG_I2C_X) CONFIG_SOFT_SPI Enables a software (bit-bang) SPI driver rather than using hardware support. This is a general purpose driver that only requires three general I/O port pins (two outputs, one input) to function. If this is defined, the board configuration must define several SPI configuration items (port pins to use, etc). For an example, see include/configs/sacsng.h.- FPGA Support: CONFIG_FPGA_COUNT Specify the number of FPGA devices to support. CONFIG_FPGA Used to specify the types of FPGA devices. For example, #define CONFIG_FPGA CFG_XILINX_VIRTEX2 CFG_FPGA_PROG_FEEDBACK Enable printing of hash marks during FPGA configuration. CFG_FPGA_CHECK_BUSY Enable checks on FPGA configuration interface busy status by the configuration function. This option will require a board or device specific function to be written. CONFIG_FPGA_DELAY If defined, a function that provides delays in the FPGA configuration driver. CFG_FPGA_CHECK_CTRLC Allow Control-C to interrupt FPGA configuration CFG_FPGA_CHECK_ERROR Check for configuration errors during FPGA bitfile loading. For example, abort during Virtex II configuration if the INIT_B line goes low (which indicated a CRC error). CFG_FPGA_WAIT_INIT Maximum time to wait for the INIT_B line to deassert after PROB_B has been deasserted during a Virtex II FPGA configuration sequence. The default time is 500 mS. CFG_FPGA_WAIT_BUSY Maximum time to wait for BUSY to deassert during Virtex II FPGA configuration. The default is 5 mS. CFG_FPGA_WAIT_CONFIG Time to wait after FPGA configuration. The default is 200 mS.- Configuration Management: CONFIG_IDENT_STRING If defined, this string will be added to the U-Boot version information (U_BOOT_VERSION)- Vendor Parameter Protection: U-Boot considers the values of the environment variables "serial#" (Board Serial Number) and "ethaddr" (Ethernet Address) to be parameters that are set once by the board vendor / manufacturer, and protects these variables from casual modification by the user. Once set, these variables are read-only, and write or delete attempts are rejected. You can change this behviour: If CONFIG_ENV_OVERWRITE is #defined in your config file, the write protection for vendor parameters is completely disabled. Anybody can change or delete these parameters. Alternatively, if you #define _both_ CONFIG_ETHADDR _and_ CONFIG_OVERWRITE_ETHADDR_ONCE, a default ethernet address is installed in the environment, which can be changed exactly ONCE by the user. [The serial# is unaffected by this, i. e. it remains read-only.]- Protected RAM: CONFIG_PRAM Define this variable to enable the reservation of "protected RAM", i. e. RAM which is not overwritten by U-Boot. Define CONFIG_PRAM to hold the number of kB you want to reserve for pRAM. You can overwrite this default value by defining an environment variable "pram" to the number of kB you want to reserve. Note that the board info structure will still show the full amount of RAM. If pRAM is reserved, a new environment variable "mem" will automatically be defined to hold the amount of remaining RAM in a form that can be passed as boot argument to Linux, for instance like that: setenv bootargs ... mem=\${mem} saveenv This way you can tell Linux not to use this memory, either, which results in a memory region that will not be affected by reboots. *WARNING* If your board configuration uses automatic detection of the RAM size, you must make sure that this memory test is non-destructive. So far, the following board configurations are known to be "pRAM-clean": ETX094, IVMS8, IVML24, SPD8xx, TQM8xxL, HERMES, IP860, RPXlite, LWMON, LANTEC, PCU_E, FLAGADM, TQM8260- Error Recovery: CONFIG_PANIC_HANG Define this variable to stop the system in case of a fatal error, so that you have to reset it manually. This is probably NOT a good idea for an embedded system where you want to system to reboot automatically as fast as possible, but it may be useful during development since you can try to debug the conditions that lead to the situation. CONFIG_NET_RETRY_COUNT This variable defines the number of retries for network operations like ARP, RARP, TFTP, or BOOTP before giving up the operation. If not defined, a default value of 5 is used.- Command Interpreter: CONFIG_AUTO_COMPLETE Enable auto completion of commands using TAB. Note that this feature has NOT been implemented yet for the "hush" shell. CFG_HUSH_PARSER Define this variable to enable the "hush" shell (from Busybox) as command line interpreter, thus enabling powerful command line syntax like if...then...else...fi conditionals or `&&' and '||' constructs ("shell scripts"). If undefined, you get the old, much simpler behaviour with a somewhat smaller memory footprint. CFG_PROMPT_HUSH_PS2 This defines the secondary prompt string, which is printed when the command interpreter needs more input to complete a command. Usually "> ". Note: In the current implementation, the local variables space and global environment variables space are separated. Local variables are those you define by simply typing `name=value'. To access a local variable later on, you have write `$name' or `${name}'; to execute the contents of a variable directly type `$name' at the command prompt. Global environment variables are those you use setenv/printenv to work with. To run a command stored in such a variable, you need to use the run command, and you must not use the '$' sign to access them. To store commands and special characters in a variable, please use double quotation marks surrounding the whole text of the variable, instead of the backslashes before semicolons and special symbols.- Commandline Editing and History: CONFIG_CMDLINE_EDITING Enable editiong and History functions for interactive commandline input operations- Default Environment: CONFIG_EXTRA_ENV_SETTINGS Define this to contain any number of null terminated strings (variable = value pairs) that will be part of the default environment compiled into the boot image. For example, place something like this in your board's config file: #define CONFIG_EXTRA_ENV_SETTINGS \ "myvar1=value1\0" \ "myvar2=value2\0" Warning: This method is based on knowledge about the internal format how the environment is stored by the U-Boot code. This is NOT an official, exported interface! Although it is unlikely that this format will change soon, there is no guarantee either. You better know what you are doing here. Note: overly (ab)use of the default environment is discouraged. Make sure to check other ways to preset the environment like the autoscript function or the boot command first.- DataFlash Support: CONFIG_HAS_DATAFLASH
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -