[U-Boot] [PATCH] x86: conga-qeval20-qa3: Add SMBus support and SMSC2513 config code

Stefan Roese sr at denx.de
Tue Jun 28 15:45:13 CEST 2016


This patch includes the following changes:

- Remove Designware I2C support from dts as its not used
- Configure SMBus PADs in dts
- Enable I2C commands and I2C support
- Configure SMSC2513 USB hub via SMBus upon startup
- Move environment location to match Minnowmax example
- Enhancement of the default environment

Signed-off-by: Stefan Roese <sr at denx.de>
Cc: Bin Meng <bmeng.cn at gmail.com>
Cc: Simon Glass <sjg at chromium.org>
---
 arch/x86/dts/conga-qeval20-qa3-e3845.dts           | 18 ++++++----
 .../conga-qeval20-qa3-e3845/conga-qeval20-qa3.c    | 40 ++++++++++++++++++++++
 ...conga-qeval20-qa3-e3845-internal-uart_defconfig |  3 ++
 configs/conga-qeval20-qa3-e3845_defconfig          |  3 ++
 include/configs/conga-qeval20-qa3-e3845.h          | 12 ++++---
 5 files changed, 64 insertions(+), 12 deletions(-)

diff --git a/arch/x86/dts/conga-qeval20-qa3-e3845.dts b/arch/x86/dts/conga-qeval20-qa3-e3845.dts
index fba089d..f0efe90 100644
--- a/arch/x86/dts/conga-qeval20-qa3-e3845.dts
+++ b/arch/x86/dts/conga-qeval20-qa3-e3845.dts
@@ -46,6 +46,17 @@
 			pad-offset = <0x3a0>;
 			mode-func = <1>;
 		};
