* Patch by Seb James, 30 Jun 2003:

Improve documentation of I2C configuration in README

* Fix problems with previous log buffer "fixes"

* Fix minor help text issues

* "log append" did not append a newline
This commit is contained in:
wdenk 2003-06-30 16:24:52 +00:00
parent b0fce99bfc
commit b37c7e5e5c
5 changed files with 75 additions and 23 deletions

View File

@ -1,3 +1,16 @@
======================================================================
Changes for U-Boot 0.4.2:
======================================================================
* Patch by Seb James, 30 Jun 2003:
Improve documentation of I2C configuration in README
* Fix problems with previous log buffer "fixes"
* Fix minor help text issues
* "log append" did not append a newline
======================================================================
Changes for U-Boot 0.4.1:
======================================================================

63
README
View File

@ -653,6 +653,9 @@ The following options need to be configured:
CONFIG_RTC_DS1338 - use Maxim, Inc. DS1338 RTC
CONFIG_RTC_DS164x - use Dallas DS164x RTC
Note that if the RTC uses I2C, then the I2C interface
must also be configured. See I2C Support, below.
- Timestamp Support:
When CONFIG_TIMESTAMP is selected, the timestamp
@ -904,29 +907,48 @@ The following options need to be configured:
- I2C Support: CONFIG_HARD_I2C | CONFIG_SOFT_I2C
Enables I2C serial bus commands. If this is selected,
either CONFIG_HARD_I2C or CONFIG_SOFT_I2C must be defined
to include the appropriate I2C driver.
These enable I2C serial bus commands. Defining either of
(but not both of) CONFIG_HARD_I2C or CONFIG_SOFT_I2C will
include the appropriate I2C driver for the selected cpu.
See also: common/cmd_i2c.c for a description of the
This will allow you to use i2c commands at the u-boot
command line (as long as you set CFG_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_HARD_I2C selects the CPM hardware driver for I2C.
CONFIG_HARD_I2C
CONFIG_SOFT_I2C configures u-boot to use a software (aka
bit-banging) driver instead of CPM or similar hardware
support for I2C.
Selects the CPM hardware driver for I2C.
There are several other quantities that must also be
defined when you define CONFIG_HARD_I2C or CONFIG_SOFT_I2C.
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.
Use software (aka bit-banging) driver instead of CPM
or similar hardware support for I2C. This is configured
via the following defines.
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 I2C
(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
@ -939,32 +961,49 @@ The following options need to be configured:
(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).
is 1 / (I2C_DELAY * 4). Often defined to be something
like:
#define I2C_DELAY udelay(2)
CFG_I2C_INIT_BOARD

View File

@ -1,6 +1,6 @@
/*
* (C) Copyright 2002
* Dtlev Zundel, DENX Software Engineering, dzu@denx.de.
* Detlev Zundel, DENX Software Engineering, dzu@denx.de.
*
* See file CREDITS for list of people who contributed to this
* project.

View File

@ -74,22 +74,26 @@ static unsigned long *ext_logged_chars;
void logbuff_init_ptrs (void)
{
DECLARE_GLOBAL_DATA_PTR;
unsigned long *ext_tag;
char *s;
log_buf = (unsigned char *)(gd->bd->bi_memsize-LOGBUFF_LEN);
ext_log_start = (unsigned long *)(log_buf)-3;
ext_tag = (unsigned long *)(log_buf)-4;
ext_log_start = (unsigned long *)(log_buf)-3;
ext_log_size = (unsigned long *)(log_buf)-2;
ext_logged_chars = (unsigned long *)(log_buf)-1;
#ifdef CONFIG_POST
/* The post routines have setup the word so we can simply test it */
if (post_word_load () & POST_POWERON) {
if ((post_word_load () & 0xffff) == POST_POWERON) {
logged_chars = log_size = log_start = 0;
*ext_tag = LOGBUFF_MAGIC;
}
#else
/* No post routines, so we do our own checking */
if (post_word_load () != LOGBUFF_MAGIC) {
logged_chars = log_size = log_start = 0;
post_word_store (LOGBUFF_MAGIC);
*ext_tag = LOGBUFF_MAGIC;
}
#endif
/* Initialize default loglevel if present */
@ -162,12 +166,8 @@ int do_log (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (strcmp(argv[1],"append") == 0) {
/* Log concatenation of all arguments separated by spaces */
for (i=2; i<argc; i++) {
if (i<argc-1) {
logbuff_printk (argv[i]);
logbuff_putc (' ');
} else {
logbuff_puts (argv[i]);
}
logbuff_printk (argv[i]);
logbuff_putc ((i<argc-1) ? ' ' : '\n');
}
return 0;
}
@ -205,7 +205,7 @@ int do_log (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
cmd_tbl_t U_BOOT_CMD(LOG) = MK_CMD_ENTRY(
"log", 255, 1, do_log,
"log - manipulate logbuffer\n",
"log info - show pointer details\n"
"info - show pointer details\n"
"log reset - clear contents\n"
"log show - show contents\n"
"log append <msg> - append <msg> to the logbuffer\n"

View File

@ -24,6 +24,6 @@
#ifndef __VERSION_H__
#define __VERSION_H__
#define U_BOOT_VERSION "U-Boot 0.4.1"
#define U_BOOT_VERSION "U-Boot 0.4.2"
#endif /* __VERSION_H__ */