From: Tim Harvey <tharvey@gateworks.com>
To: u-boot@lists.denx.de
Subject: [PATCH 1/2] board: gateworks: venice: fix gsc_get_dev
Date: Mon, 8 Mar 2021 13:52:35 -0800 [thread overview]
Message-ID: <20210308215236.27722-1-tharvey@gateworks.com> (raw)
use dm_i2c_probe instead of i2c_get_chip which appears to be more
reliable.
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
board/gateworks/venice/gsc.c | 23 ++++++-----------------
1 file changed, 6 insertions(+), 17 deletions(-)
diff --git a/board/gateworks/venice/gsc.c b/board/gateworks/venice/gsc.c
index ad3f8d95d9..d2490e6063 100644
--- a/board/gateworks/venice/gsc.c
+++ b/board/gateworks/venice/gsc.c
@@ -125,29 +125,18 @@ enum {
static struct udevice *gsc_get_dev(int busno, int slave)
{
- struct udevice *dev;
+ static const char * const i2c[] = { "i2c at 30a20000", "i2c at 30a30000" };
+ struct udevice *dev, *bus;
int ret;
-#if (IS_ENABLED(CONFIG_SPL_BUILD))
- ret = i2c_get_chip_for_busnum(busno + 1, slave, 1, &dev);
- if (ret)
- return NULL;
-#else
- struct udevice *bus;
-
- busno--;
-
- ret = uclass_get_device_by_seq(UCLASS_I2C, busno, &bus);
+ ret = uclass_get_device_by_name(UCLASS_I2C, i2c[busno - 1], &bus);
if (ret) {
- printf("i2c%d: no bus %d\n", busno + 1, ret);
+ printf("GSC : failed I2C%d probe: %d\n", busno, ret);
return NULL;
}
- ret = i2c_get_chip(bus, slave, 1, &dev);
- if (ret) {
- printf("i2c%d at 0x%02x: no chip %d\n", busno + 1, slave, ret);
+ ret = dm_i2c_probe(bus, slave, 0, &dev);
+ if (ret)
return NULL;
- }
-#endif
return dev;
}
--
2.17.1
next reply other threads:[~2021-03-08 21:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-08 21:52 Tim Harvey [this message]
2021-03-08 21:52 ` [PATCH 2/2] board: gateworks: venice: increase CONFIG_SYS_SPL_MALLOC_SIZE Tim Harvey
2021-03-09 12:04 ` Fabio Estevam
2021-04-08 20:57 ` sbabic at denx.de
2021-03-09 12:04 ` [PATCH 1/2] board: gateworks: venice: fix gsc_get_dev Fabio Estevam
2021-04-08 20:58 ` sbabic at denx.de
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=20210308215236.27722-1-tharvey@gateworks.com \
--to=tharvey@gateworks.com \
--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