Skip to contentSkip to conversation

disable flat i2c commands when CONFIG_I2C_CMD_TREE defined

RFC PATCH New Matthias Fuchs 2 participants 2 messages Mar 2, 2007

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 disable flat i2c commands when CONFIG_I2C_CMD_TREE defined

Hi,

I noticed that when using CONFIG_I2C_CMD_TREE to enable the 'i2c' command with its sub commands, I also get the flat i2c commands (imm, iprobe, ...) compiled into u-boot.

I think this is more than I need and want.

Does anything speak against disabling the flat i2c commands when CONFIG_I2C_CMD_TREE is defined?

This is how I've done it (please skip the SPD stuff).

Matthias

common/cmd_i2c.c +4 -2
index 45cfde2..59a4276 100644
@@ -701,6 +701,7 @@ int do_sdram  ( cmd_tbl_t *cmdtp, int fl
 	switch(data[2]) {
 		case 2:  puts ("EDO\n");	break;
 		case 4:  puts ("SDRAM\n");	break;
+		case 8:  puts ("DDR2\n");	break;
 		default: puts ("unknown\n");	break;
 	}
 	puts ("Row address bits             ");
@@ -722,6 +723,7 @@ int do_sdram  ( cmd_tbl_t *cmdtp, int fl
 		case 2:  puts ("HSTL 1.5\n");	break;
 		case 3:  puts ("SSTL 3.3\n");	break;
 		case 4:  puts ("SSTL 2.5\n");	break;
+		case 5:  puts ("SSTL 1.8\n");	break;
 		default: puts ("unknown\n");	break;
 	}
 	printf("SDRAM cycle time             %d.%d nS\n",
@@ -948,6 +950,7 @@ int do_i2c(cmd_tbl_t * cmdtp, int flag,
 
 /***************************************************/
 
+#if !defined(CONFIG_I2C_CMD_TREE)
 U_BOOT_CMD(
 	imd,	4,	1,	do_i2c_md,		\
 	"imd     - i2c memory display\n",		\
@@ -1002,8 +1005,7 @@ U_BOOT_CMD(
 	"      (valid chip values 50..57)\n"
 );
 #endif
-
-#if defined(CONFIG_I2C_CMD_TREE)
+#else /* CONFIG_I2C_CMD_TREE */
 U_BOOT_CMD(
 	i2c, 6, 1, do_i2c,
  	"i2c     - I2C sub-system\n",
Signature · 5 lines
-----------------------------------------------------------------------
Dipl.-Ing. Matthias Fuchs             esd electronic system design gmbh
http://www.esd-electronics.com                    Vahrenwalder Str. 207
phone: +49-511-37298-0, fax: -68                30165 Hannover, Germany
-----------------------------------------------------------------------
#1 lore raw

RFC PATCH 1/1 disable flat i2c commands when CONFIG_I2C_CMD_TREE defined

Matthias,

Quoted 6 lines · Matthias Fuchs

Hi,

I noticed that when using CONFIG_I2C_CMD_TREE to enable the 'i2c' command with its sub commands, I also get the flat i2c commands (imm, iprobe, ...) compiled into u-boot.

Quoted 8 lines

I think this is more than I need and want.

Does anything speak against disabling the flat i2c commands when CONFIG_I2C_CMD_TREE is defined?

This is how I've done it (please skip the SPD stuff).

Matthias

Looks good. I can't think of a use case where both command formats would be useful, but maybe others can.

Please flip the order so it's

#if defined(CONFIG_I2C_CMD_TREE)
U_BOOT_CMD(

	i2c, 6, 1, do_i2c,
	...
#else
U_BOOT_CMD(
	imd,	4,	1,	do_i2c_md,		\
	...

#endif

and submit as a proper patch.

regards,
Ben