浏览代码

* 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

wdenk 22 年之前
父节点
当前提交
b37c7e5e5c
共有 5 个文件被更改,包括 75 次插入23 次删除
  1. 13 0
      CHANGELOG
  2. 51 12
      README
  3. 1 1
      common/cmd_bmp.c
  4. 9 9
      common/cmd_log.c
  5. 1 1
      include/version.h

+ 13 - 0
CHANGELOG

@@ -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:
 Changes for U-Boot 0.4.1:
 ======================================================================
 ======================================================================

+ 51 - 12
README

@@ -653,6 +653,9 @@ The following options need to be configured:
 		CONFIG_RTC_DS1338	- use Maxim, Inc. DS1338 RTC
 		CONFIG_RTC_DS1338	- use Maxim, Inc. DS1338 RTC
 		CONFIG_RTC_DS164x	- use Dallas DS164x 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:
 - Timestamp Support:
 
 
 		When CONFIG_TIMESTAMP is selected, the timestamp
 		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
 - 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.
 		command line interface.
 
 
+		CONFIG_HARD_I2C	selects the CPM hardware driver for I2C. 
+
+		CONFIG_SOFT_I2C configures u-boot to use a software (aka 
+		bit-banging) driver instead of CPM or similar hardware
+		support for I2C.
 
 
-		CONFIG_HARD_I2C
+		There are several other quantities that must also be 
+		defined when you define CONFIG_HARD_I2C or CONFIG_SOFT_I2C.
 
 
-		Selects the CPM hardware driver for 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.  
 
 
-		CONFIG_SOFT_I2C
+		That's all that's required for CONFIG_HARD_I2C. 
 
 
-		Use software (aka bit-banging) driver instead of CPM
-		or similar hardware support for I2C.  This is configured
-		via the following defines.
+		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
 		I2C_INIT
 
 
-		(Optional). Any commands necessary to enable I2C
+		(Optional). Any commands necessary to enable the I2C
 		controller or configure ports.
 		controller or configure ports.
 
 
+		eg: #define I2C_INIT (immr->im_cpm.cp_pbdir |=  PB_SCL)
+
 		I2C_PORT
 		I2C_PORT
 
 
 		(Only for MPC8260 CPU). The I/O port to use (the code
 		(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
 		(driven).  If the data line is open collector, this
 		define can be null.
 		define can be null.
 
 
+		eg: #define I2C_ACTIVE (immr->im_cpm.cp_pbdir |=  PB_SDA)
+
 		I2C_TRISTATE
 		I2C_TRISTATE
 
 
 		The code necessary to make the I2C data line tri-stated
 		The code necessary to make the I2C data line tri-stated
 		(inactive).  If the data line is open collector, this
 		(inactive).  If the data line is open collector, this
 		define can be null.
 		define can be null.
 
 
+		eg: #define I2C_TRISTATE (immr->im_cpm.cp_pbdir &= ~PB_SDA)
+
 		I2C_READ
 		I2C_READ
 
 
 		Code that returns TRUE if the I2C data line is high,
 		Code that returns TRUE if the I2C data line is high,
 		FALSE if it is low.
 		FALSE if it is low.
 
 
+		eg: #define I2C_READ ((immr->im_cpm.cp_pbdat & PB_SDA) != 0)
+
 		I2C_SDA(bit)
 		I2C_SDA(bit)
 
 
 		If <bit> is TRUE, sets the I2C data line high. If it
 		If <bit> is TRUE, sets the I2C data line high. If it
 		is FALSE, it clears it (low).
 		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)
 		I2C_SCL(bit)
 
 
 		If <bit> is TRUE, sets the I2C clock line high. If it
 		If <bit> is TRUE, sets the I2C clock line high. If it
 		is FALSE, it clears it (low).
 		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
 		I2C_DELAY
 
 
 		This delay is invoked four times per clock cycle so this
 		This delay is invoked four times per clock cycle so this
 		controls the rate of data transfer.  The data rate thus
 		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
 		CFG_I2C_INIT_BOARD
 
 

+ 1 - 1
common/cmd_bmp.c

@@ -1,6 +1,6 @@
 /*
 /*
  * (C) Copyright 2002
  * (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
  * See file CREDITS for list of people who contributed to this
  * project.
  * project.

+ 9 - 9
common/cmd_log.c

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

+ 1 - 1
include/version.h

@@ -24,6 +24,6 @@
 #ifndef	__VERSION_H__
 #ifndef	__VERSION_H__
 #define	__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__ */
 #endif	/* __VERSION_H__ */