]> git.baikalelectronics.ru Git - uboot.git/commitdiff
board: turris: Find atsha device by atsha driver
authorPali Rohár <pali@kernel.org>
Thu, 19 May 2022 09:11:52 +0000 (11:11 +0200)
committerStefan Roese <sr@denx.de>
Thu, 21 Jul 2022 05:46:10 +0000 (07:46 +0200)
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>
Reviewed-by: Stefan Roese <sr@denx.de>
board/CZ.NIC/turris_atsha_otp.c

index 8c39f5e52414b14d6d68782b24347a3990c4dd90..e62b7ee2a49a0f5d1d618b6bd0b3246615b8e160 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <env.h>
 #include <net.h>
+#include <dm/device.h>
 #include <dm/uclass.h>
 #include <atsha204a-i2c.h>
 
 #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;
        }