Skip to contentSkip to conversation

mpc5200: digsy_mtc: Fix extension board detection

PATCH New Anatolij Gustschin 2 participants 2 messages Dec 7, 2011 – Dec 12, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mpc5200: digsy_mtc: Fix extension board detection

Switch to extension board detection using pci_find_device() instead of detecting by i2c access to EEPROM device on extension board.

This is a cleaner detection method since EEPROM addresses can be different on different board revisions. This also avoids "i2c_read: failed to address chip" error messages in the boot log on boards without extension board which may confuse users.

---
 board/intercontrol/digsy_mtc/digsy_mtc.c |   15 ++++++++-------
 include/configs/digsy_mtc.h              |    7 -------
 2 files changed, 8 insertions(+), 14 deletions(-)
board/intercontrol/digsy_mtc/digsy_mtc.c +8 -7
index 4d6b33d..4aa56b2 100644
@@ -49,6 +49,7 @@
 #include <libfdt.h>
 #include <fdt_support.h>
 #include <i2c.h>
+#include <mb862xx.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -226,11 +227,6 @@ static void exbo_hw_init(void)
 	struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio *)MPC5XXX_GPIO;
 	struct mpc5xxx_wu_gpio *wu_gpio =
 				(struct mpc5xxx_wu_gpio *)MPC5XXX_WU_GPIO;
-	unsigned char val;
-
-	/* 1st, check if extension board is present */
-	if (i2c_read(CONFIG_SYS_EXBO_EE_I2C_ADDRESS, 0, 1, &val, 1))
-		return;
 
 	/* configure IrDA pins (PSC6 port) as gpios */
 	gpio->port_config &= 0xFF8FFFFF;
@@ -285,8 +281,6 @@ int board_early_init_r(void)
 	/* enable CS0 */
 	setbits_be32((void *)MPC5XXX_ADDECR, (1 << 16));
 
-	exbo_hw_init();
-
 #if defined(CONFIG_USB_OHCI_NEW) && defined(CONFIG_SYS_USB_OHCI_CPU_INIT)
 	/* Low level USB init, required for proper kernel operation */
 	usb_cpu_init();
@@ -326,8 +320,15 @@ void board_get_enetaddr (uchar * enet)
 
 int misc_init_r(void)
 {
+	pci_dev_t devbusfn;
 	uchar enetaddr[6];
 
+	/* check if graphic extension board is present */
+	devbusfn = pci_find_device(PCI_VENDOR_ID_FUJITSU,
+				   PCI_DEVICE_ID_CORAL_PA, 0);
+	if (devbusfn != -1)
+		exbo_hw_init();
+
 	if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
 		board_get_enetaddr(enetaddr);
 		eth_setenv_enetaddr("ethaddr", enetaddr);
include/configs/digsy_mtc.h +0 -7
index 1e52299..40ab631 100644
@@ -293,13 +293,6 @@
 #define CONFIG_SYS_DS1339_TCR_VAL	0xAB	/* diode + 4k resistor */
 #endif
 
-/* ExBo I2C Addresses */
-#if defined(CONFIG_DIGSY_REV5)
-#define CONFIG_SYS_EXBO_EE_I2C_ADDRESS	0x54
-#else
-#define CONFIG_SYS_EXBO_EE_I2C_ADDRESS	0x56
-#endif
-
 /*
  * Flash configuration
  */
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 mpc5200: digsy_mtc: Fix extension board detection

Dear Anatolij Gustschin,

Quoted 10 lines · In message <[email protected]> you wrote:

Switch to extension board detection using pci_find_device() instead of detecting by i2c access to EEPROM device on extension board.

This is a cleaner detection method since EEPROM addresses can be different on different board revisions. This also avoids "i2c_read: failed to address chip" error messages in the boot log on boards without extension board which may confuse users.

Quoted 5 lines
---
 board/intercontrol/digsy_mtc/digsy_mtc.c |   15 ++++++++-------
 include/configs/digsy_mtc.h              |    7 -------
 2 files changed, 8 insertions(+), 14 deletions(-)

Applied, thanks.

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 one charm of marriage is that it makes a  life  of  deception  a
neccessity."                                            - Oscar Wilde