[PATCH] board: turris: Find atsha device by atsha driver

Stefan Roese sr at denx.de
Fri May 20 07:05:50 CEST 2022


On 19.05.22 11:11, Pali Rohár wrote:
> 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 at kernel.org>

Just curious: What exactly does this patch fix? Is there a turris
board with a differently named atsha DT entry?

Still:

Reviewed-by: Stefan Roese <sr at denx.de>

Thanks,
Stefan

> ---
>   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 at 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;
>   	}

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de


More information about the U-Boot mailing list