From: "Marek Behún" <kabel@kernel.org>
To: Stefan Roese <sr@denx.de>
Cc: u-boot@lists.denx.de, "Marek Behún" <kabel@kernel.org>
Subject: [PATCH u-boot-marvell 2/3] arm: mvebu: turris_omnia: Use the i2c_eeprom misc driver for EEPROM reading in U-Boot proper
Date: Thu, 29 Aug 2024 10:08:48 +0200 [thread overview]
Message-ID: <20240829080849.20276-3-kabel@kernel.org> (raw)
In-Reply-To: <20240829080849.20276-1-kabel@kernel.org>
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>
---
arch/arm/mach-mvebu/Kconfig | 1 +
board/CZ.NIC/turris_omnia/turris_omnia.c | 9 +++++++--
configs/turris_omnia_defconfig | 1 -
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index 4a8328760eb..c1a1a333e6c 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -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
diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c
index 392df53a6d8..46f20f05c05 100644
--- a/board/CZ.NIC/turris_omnia/turris_omnia.c
+++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
@@ -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;
}
diff --git a/configs/turris_omnia_defconfig b/configs/turris_omnia_defconfig
index c8756a3a788..93f0bc53f9e 100644
--- a/configs/turris_omnia_defconfig
+++ b/configs/turris_omnia_defconfig
@@ -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
--
2.44.2
next prev parent reply other threads:[~2024-08-29 8:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-29 8:08 [PATCH u-boot-marvell 0/3] Turris Omnia DDR speed change with reset button (for 2024.10) Marek Behún
2024-08-29 8:08 ` [PATCH u-boot-marvell 1/3] arm: mvebu: turris_omnia: Rename variable holding EEPROM udevice Marek Behún
2024-09-03 6:54 ` Stefan Roese
2024-08-29 8:08 ` Marek Behún [this message]
2024-09-03 6:57 ` [PATCH u-boot-marvell 2/3] arm: mvebu: turris_omnia: Use the i2c_eeprom misc driver for EEPROM reading in U-Boot proper Stefan Roese
2024-09-03 8:04 ` Marek Behún
2024-09-03 9:30 ` Stefan Roese
2024-08-29 8:08 ` [PATCH u-boot-marvell 3/3] arm: mvebu: turris_omnia: Switch DDR speed to 1333H when reset 9 is selected Marek Behún
2024-09-03 7:06 ` Stefan Roese
2024-09-04 8:13 ` [PATCH u-boot-marvell 0/3] Turris Omnia DDR speed change with reset button (for 2024.10) 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=20240829080849.20276-3-kabel@kernel.org \
--to=kabel@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.