From 303dfc2e5efeaebfb7f01f2e59e5870e645376ca Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Tue, 28 Jun 2016 15:45:13 +0200 Subject: [PATCH] x86: conga-qeval20-qa3: Add SMBus support and SMSC2513 config code 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 Cc: Bin Meng Cc: Simon Glass Reviewed-by: Bin Meng --- arch/x86/dts/conga-qeval20-qa3-e3845.dts | 18 +++++---- .../conga-qeval20-qa3.c | 40 +++++++++++++++++++ ...-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 fba089d666..f0efe908e2 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@0 { + pad-offset = <0x580>; + mode-func = <1>; + }; + + smbus_data@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 737e6103f3..7a5b7659ef 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 +#include #include #include #include @@ -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 26f83ba03e..c0f51994ae 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 64fd7c9cff..463632289c 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 4c37d5e38b..652e07323e 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.30.2