+
+		/* Add SMBus PAD configuration */
+		smbus_clk at 0 {
+			pad-offset = <0x580>;
+			mode-func = <1>;
+		};
+
+		smbus_data at 0 {
+			pad-offset = <0x5a0>;
+			mode-func = <1>;
+		};
 	};
 
 	chosen {
@@ -244,13 +255,6 @@
 		fsp,lpss-sio-enable-pci-mode;
 		fsp,enable-dma0;
 		fsp,enable-dma1;
-		fsp,enable-i2c0;
-		fsp,enable-i2c1;
-		fsp,enable-i2c2;
-		fsp,enable-i2c3;
-		fsp,enable-i2c4;
-		fsp,enable-i2c5;
-		fsp,enable-i2c6;
 		fsp,enable-pwm0;
 		fsp,enable-pwm1;
 		fsp,igd-dvmt50-pre-alloc = <2>;
diff --git a/board/congatec/conga-qeval20-qa3-e3845/conga-qeval20-qa3.c b/board/congatec/conga-qeval20-qa3-e3845/conga-qeval20-qa3.c
index 737e610..7a5b765 100644
--- a/board/congatec/conga-qeval20-qa3-e3845/conga-qeval20-qa3.c
+++ b/board/congatec/conga-qeval20-qa3-e3845/conga-qeval20-qa3.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <i2c.h>
 #include <winbond_w83627.h>
 #include <asm/gpio.h>
 #include <asm/ibmpc.h>
@@ -31,3 +32,42 @@ int arch_early_init_r(void)
 {
 	return 0;
 }
+
+int board_late_init(void)
+{
+	struct udevice *dev;
+	u8 buf[8];
+	int ret;
+
+	/* Configure SMSC USB2513 USB Hub: 7bit address 0x2c */
+	ret = i2c_get_chip_for_busnum(0, 0x2c, 1, &dev);
+	if (ret) {
+		printf("Cannot find USB2513: %d\n", ret);
+		return 0;
+	}
+
+	/*
+	 * The first access to the USB Hub fails sometimes, so lets read
+	 * a dummy byte to be sure here
+	 */
+	dm_i2c_read(dev, 0x00, buf, 1);
+
+	/*
+	 * The SMSC hub is not visible on the I2C bus after the first
+	 * configuration at power-up. The following code deliberately
+	 * does not report upon failure of these I2C write calls.
+	 */
+	buf[0] = 0x93;
+	dm_i2c_write(dev, 0x06, buf, 1);
+
+	buf[0] = 0xaa;
+	dm_i2c_write(dev, 0xf8, buf, 1);
+
+	buf[0] = 0x0f;
+	dm_i2c_write(dev, 0xfa, buf, 1);
+
+	buf[0] = 0x01;
+	dm_i2c_write(dev, 0xff, buf, 1);
+
+	return 0;
+}
diff --git a/configs/conga-qeval20-qa3-e3845-internal-uart_defconfig b/configs/conga-qeval20-qa3-e3845-internal-uart_defconfig
index 26f83ba..c0f5199 100644
--- a/configs/conga-qeval20-qa3-e3845-internal-uart_defconfig
+++ b/configs/conga-qeval20-qa3-e3845-internal-uart_defconfig
@@ -1,4 +1,5 @@
 CONFIG_X86=y
+CONFIG_DM_I2C=y
 CONFIG_VENDOR_CONGATEC=y
 CONFIG_TARGET_CONGA_QEVAL20_QA3_E3845=y
 CONFIG_DEFAULT_DEVICE_TREE="conga-qeval20-qa3-e3845"
@@ -22,6 +23,7 @@ CONFIG_CMD_CPU=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_SF=y
 CONFIG_CMD_SPI=y
+CONFIG_CMD_I2C=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_GPIO=y
 # CONFIG_CMD_SETEXPR is not set
@@ -39,6 +41,7 @@ CONFIG_OF_CONTROL=y
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
 CONFIG_CPU=y
+CONFIG_SYS_I2C_INTEL=y
 CONFIG_WINBOND_W83627=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_GIGADEVICE=y
diff --git a/configs/conga-qeval20-qa3-e3845_defconfig b/configs/conga-qeval20-qa3-e3845_defconfig
index 64fd7c9..4636322 100644
--- a/configs/conga-qeval20-qa3-e3845_defconfig
+++ b/configs/conga-qeval20-qa3-e3845_defconfig
@@ -1,4 +1,5 @@
 CONFIG_X86=y
+CONFIG_DM_I2C=y
 CONFIG_VENDOR_CONGATEC=y
 CONFIG_TARGET_CONGA_QEVAL20_QA3_E3845=y
 CONFIG_DEFAULT_DEVICE_TREE="conga-qeval20-qa3-e3845"
@@ -21,6 +22,7 @@ CONFIG_CMD_CPU=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_SF=y
 CONFIG_CMD_SPI=y
+CONFIG_CMD_I2C=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_GPIO=y
 # CONFIG_CMD_SETEXPR is not set
@@ -38,6 +40,7 @@ CONFIG_OF_CONTROL=y
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
 CONFIG_CPU=y
+CONFIG_SYS_I2C_INTEL=y
 CONFIG_WINBOND_W83627=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_GIGADEVICE=y
diff --git a/include/configs/conga-qeval20-qa3-e3845.h b/include/configs/conga-qeval20-qa3-e3845.h
index 4c37d5e..652e073 100644
--- a/include/configs/conga-qeval20-qa3-e3845.h
+++ b/include/configs/conga-qeval20-qa3-e3845.h
@@ -15,6 +15,7 @@
 
 #define CONFIG_SYS_MONITOR_LEN		(1 << 20)
 #define CONFIG_BOARD_EARLY_INIT_F
+#define CONFIG_BOARD_LATE_INIT
 #define CONFIG_ARCH_EARLY_INIT_R
 #define CONFIG_ARCH_MISC_INIT
 
@@ -41,23 +42,24 @@
 #define CONFIG_CMD_BMP
 
 #define CONFIG_ENV_SECT_SIZE		0x1000
-#define CONFIG_ENV_OFFSET		0x007fe000
+#define CONFIG_ENV_OFFSET		0x006ef000
 
 #undef CONFIG_BOOTARGS
 #undef CONFIG_BOOTCOMMAND
 
 #define CONFIG_BOOTARGS		\
-	"root=/dev/sda1 ro quiet"
+	"root=/dev/sda2 ro quiet"
 #define CONFIG_BOOTCOMMAND	\
-	"load scsi 0:1 03000000 /boot/vmlinuz-4.2.0-26-generic;" \
-	"load scsi 0:1 04000000 /boot/initrd.img-4.2.0-26-generic;" \
+	"load scsi 0:2 03000000 /boot/vmlinuz-${kernel-ver}-generic;"	\
+	"load scsi 0:2 04000000 /boot/initrd.img-${kernel-ver}-generic;" \
 	"run boot"
 
 #undef CONFIG_EXTRA_ENV_SETTINGS
 #define CONFIG_EXTRA_ENV_SETTINGS				\
+	"kernel-ver=4.4.0-22\0"					\
 	"boot=zboot 03000000 0 04000000 ${filesize}\0"		\
 	"upd_uboot=tftp 100000 conga/u-boot.rom;"		\
-		"sf probe;sf update 100000 0 7fe000\0"
+		"sf probe;sf update 100000 0 800000;saveenv\0"
 
 #define CONFIG_PREBOOT
 
-- 
2.9.0



More information about the U-Boot mailing list