Skip to contentSkip to conversation

3/12 Multiadapter/multibus I2C, boards

PATCH New ksi at koi8.net 2 participants 3 messages Feb 12, 2009 – Feb 17, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 3/12 Multiadapter/multibus I2C, boards

---

board/keymile/common/common.c +21 -19
diff -purN u-boot-i2c.orig/board/keymile/common/common.c u-boot-i2c/board/keymile/common/common.c
@@ -35,11 +35,9 @@
 #include <libfdt.h>
 #endif
 
-#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
+#if defined(CONFIG_SYS_I2C_ADAPTERS)
 #include <i2c.h>
 
-extern int i2c_soft_read_pin (void);
-
 int ivm_calc_crc (unsigned char *buf, int len)
 {
 	const unsigned short crc_tab[16] = {
@@ -295,32 +293,36 @@ int ivm_analyze_eeprom (unsigned char *b
 
 int ivm_read_eeprom (void)
 {
-	I2C_MUX_DEVICE *dev = NULL;
 	uchar i2c_buffer[CONFIG_SYS_IVM_EEPROM_MAX_LEN];
+	uint	tmp = 0xffff;
+#if !defined(CONFIG_SYS_IVM_EEPROM_BUS_NUM) || !defined(CONFIG_SYS_IVM_EEPROM_ADR)
 	uchar	*buf;
-	unsigned dev_addr = CONFIG_SYS_IVM_EEPROM_ADR;
+#endif
 
 	/* First init the Bus, select the Bus */
-#if defined(CONFIG_SYS_I2C_IVM_BUS)
-	dev = i2c_mux_ident_muxstring ((uchar *)CONFIG_SYS_I2C_IVM_BUS);
+#if defined(CONFIG_SYS_IVM_EEPROM_BUS_NUM)
+	tmp = CONFIG_SYS_IVM_EEPROM_BUS_NUM;
 #else
-	buf = (unsigned char *) getenv ("EEprom_ivm");
+	buf = (unsigned char *) getenv ("EEprom_ivm_bus");
 	if (buf != NULL)
-		dev = i2c_mux_ident_muxstring (buf);
+		tmp = (uint)simple_strtoul((char *)buf, NULL, 16);
 #endif
-	if (dev == NULL) {
-		printf ("Error couldnt add Bus for IVM\n");
-		return -1;
+	if (i2c_set_bus_num(tmp)) {
+		printf ("Error couldnt set Bus (%x) for IVM\n", tmp);
+		return(-1);
 	}
-	i2c_set_bus_num (dev->busid);
 
-	buf = (unsigned char *) getenv ("EEprom_ivm_addr");
-	if (buf != NULL)
-		dev_addr = simple_strtoul ((char *)buf, NULL, 16);
+#if defined(CONFIG_SYS_IVM_EEPROM_ADR)
+		tmp = CONFIG_SYS_IVM_EEPROM_ADR;
+#else
+		buf = (unsigned char *) getenv ("EEprom_ivm_addr");
+		if (buf != NULL)
+			tmp = (uint)simple_strtoul((char *)buf, NULL, 16);
+#endif
 
-	if (eeprom_read (dev_addr, 0, i2c_buffer, CONFIG_SYS_IVM_EEPROM_MAX_LEN) != 0) {
-		printf ("Error reading EEprom\n");
-		return -2;
+	if (eeprom_read (tmp, 0, i2c_buffer, CONFIG_SYS_IVM_EEPROM_MAX_LEN) != 0) {
+		printf("Error reading EEprom\n");
+		return(-2);
 	}
 
 	return ivm_analyze_eeprom (i2c_buffer, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
board/keymile/mgcoge/mgcoge.c +0 -4
diff -purN u-boot-i2c.orig/board/keymile/mgcoge/mgcoge.c u-boot-i2c/board/keymile/mgcoge/mgcoge.c
@@ -32,10 +32,6 @@
 #include <libfdt.h>
 #endif
 
-#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
-#include <i2c.h>
-#endif
-
 #include "../common/common.h"
 
 /*
board/keymile/mgsuvd/mgsuvd.c +0 -11
diff -purN u-boot-i2c.orig/board/keymile/mgsuvd/mgsuvd.c u-boot-i2c/board/keymile/mgsuvd/mgsuvd.c
@@ -195,14 +195,3 @@ void ft_board_setup(void *blob, bd_t *bd
 	ft_blob_update (blob, bd);
 }
 #endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
-
-int i2c_soft_read_pin (void)
-{
-	int val;
-
-	*(unsigned short *)(I2C_BASE_DIR) &=  ~SDA_CONF;
-	udelay(1);
-	val = *(unsigned char *)(I2C_BASE_PORT);
-
-	return ((val & SDA_BIT) == SDA_BIT);
-}
board/lwmon/lwmon.c +1 -1
diff -purN u-boot-i2c.orig/board/lwmon/lwmon.c u-boot-i2c/board/lwmon/lwmon.c
@@ -481,7 +481,7 @@ static void kbd_init (void)
 	uchar val, errcd;
 	int i;
 
-	i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+	i2c_init_all();
 
 	gd->kbd_status = 0;
 
board/lwmon/pcmcia.c +2 -2
diff -purN u-boot-i2c.orig/board/lwmon/pcmcia.c u-boot-i2c/board/lwmon/pcmcia.c
@@ -108,7 +108,7 @@ int pcmcia_hardware_enable(int slot)
 
 	/*  switch VCC on */
 	val |= MAX1604_OP_SUS | MAX1604_VCCBON;
-	i2c_init  (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+	i2c_init_all();
 	i2c_write (CONFIG_SYS_I2C_POWER_A_ADDR, 0, 0, &val, 1);
 
 	udelay(500000);
@@ -199,7 +199,7 @@ int pcmcia_voltage_set(int slot, int vcc
 	 */
 	debug ("PCMCIA power OFF\n");
 	val  = MAX1604_VCCBHIZ | MAX1604_VPPBHIZ;
-	i2c_init  (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+	i2c_init_all();
 	i2c_write (CONFIG_SYS_I2C_POWER_A_ADDR, 0, 0, &val, 1);
 
 	val = 0;
board/omap2420h4/omap2420h4.c +4 -0
diff -purN u-boot-i2c.orig/board/omap2420h4/omap2420h4.c u-boot-i2c/board/omap2420h4/omap2420h4.c
@@ -201,7 +201,11 @@ int dram_init (void)
 	u8 vmode_on = 0x8C;
 	#define NOT_EARLY 0
 
+#if defined(CONFIG_NEW_I2C)
+	i2c_init_all();
+#else
 	i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); /* need this a bit early */
+#endif
 
 	btype = get_board_type();
 	mtype = get_mem_type();
board/omap3/common/power.c +2 -2
diff -purN u-boot-i2c.orig/board/omap3/common/power.c u-boot-i2c/board/omap3/common/power.c
@@ -41,8 +41,8 @@ void power_init_r(void)
 {
 	unsigned char byte;
 
-#ifdef CONFIG_DRIVER_OMAP34XX_I2C
-	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+#ifdef CONFIG_OMAP24XX_I2C
+	i2c_init_all();
 #endif
 
 	/*
board/omap3/evm/evm.c +2 -2
diff -purN u-boot-i2c.orig/board/omap3/evm/evm.c u-boot-i2c/board/omap3/evm/evm.c
@@ -60,8 +60,8 @@ int board_init(void)
 int misc_init_r(void)
 {
 
-#ifdef CONFIG_DRIVER_OMAP34XX_I2C
-	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+#ifdef CONFIG_OMAP24XX_I2C
+	i2c_init_all();
 #endif
 
 #if defined(CONFIG_CMD_NET)
#1 lore raw

PATCH 1/1 3/12 Multiadapter/multibus I2C, boards

Dear ksi at koi8.net,

Quoted 1 line · In message <[email protected]> you wrote:

...

board/keymile/common/common.c int ivm_analyze_eeprom (unsigned char *b · line 323

Quoted 4 lines
board/keymile/common/common.c +1 -3
-	if (eeprom_read (dev_addr, 0, i2c_buffer, CONFIG_SYS_IVM_EEPROM_MAX_LEN) != 0) {
-		printf ("Error reading EEprom\n");
-		return -2;
+	if (eeprom_read (tmp, 0, i2c_buffer, CONFIG_SYS_IVM_EEPROM_MAX_LEN) != 0) {

^^ space kept

board/keymile/common/common.c int ivm_analyze_eeprom (unsigned char *b · line 324

Quoted 1 line
board/keymile/common/common.c +1 -0
+		printf("Error reading EEprom\n");

^^ space deleted.

board/keymile/common/common.c int ivm_analyze_eeprom (unsigned char *b · line 325

Quoted 1 line
board/keymile/common/common.c +1 -0
+		return(-2);

Please do not mix coding style changes with functional changes in one patch. And please do not change style at random - leaving spaces here but removing them there. At least use a consistent style.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The price one pays for pursuing any profession,  or  calling,  is  an
intimate knowledge of its ugly side.                  - James Baldwin
#2 lore raw

PATCH 1/1 3/12 Multiadapter/multibus I2C, boards

Quoted 10 lines · Wolfgang Denk

Dear ksi at koi8.net,

Quoted 1 line · In message <[email protected]> you wrote:

...

board/keymile/common/common.c int ivm_analyze_eeprom (unsigned char *b · line 323

Quoted 4 lines
board/keymile/common/common.c +1 -3
-	if (eeprom_read (dev_addr, 0, i2c_buffer, CONFIG_SYS_IVM_EEPROM_MAX_LEN) != 0) {
-		printf ("Error reading EEprom\n");
-		return -2;
+	if (eeprom_read (tmp, 0, i2c_buffer, CONFIG_SYS_IVM_EEPROM_MAX_LEN) != 0) {

^^ space kept

Quoted 7 lines

board/keymile/common/common.c int ivm_analyze_eeprom (unsigned char *b · line 324

Quoted 1 line
board/keymile/common/common.c +1 -0
+		printf("Error reading EEprom\n");

^^ space deleted.

board/keymile/common/common.c int ivm_analyze_eeprom (unsigned char *b · line 325

Quoted 1 line
board/keymile/common/common.c +1 -0
+		return(-2);

Please do not mix coding style changes with functional changes in one patch. And please do not change style at random - leaving spaces here but removing them there. At least use a consistent style.

OK, I won't touch those.

---
******************************************************************
* KSI at home KOI8 Net < > The impossible we do immediately. *
* Las Vegas NV, USA < > Miracles require 24-hour notice. *
******************************************************************