]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
arm: mvebu: turris_omnia: Use the i2c_eeprom misc driver for EEPROM reading in U...
authorMarek Behún <kabel@kernel.org>
Thu, 29 Aug 2024 08:08:48 +0000 (10:08 +0200)
committerStefan Roese <sr@denx.de>
Tue, 3 Sep 2024 12:24:32 +0000 (14:24 +0200)
Use the i2c_eeprom miscellaneous driver for reading Turris Omnia EEPROM
in U-Boot proper. Keep using dm_i2c_read() in SPL build, since adding
the i2c_eeprom driver to SPL build increases the image by 1.5 KiB.

Signed-off-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
arch/arm/mach-mvebu/Kconfig
board/CZ.NIC/turris_omnia/turris_omnia.c
configs/turris_omnia_defconfig

index 4a8328760eb58e9b0d0770b5978ae4a3f1f5bb94..c1a1a333e6c99187c9443243b42d06b18a3e4c57 100644 (file)
@@ -149,6 +149,7 @@ config TARGET_TURRIS_OMNIA
        select SPL_SYS_MALLOC_SIMPLE
        select SYS_I2C_MVTWSI
        select ATSHA204A
+       select I2C_EEPROM
        select ARMADA_38X_SUPPORT_OLD_DDR3_TRAINING
 
 config TARGET_TURRIS_MOX
index 392df53a6d80ced454c40f63d3df8aef098386d8..46f20f05c05b5a0b9f45d9f909d562e16e875f2d 100644 (file)
@@ -23,6 +23,7 @@
 #include <dt-bindings/gpio/gpio.h>
 #include <fdt_support.h>
 #include <hexdump.h>
+#include <i2c_eeprom.h>
 #include <time.h>
 #include <turris-omnia-mcu-interface.h>
 #include <linux/bitops.h>
@@ -473,9 +474,13 @@ static bool omnia_read_eeprom(struct omnia_eeprom *oep)
        if (!eeprom)
                return false;
 
-       ret = dm_i2c_read(eeprom, 0, (void *)oep, sizeof(*oep));
+       if (IS_ENABLED(CONFIG_SPL_BUILD))
+               ret = dm_i2c_read(eeprom, 0, (void *)oep, sizeof(*oep));
+       else
+               ret = i2c_eeprom_read(eeprom, 0, (void *)oep, sizeof(*oep));
+
        if (ret) {
-               printf("dm_i2c_read failed: %i, cannot read EEPROM\n", ret);
+               printf("cannot read EEPROM: %d\n", ret);
                return false;
        }
 
index c8756a3a788f20333ec5cc6fa313a6b146a5b8bb..93f0bc53f9eeb1aaa8eb0eca9b7244d929984565 100644 (file)
@@ -92,7 +92,6 @@ CONFIG_SPL_OF_TRANSLATE=y
 CONFIG_AHCI_PCI=y
 CONFIG_AHCI_MVEBU=y
 CONFIG_DM_PCA953X=y
-CONFIG_I2C_EEPROM=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_MV=y
 CONFIG_DM_MTD=y