All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: imx: mx5: Convert MX53 Menlo board to DM I2C and DM RTC
@ 2022-05-08  0:19 Marek Vasut
  2022-05-23 11:33 ` sbabic
  0 siblings, 1 reply; 2+ messages in thread
From: Marek Vasut @ 2022-05-08  0:19 UTC (permalink / raw)
  To: u-boot; +Cc: Marek Vasut, Stefano Babic

Convert the board to DM I2C and DM RTC. This leads to removal of board
side iomuxc configuration, which is now done using pin control driver,
and conversion of board side legacy I2C accessors to DM ones.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
---
 board/menlo/m53menlo/m53menlo.c | 27 +++++++--------------------
 configs/m53menlo_defconfig      |  8 ++------
 2 files changed, 9 insertions(+), 26 deletions(-)

diff --git a/board/menlo/m53menlo/m53menlo.c b/board/menlo/m53menlo/m53menlo.c
index 9545e633a3d..61ab3844b87 100644
--- a/board/menlo/m53menlo/m53menlo.c
+++ b/board/menlo/m53menlo/m53menlo.c
@@ -226,16 +226,21 @@ static const char *lvds_compat_string;
 
 static int detect_lvds(struct display_info_t const *dev)
 {
+	struct udevice *idev, *ibus;
 	u8 touchid[23];
 	u8 *touchptr = &touchid[0];
 	int ret;
 
-	ret = i2c_set_bus_num(0);
+	ret = uclass_get_device_by_seq(UCLASS_I2C, 0, &ibus);
+	if (ret)
+		return 0;
+
+	ret = dm_i2c_probe(ibus, 0x38, 0, &idev);
 	if (ret)
 		return 0;
 
 	/* Touchscreen is at address 0x38, ID register is 0xbb. */
-	ret = i2c_read(0x38, 0xbb, 1, touchid, sizeof(touchid));
+	ret = dm_i2c_read(idev, 0xbb, touchid, sizeof(touchid));
 	if (ret)
 		return 0;
 
@@ -385,23 +390,6 @@ splasherr:
 	return 0;
 }
 
-#define I2C_PAD_CTRL	(PAD_CTL_SRE_FAST | PAD_CTL_DSE_HIGH | \
-			 PAD_CTL_PUS_100K_UP | PAD_CTL_ODE)
-
-static void setup_iomux_i2c(void)
-{
-	static const iomux_v3_cfg_t i2c_pads[] = {
-		/* I2C1 */
-		NEW_PAD_CTRL(MX53_PAD_EIM_D28__I2C1_SDA, I2C_PAD_CTRL),
-		NEW_PAD_CTRL(MX53_PAD_EIM_D21__I2C1_SCL, I2C_PAD_CTRL),
-		/* I2C2 */
-		NEW_PAD_CTRL(MX53_PAD_EIM_D16__I2C2_SDA, I2C_PAD_CTRL),
-		NEW_PAD_CTRL(MX53_PAD_EIM_EB2__I2C2_SCL, I2C_PAD_CTRL),
-	};
-
-	imx_iomux_v3_setup_multiple_pads(i2c_pads, ARRAY_SIZE(i2c_pads));
-}
-
 static void setup_iomux_video(void)
 {
 	static const iomux_v3_cfg_t lcd_pads[] = {
@@ -505,7 +493,6 @@ int board_early_init_f(void)
 {
 	setup_iomux_uart();
 	setup_iomux_fec();
-	setup_iomux_i2c();
 	setup_iomux_nand();
 	setup_iomux_video();
 
diff --git a/configs/m53menlo_defconfig b/configs/m53menlo_defconfig
index df4907a8263..90d3e59e57d 100644
--- a/configs/m53menlo_defconfig
+++ b/configs/m53menlo_defconfig
@@ -11,9 +11,6 @@ CONFIG_NR_DRAM_BANKS=2
 CONFIG_ENV_SIZE=0x4000
 CONFIG_ENV_OFFSET=0x100000
 CONFIG_TARGET_M53MENLO=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="imx53-m53menlo"
 CONFIG_SPL_TEXT_BASE=0x70008000
@@ -53,7 +50,6 @@ CONFIG_CMD_MII=y
 CONFIG_CMD_PING=y
 CONFIG_CMD_BMP=y
 CONFIG_CMD_BOOTCOUNT=y
-CONFIG_CMD_DATE=y
 CONFIG_CMD_BTRFS=y
 CONFIG_CMD_EXT4=y
 CONFIG_CMD_EXT4_WRITE=y
@@ -75,8 +71,7 @@ CONFIG_VERSION_VARIABLE=y
 CONFIG_DM=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_SYS_BOOTCOUNT_MAGIC=0x0B01C041
-CONFIG_SYS_I2C_LEGACY=y
-CONFIG_SPL_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MXC=y
 CONFIG_FSL_ESDHC_IMX=y
 CONFIG_MTD=y
@@ -102,6 +97,7 @@ CONFIG_PINCTRL_IMX5=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_DM_RTC=y
 CONFIG_RTC_M41T62=y
 CONFIG_MXC_UART=y
 CONFIG_SYSRESET=y
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] ARM: imx: mx5: Convert MX53 Menlo board to DM I2C and DM RTC
  2022-05-08  0:19 [PATCH] ARM: imx: mx5: Convert MX53 Menlo board to DM I2C and DM RTC Marek Vasut
@ 2022-05-23 11:33 ` sbabic
  0 siblings, 0 replies; 2+ messages in thread
From: sbabic @ 2022-05-23 11:33 UTC (permalink / raw)
  To: Marek Vasut, u-boot

> Convert the board to DM I2C and DM RTC. This leads to removal of board
> side iomuxc configuration, which is now done using pin control driver,
> and conversion of board side legacy I2C accessors to DM ones.
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Stefano Babic <sbabic@denx.de>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-23 11:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-08  0:19 [PATCH] ARM: imx: mx5: Convert MX53 Menlo board to DM I2C and DM RTC Marek Vasut
2022-05-23 11:33 ` sbabic

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.