dm: ppc: MPC8548CDS: add i2c DM support
authorBiwen Li <biwen.li@nxp.com>
Fri, 1 May 2020 12:56:37 +0000 (20:56 +0800)
committerPriyanka Jain <priyanka.jain@nxp.com>
Mon, 4 May 2020 03:42:36 +0000 (09:12 +0530)
This supports i2c DM for board MPC8548CDS

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
board/freescale/common/sys_eeprom.c
include/configs/MPC8548CDS.h

index 6f151b0f717b1116ddbb37bc110562361fac8bf0..c487e3a515f36f23c414ffe6d5003f6972e09238 100644 (file)
@@ -595,6 +595,7 @@ unsigned int get_cpu_board_revision(void)
                (void *)&be, sizeof(be));
 #else
        struct udevice *dev;
+       int ret;
 #ifdef CONFIG_SYS_EEPROM_BUS_NUM
        ret = i2c_get_chip_for_busnum(CONFIG_SYS_EEPROM_BUS_NUM,
                                      CONFIG_SYS_I2C_EEPROM_ADDR,
@@ -603,7 +604,7 @@ unsigned int get_cpu_board_revision(void)
 #else
        ret = i2c_get_chip_for_busnum(0, CONFIG_SYS_I2C_EEPROM_ADDR,
                                      CONFIG_SYS_I2C_EEPROM_ADDR_LEN,
-                                     &dev)
+                                     &dev);
 #endif
        if (!ret)
                dm_i2c_read(dev, 0, (void *)&be, sizeof(be));
index a68d190f6ab5ae8a06a04bbe646260a50c231048..b7796236fd476cdd9b5c581ba4d73bf8ec647b38 100644 (file)
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * Copyright 2004, 2007, 2010-2011 Freescale Semiconductor.
+ * Copyright 2020 NXP
  */
 
 /*
@@ -304,12 +305,18 @@ extern unsigned long get_clock_freq(void);
 /*
  * I2C
  */
+#ifndef CONFIG_DM_I2C
 #define CONFIG_SYS_I2C
-#define CONFIG_SYS_I2C_FSL
 #define CONFIG_SYS_FSL_I2C_SPEED       400000
 #define CONFIG_SYS_FSL_I2C_SLAVE       0x7F
 #define CONFIG_SYS_FSL_I2C_OFFSET      0x3000
 #define CONFIG_SYS_I2C_NOPROBES                { {0, 0x69} }
+#else
+#define CONFIG_SYS_SPD_BUS_NUM 0
+#define CONFIG_I2C_SET_DEFAULT_BUS_NUM
+#define CONFIG_I2C_DEFAULT_BUS_NUMBER  0
+#endif
+#define CONFIG_SYS_I2C_FSL
 
 /* EEPROM */
 #define CONFIG_ID_EEPROM