x86: conga-qeval20-qa3: Add SMBus support and SMSC2513 config code
authorStefan Roese <sr@denx.de>
Tue, 28 Jun 2016 13:45:13 +0000 (15:45 +0200)
committerBin Meng <bmeng.cn@gmail.com>
Tue, 16 Aug 2016 03:44:09 +0000 (11:44 +0800)
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@denx.de>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
arch/x86/dts/conga-qeval20-qa3-e3845.dts
board/congatec/conga-qeval20-qa3-e3845/conga-qeval20-qa3.c
configs/conga-qeval20-qa3-e3845-internal-uart_defconfig
configs/conga-qeval20-qa3-e3845_defconfig
include/configs/conga-qeval20-qa3-e3845.h

index fba089d6668a98eabdb02565b498860168850a12..f0efe908e2c5b8d938e93319b7cc8937e3d21042 100644 (file)
                        pad-offset = <0x3a0>;
                        mode-func = <1>;
                };
+
+               /* Add SMBus PAD configuration */
+               smbus_clk@0 {
+                       pad-offset = <0x580>;
+                       mode-func = <1>;
+               };
+
+               smbus_data@0 {
+                       pad-offset = <0x5a0>;
+                       mode-func = <1>;
+               };
        };
 
        chosen {
                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>;
index 737e6103f373c45ff3bdbbdad8061be364af0638..7a5b7659ef624cbd62f690fc10705d0ed700c20a 100644 (file)
@@ -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;
+}
index 26f83ba03e3b08029d427a6362d3e6ec45fcd64d..c0f51994ae3af7dde0d132352299e2d218140f3e 100644 (file)
@@ -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
index 64fd7c9cff41ea7cb99c235e28c3152f520a8ebe..463632289c69a12af373ddadfd0baf2231c08cb4 100644 (file)
@@ -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
index 4c37d5e38bc6d847a96957b2b877ed23f55156ab..652e07323e281c36f3d4621374e9a69420f7b24c 100644 (file)
@@ -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
 
 #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