From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [PATCH 6/9] arm: mvebu: axp/high_speed_env_lib: Switch to DM_I2C API
Date: Thu, 18 Nov 2021 09:19:36 +0100 [thread overview]
Message-ID: <20211118081939.861407-6-sr@denx.de> (raw)
In-Reply-To: <20211118081939.861407-1-sr@denx.de>
After all Armada XP boards have been switched over from legacy I2C
support to DM I2C, let's now also convert this serdes code to use
the DM I2C API.
Signed-off-by: Stefan Roese <sr@denx.de>
---
.../mach-mvebu/serdes/axp/high_speed_env_lib.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-mvebu/serdes/axp/high_speed_env_lib.c b/arch/arm/mach-mvebu/serdes/axp/high_speed_env_lib.c
index ea3b4c7d5b72..0b63664dd8be 100644
--- a/arch/arm/mach-mvebu/serdes/axp/high_speed_env_lib.c
+++ b/arch/arm/mach-mvebu/serdes/axp/high_speed_env_lib.c
@@ -77,6 +77,7 @@ static u32 board_id_get(void)
__weak u8 board_sat_r_get(u8 dev_num, u8 reg)
{
+ struct udevice *udev;
u8 data;
u8 *dev;
u32 board_id = board_id_get();
@@ -107,8 +108,11 @@ __weak u8 board_sat_r_get(u8 dev_num, u8 reg)
}
/* Read MPP module ID */
- i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
- ret = i2c_read(dev[dev_num], 0, 1, (u8 *)&data, 1);
+ ret = i2c_get_chip_for_busnum(0, dev[dev_num], 1, &udev);
+ if (ret)
+ return MV_ERROR;
+
+ ret = dm_i2c_read(udev, 0, &data, 1);
if (ret)
return MV_ERROR;
@@ -124,13 +128,18 @@ static int board_modules_scan(void)
/* Perform scan only for DB board */
if ((board_id == DB_88F78XX0_BP_ID) ||
(board_id == DB_88F78XX0_BP_REV2_ID)) {
+ struct udevice *udev;
+
/* reset modules flags */
config_module = 0;
- i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+ ret = i2c_get_chip_for_busnum(0, MV_BOARD_PEX_MODULE_ADDR,
+ 1, &udev);
+ if (ret)
+ return MV_ERROR;
/* SERDES module (only PEX model is supported now) */
- ret = i2c_read(MV_BOARD_PEX_MODULE_ADDR, 0, 1, (u8 *)&val, 1);
+ ret = dm_i2c_read(udev, 0, &val, 1);
if (ret)
return MV_ERROR;
--
2.34.0
next prev parent reply other threads:[~2021-11-18 8:21 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-18 8:19 [PATCH 1/9] arm: mvebu: theadorable_debug_defconfig: Enable DM_I2C Stefan Roese
2021-11-18 8:19 ` [PATCH 2/9] arm: mvebu: db-mv784mp-gp_defconfig: " Stefan Roese
2021-12-18 13:43 ` Stefan Roese
2021-11-18 8:19 ` [PATCH 3/9] arm: mvebu: ds414_defconfig: " Stefan Roese
2021-12-18 13:43 ` Stefan Roese
2021-11-18 8:19 ` [PATCH 4/9] arm: mvebu: maxbcm_defconfig: " Stefan Roese
2021-12-18 13:43 ` Stefan Roese
2021-11-18 8:19 ` [PATCH 5/9] arm: mvebu: theadorable: Switch to using DM I2C API Stefan Roese
2021-12-18 13:44 ` Stefan Roese
2021-11-18 8:19 ` Stefan Roese [this message]
2021-12-18 13:44 ` [PATCH 6/9] arm: mvebu: axp/high_speed_env_lib: Switch to DM_I2C API Stefan Roese
2021-11-18 8:19 ` [PATCH 7/9] arm: mvebu: axp: Remove unreferenced ddr3_get_eprom_fabric() function Stefan Roese
2021-12-18 13:44 ` Stefan Roese
2021-11-18 8:19 ` [PATCH 8/9] arm: mvebu: axp: ddr: Switch to using DM I2C API Stefan Roese
2021-12-18 13:44 ` Stefan Roese
2021-11-18 8:19 ` [PATCH 9/9] arm: mvebu: armada-xp-theadorable.dts: Add I2C DT nodes Stefan Roese
2021-12-18 13:45 ` Stefan Roese
2021-12-18 13:43 ` [PATCH 1/9] arm: mvebu: theadorable_debug_defconfig: Enable DM_I2C Stefan Roese
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211118081939.861407-6-sr@denx.de \
--to=sr@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox