board: turris: Do not cache Atsha device in BSS
authorPali Rohár <pali@kernel.org>
Fri, 8 Apr 2022 14:30:13 +0000 (16:30 +0200)
committerStefan Roese <sr@denx.de>
Thu, 21 Apr 2022 10:31:36 +0000 (12:31 +0200)
Atsha device is used prior relocation and at this early stage BSS does not
have to be ready yet. So do not cache Atsha device in BSS.

Fixes support for other Turris routers.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
board/CZ.NIC/turris_atsha_otp.c

index a4a77c7..840721a 100644 (file)
 
 static struct udevice *get_atsha204a_dev(void)
 {
-       static struct udevice *dev;
-
-       if (dev)
-               return dev;
+       /* 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, "atsha204a@64", &dev)) {
                puts("Cannot find ATSHA204A on I2C bus!\n");