diff options
author | Anatolij Gustschin | 2024-07-20 17:35:39 +0200 |
---|---|---|
committer | Fabio Estevam | 2024-07-22 17:55:35 -0300 |
commit | b9cc1fa4abd6cbdd2e34c3172ae48f527890002a (patch) | |
tree | ddd3cbffe4e40eb7e6221c0ac59df20f682e5aa1 | |
parent | edc9e4f52db85fe7d96b4d70694eaeb9d6a3ac14 (diff) |
mx6boards: convert to DM_I2C and DM_SERIAL
Rework to remove use of legacy I2C API. Also switch
to DM_SERIAL to avoid board removal warning.
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Eric BĂ©nard <eric@eukrea.com>
-rw-r--r-- | board/embest/mx6boards/mx6boards.c | 70 | ||||
-rw-r--r-- | configs/marsboard_defconfig | 6 | ||||
-rw-r--r-- | configs/riotboard_defconfig | 6 |
3 files changed, 10 insertions, 72 deletions
diff --git a/board/embest/mx6boards/mx6boards.c b/board/embest/mx6boards/mx6boards.c index 896350140d6..cf3368c253b 100644 --- a/board/embest/mx6boards/mx6boards.c +++ b/board/embest/mx6boards/mx6boards.c @@ -25,7 +25,6 @@ #include <asm/gpio.h> #include <asm/mach-imx/iomux-v3.h> #include <asm/mach-imx/boot_mode.h> -#include <asm/mach-imx/mxc_i2c.h> #include <asm/mach-imx/spi.h> #include <asm/mach-imx/video.h> #include <i2c.h> @@ -61,10 +60,6 @@ DECLARE_GLOBAL_DATA_PTR; #define ENET_PAD_CTRL_CLK ((PAD_CTL_PUS_100K_UP & ~PAD_CTL_PKE) | \ PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST) -#define I2C_PAD_CTRL (PAD_CTL_PUS_100K_UP | \ - PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS | \ - PAD_CTL_ODE | PAD_CTL_SRE_FAST) - #define SPI_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_SPEED_MED | \ PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST) @@ -148,57 +143,6 @@ static void setup_spi(void) } #endif -struct i2c_pads_info i2c_pad_info1 = { - .scl = { - .i2c_mode = MX6_PAD_CSI0_DAT9__I2C1_SCL - | MUX_PAD_CTRL(I2C_PAD_CTRL), - .gpio_mode = MX6_PAD_CSI0_DAT9__GPIO5_IO27 - | MUX_PAD_CTRL(I2C_PAD_CTRL), - .gp = IMX_GPIO_NR(5, 27) - }, - .sda = { - .i2c_mode = MX6_PAD_CSI0_DAT8__I2C1_SDA - | MUX_PAD_CTRL(I2C_PAD_CTRL), - .gpio_mode = MX6_PAD_CSI0_DAT8__GPIO5_IO26 - | MUX_PAD_CTRL(I2C_PAD_CTRL), - .gp = IMX_GPIO_NR(5, 26) - } -}; - -struct i2c_pads_info i2c_pad_info2 = { - .scl = { - .i2c_mode = MX6_PAD_KEY_COL3__I2C2_SCL - | MUX_PAD_CTRL(I2C_PAD_CTRL), - .gpio_mode = MX6_PAD_KEY_COL3__GPIO4_IO12 - | MUX_PAD_CTRL(I2C_PAD_CTRL), - .gp = IMX_GPIO_NR(4, 12) - }, - .sda = { - .i2c_mode = MX6_PAD_KEY_ROW3__I2C2_SDA - | MUX_PAD_CTRL(I2C_PAD_CTRL), - .gpio_mode = MX6_PAD_KEY_ROW3__GPIO4_IO13 - | MUX_PAD_CTRL(I2C_PAD_CTRL), - .gp = IMX_GPIO_NR(4, 13) - } -}; - -struct i2c_pads_info i2c_pad_info3 = { - .scl = { - .i2c_mode = MX6_PAD_GPIO_5__I2C3_SCL - | MUX_PAD_CTRL(I2C_PAD_CTRL), - .gpio_mode = MX6_PAD_GPIO_5__GPIO1_IO05 - | MUX_PAD_CTRL(I2C_PAD_CTRL), - .gp = IMX_GPIO_NR(1, 5) - }, - .sda = { - .i2c_mode = MX6_PAD_GPIO_6__I2C3_SDA - | MUX_PAD_CTRL(I2C_PAD_CTRL), - .gpio_mode = MX6_PAD_GPIO_6__GPIO1_IO06 - | MUX_PAD_CTRL(I2C_PAD_CTRL), - .gp = IMX_GPIO_NR(1, 6) - } -}; - iomux_v3_cfg_t const tft_pads_riot[] = { /* LCD_PWR_EN */ MX6_PAD_ENET_TXD1__GPIO1_IO29 | MUX_PAD_CTRL(NO_PAD_CTRL), @@ -258,8 +202,11 @@ static void do_enable_hdmi(struct display_info_t const *dev) static int detect_i2c(struct display_info_t const *dev) { - return (0 == i2c_set_bus_num(dev->bus)) && - (0 == i2c_probe(dev->addr)); + struct udevice *udev = NULL; + int ret; + + ret = i2c_get_chip_for_busnum(dev->bus, dev->addr, 1, &udev); + return ret ? 0 : 1; } struct display_info_t const displays[] = {{ @@ -400,12 +347,7 @@ int board_init(void) { /* address of boot parameters */ gd->bd->bi_boot_params = PHYS_SDRAM + 0x100; - /* i2c1 : PMIC, Audio codec on RiOT, Expansion connector on MarS */ - setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1); - /* i2c2 : HDMI EDID */ - setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2); - /* i2c3 : LVDS, Expansion connector */ - setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info3); + #ifdef CONFIG_MXC_SPI setup_spi(); #endif diff --git a/configs/marsboard_defconfig b/configs/marsboard_defconfig index 8325aaa1c9d..198fec2cb2c 100644 --- a/configs/marsboard_defconfig +++ b/configs/marsboard_defconfig @@ -10,9 +10,6 @@ CONFIG_ENV_SECT_SIZE=0x2000 CONFIG_IMX_CONFIG="board/boundary/nitrogen6x/nitrogen6q.cfg" CONFIG_MX6Q=y CONFIG_TARGET_EMBESTMX6BOARDS=y -CONFIG_SYS_I2C_MXC_I2C1=y -CONFIG_SYS_I2C_MXC_I2C2=y -CONFIG_SYS_I2C_MXC_I2C3=y CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="imx6q-marsboard" CONFIG_DISTRO_DEFAULTS=y @@ -37,7 +34,7 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ARP_TIMEOUT=200 CONFIG_BOUNCE_BUFFER=y -CONFIG_SYS_I2C_LEGACY=y +CONFIG_DM_I2C=y CONFIG_SPL_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_MXC=y CONFIG_FSL_USDHC=y @@ -50,6 +47,7 @@ CONFIG_FEC_MXC=y CONFIG_MII=y CONFIG_PINCTRL=y CONFIG_PINCTRL_IMX6=y +CONFIG_DM_SERIAL=y CONFIG_MXC_UART=y CONFIG_SPI=y CONFIG_DM_SPI=y diff --git a/configs/riotboard_defconfig b/configs/riotboard_defconfig index 1b303e738bb..a1e806be421 100644 --- a/configs/riotboard_defconfig +++ b/configs/riotboard_defconfig @@ -12,9 +12,6 @@ CONFIG_ENV_OFFSET=0x60000 CONFIG_IMX_CONFIG="board/boundary/nitrogen6x/nitrogen6s1g.cfg" CONFIG_MX6S=y CONFIG_TARGET_EMBESTMX6BOARDS=y -CONFIG_SYS_I2C_MXC_I2C1=y -CONFIG_SYS_I2C_MXC_I2C2=y -CONFIG_SYS_I2C_MXC_I2C3=y CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="imx6dl-riotboard" CONFIG_SPL_TEXT_BASE=0x00908000 @@ -53,7 +50,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_MMC_ENV_DEV=2 CONFIG_ARP_TIMEOUT=200 CONFIG_BOUNCE_BUFFER=y -CONFIG_SYS_I2C_LEGACY=y +CONFIG_DM_I2C=y CONFIG_SPL_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_MXC=y CONFIG_SUPPORT_EMMC_BOOT=y @@ -67,6 +64,7 @@ CONFIG_FEC_MXC=y CONFIG_MII=y CONFIG_PINCTRL=y CONFIG_PINCTRL_IMX6=y +CONFIG_DM_SERIAL=y CONFIG_MXC_UART=y CONFIG_SPI=y CONFIG_DM_SPI=y |