From: "Pali Rohár" <pali@kernel.org>
To: Marek Behun <marek.behun@nic.cz>, Stefan Roese <sr@denx.de>
Cc: u-boot@lists.denx.de
Subject: [PATCH] board: turris: Find atsha device by atsha driver
Date: Thu, 19 May 2022 11:11:52 +0200 [thread overview]
Message-ID: <20220519091152.23539-1-pali@kernel.org> (raw)
It does not matter what is DT node name of atsha device. So find it via
atsha driver and not by DT node name.
Signed-off-by: Pali Rohár <pali@kernel.org>
---
board/CZ.NIC/turris_atsha_otp.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/board/CZ.NIC/turris_atsha_otp.c b/board/CZ.NIC/turris_atsha_otp.c
index 8c39f5e52414..e62b7ee2a49a 100644
--- a/board/CZ.NIC/turris_atsha_otp.c
+++ b/board/CZ.NIC/turris_atsha_otp.c
@@ -6,6 +6,7 @@
#include <env.h>
#include <net.h>
+#include <dm/device.h>
#include <dm/uclass.h>
#include <atsha204a-i2c.h>
@@ -16,12 +17,14 @@
#define TURRIS_ATSHA_OTP_MAC0 3
#define TURRIS_ATSHA_OTP_MAC1 4
+extern U_BOOT_DRIVER(atsha204);
+
static struct udevice *get_atsha204a_dev(void)
{
/* Cannot be static because BSS does not have to be ready at this early stage */
struct udevice *dev;
- if (uclass_get_device_by_name(UCLASS_MISC, "crypto@64", &dev)) {
+ if (uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(atsha204), &dev)) {
puts("Cannot find ATSHA204A on I2C bus!\n");
dev = NULL;
}
--
2.20.1
next reply other threads:[~2022-05-19 9:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-19 9:11 Pali Rohár [this message]
2022-05-20 5:05 ` [PATCH] board: turris: Find atsha device by atsha driver Stefan Roese
2022-05-20 8:12 ` Pali Rohár
2022-07-21 12:22 ` 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=20220519091152.23539-1-pali@kernel.org \
--to=pali@kernel.org \
--cc=marek.behun@nic.cz \
--cc=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