]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
DM: I2C: Switch display5 board to use DM_I2C
authorLukasz Majewski <lukma@denx.de>
Tue, 3 Sep 2019 14:38:39 +0000 (16:38 +0200)
committerStefano Babic <sbabic@denx.de>
Tue, 8 Oct 2019 14:35:59 +0000 (16:35 +0200)
After this commit the display5 device would use I2C driver supporting
driver model (DM_I2C).

The 'i2c' and 'eeprom' commands now use DM I2C drivers and initialize
on-bus devices according to device tree description.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
arch/arm/mach-imx/mx6/Kconfig
board/liebherr/display5/display5.c
configs/display5_defconfig
include/configs/display5.h

index 01f0121beb66d3a17d83178f162f1f31ec078d2f..ba2ab51de37434e3086d79ec3626bfdcf27c5907 100644 (file)
@@ -197,6 +197,8 @@ config TARGET_DHCOMIMX6
 config TARGET_DISPLAY5
        bool "LWN DISPLAY5 board"
        select DM
+       select DM_I2C
+       select DM_GPIO
        select DM_SERIAL
        select SUPPORT_SPL
        imply CMD_DM
index 037c4e69e59cbaeeaa4af29d1487896aea41a047..5ebc8529e9c74f33a2ad56684efc77741768f788 100644 (file)
@@ -18,7 +18,6 @@
 #include <asm/gpio.h>
 #include <malloc.h>
 #include <asm/mach-imx/iomux-v3.h>
-#include <asm/mach-imx/mxc_i2c.h>
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/mach-imx/spi.h>
 #include <mmc.h>
@@ -119,49 +118,6 @@ int dram_init(void)
        return 0;
 }
 
-#define PC     MUX_PAD_CTRL(I2C_PAD_CTRL)
-/* I2C1: TFA9879 */
-struct i2c_pads_info i2c_pad_info0 = {
-       .scl = {
-               .i2c_mode = MX6_PAD_EIM_D21__I2C1_SCL | PC,
-               .gpio_mode = MX6_PAD_EIM_D21__GPIO3_IO21 | PC,
-               .gp = IMX_GPIO_NR(3, 21)
-       },
-       .sda = {
-               .i2c_mode = MX6_PAD_EIM_D28__I2C1_SDA | PC,
-               .gpio_mode = MX6_PAD_EIM_D28__GPIO3_IO28 | PC,
-               .gp = IMX_GPIO_NR(3, 28)
-       }
-};
-
-/* I2C2: TIVO TM4C123 */
-struct i2c_pads_info i2c_pad_info1 = {
-       .scl = {
-               .i2c_mode = MX6_PAD_EIM_EB2__I2C2_SCL | PC,
-               .gpio_mode = MX6_PAD_EIM_EB2__GPIO2_IO30 | PC,
-               .gp = IMX_GPIO_NR(2, 30)
-       },
-       .sda = {
-               .i2c_mode = MX6_PAD_EIM_D16__I2C2_SDA | PC,
-               .gpio_mode = MX6_PAD_EIM_D16__GPIO3_IO16 | PC,
-               .gp = IMX_GPIO_NR(3, 16)
-       }
-};
-
-/* I2C3: PMIC PF0100, EEPROM AT24C256C */
-struct i2c_pads_info i2c_pad_info2 = {
-       .scl = {
-               .i2c_mode = MX6_PAD_EIM_D17__I2C3_SCL | PC,
-               .gpio_mode = MX6_PAD_EIM_D17__GPIO3_IO17 | PC,
-               .gp = IMX_GPIO_NR(3, 17)
-       },
-       .sda = {
-               .i2c_mode = MX6_PAD_EIM_D18__I2C3_SDA | PC,
-               .gpio_mode = MX6_PAD_EIM_D18__GPIO3_IO18 | PC,
-               .gp = IMX_GPIO_NR(3, 18)
-       }
-};
-
 iomux_v3_cfg_t const misc_pads[] = {
        /* Prod ID GPIO pins */
        MX6_PAD_NANDF_D4__GPIO2_IO04    | MUX_PAD_CTRL(NO_PAD_CTRL),
@@ -369,10 +325,6 @@ int board_init(void)
 
        udelay(25);
 
-       setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info0);
-       setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
-       setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2);
-
        return 0;
 }
 
index 6703251e0a2c191d91b5e36a046da5c3710065e9..8de5ec6306e58ec76a19ac0e37c9626de88b0bba 100644 (file)
@@ -67,6 +67,19 @@ CONFIG_DEFAULT_DEVICE_TREE="imx6q-display5"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_BOOTLIMIT=3
+CONFIG_I2C_SET_DEFAULT_BUS_NUM=y
+CONFIG_I2C_DEFAULT_BUS_NUMBER=0x2
+CONFIG_SYS_I2C_MXC=y
+CONFIG_SYS_I2C_MXC_I2C1=y
+CONFIG_SYS_I2C_MXC_I2C2=y
+CONFIG_SYS_I2C_MXC_I2C3=y
+CONFIG_MISC=y
+CONFIG_I2C_EEPROM=y
+CONFIG_SYS_I2C_EEPROM_ADDR=0x50
+CONFIG_SYS_I2C_EEPROM_BUS=2
+CONFIG_SYS_EEPROM_SIZE=32768
+CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS=5
+CONFIG_SYS_I2C_EEPROM_ADDR_LEN=2
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_FSL_USDHC=y
 CONFIG_MTD_DEVICE=y
@@ -85,4 +98,5 @@ CONFIG_PINCTRL_IMX6=y
 CONFIG_MXC_UART=y
 CONFIG_SPI=y
 CONFIG_MXC_SPI=y
+CONFIG_I2C_EDID=y
 CONFIG_IMX_WATCHDOG=y
index e503e4a0ce42a8554635e07aa1befc82ccb2a669..59f6c649f18c9fadbb86a2cf7609f36b679eb61c 100644 (file)
 #define CONFIG_MXC_UART_BASE           UART5_BASE
 
 /* I2C Configs */
-#define CONFIG_SYS_I2C
-#define CONFIG_SYS_I2C_MXC
-#define CONFIG_SYS_I2C_MXC_I2C1
-#define CONFIG_SYS_I2C_MXC_I2C2
-#define CONFIG_SYS_I2C_MXC_I2C3
 #define CONFIG_I2C_MULTI_BUS
-#define CONFIG_SYS_I2C_SPEED           100000
-#define CONFIG_I2C_EDID
-#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN  2
 
 /* Ethernet */
 #ifdef CONFIG_FEC_MXC