[U-Boot] [PATCH 41/41] common: Move old EEPROM functions into a new header
Simon Glass
sjg at chromium.org
Mon Sep 30 14:41:12 UTC 2019
These functions do not use driver model but are still used. Move them to a
new eeprom_legacy.h header file.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
board/atmel/common/mac_eeprom.c | 1 +
board/compulab/common/eeprom.c | 1 +
board/corscience/tricorder/tricorder-eeprom.c | 1 +
board/dhelectronics/dh_imx6/dh_imx6.c | 1 +
board/freescale/mpc8323erdb/mpc8323erdb.c | 1 +
board/kosagi/novena/novena.c | 1 +
board/phytec/phycore_rk3288/phycore-rk3288.c | 1 +
board/rockchip/tinker_rk3288/tinker-rk3288.c | 1 +
board/samtec/vining_fpga/socfpga.c | 1 +
board/ti/am43xx/board.c | 1 +
board/ti/common/board_detect.c | 1 +
board/ti/ks2_evm/board_k2g.c | 1 +
cmd/eeprom.c | 1 +
drivers/misc/i2c_eeprom.c | 1 +
drivers/mtd/mw_eeprom.c | 1 +
drivers/rtc/rv3029.c | 1 +
env/eeprom.c | 1 +
include/common.h | 15 ------------
include/eeprom_legacy.h | 24 +++++++++++++++++++
19 files changed, 41 insertions(+), 15 deletions(-)
create mode 100644 include/eeprom_legacy.h
diff --git a/board/atmel/common/mac_eeprom.c b/board/atmel/common/mac_eeprom.c
index 83a7778e995..cb9df31a6aa 100644
--- a/board/atmel/common/mac_eeprom.c
+++ b/board/atmel/common/mac_eeprom.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <dm.h>
+#include <eeprom_legacy.h>
#include <env.h>
#include <i2c_eeprom.h>
#include <netdev.h>
diff --git a/board/compulab/common/eeprom.c b/board/compulab/common/eeprom.c
index 81f69d38502..7e4ce893672 100644
--- a/board/compulab/common/eeprom.c
+++ b/board/compulab/common/eeprom.c
@@ -7,6 +7,7 @@
*/
#include <common.h>
+#include <eeprom_legacy.h>
#include <i2c.h>
#include <eeprom_layout.h>
#include <eeprom_field.h>
diff --git a/board/corscience/tricorder/tricorder-eeprom.c b/board/corscience/tricorder/tricorder-eeprom.c
index b28189dafdc..faec265fd93 100644
--- a/board/corscience/tricorder/tricorder-eeprom.c
+++ b/board/corscience/tricorder/tricorder-eeprom.c
@@ -5,6 +5,7 @@
* Andreas Bießmann <andreas.biessmann at corscience.de>
*/
#include <common.h>
+#include <eeprom_legacy.h>
#include <i2c.h>
#include <u-boot/crc.h>
diff --git a/board/dhelectronics/dh_imx6/dh_imx6.c b/board/dhelectronics/dh_imx6/dh_imx6.c
index 85e281ebb9c..3abfcc6694e 100644
--- a/board/dhelectronics/dh_imx6/dh_imx6.c
+++ b/board/dhelectronics/dh_imx6/dh_imx6.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <dm.h>
+#include <eeprom_legacy.h>
#include <init.h>
#include <dm/device-internal.h>
#include <asm/arch/clock.h>
diff --git a/board/freescale/mpc8323erdb/mpc8323erdb.c b/board/freescale/mpc8323erdb/mpc8323erdb.c
index cbec8a44e4d..a6f4dd06c25 100644
--- a/board/freescale/mpc8323erdb/mpc8323erdb.c
+++ b/board/freescale/mpc8323erdb/mpc8323erdb.c
@@ -10,6 +10,7 @@
*/
#include <common.h>
+#include <eeprom_legacy.h>
#include <env.h>
#include <init.h>
#include <ioports.h>
diff --git a/board/kosagi/novena/novena.c b/board/kosagi/novena/novena.c
index e4f0e81004e..9b2bd8f1dcf 100644
--- a/board/kosagi/novena/novena.c
+++ b/board/kosagi/novena/novena.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <dm.h>
+#include <eeprom_legacy.h>
#include <init.h>
#include <dm/device-internal.h>
#include <ahci.h>
diff --git a/board/phytec/phycore_rk3288/phycore-rk3288.c b/board/phytec/phycore_rk3288/phycore-rk3288.c
index dac59cd55df..da3119d3cec 100644
--- a/board/phytec/phycore_rk3288/phycore-rk3288.c
+++ b/board/phytec/phycore_rk3288/phycore-rk3288.c
@@ -4,6 +4,7 @@
* Author: Wadim Egorov <w.egorov at phytec.de>
*/
+#include <eeprom_legacy.h>
#include <init.h>
#include <asm/io.h>
#include <common.h>
diff --git a/board/rockchip/tinker_rk3288/tinker-rk3288.c b/board/rockchip/tinker_rk3288/tinker-rk3288.c
index 93e9d2f4653..740d309747d 100644
--- a/board/rockchip/tinker_rk3288/tinker-rk3288.c
+++ b/board/rockchip/tinker_rk3288/tinker-rk3288.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <dm.h>
+#include <eeprom_legacy.h>
#include <env.h>
#include <i2c_eeprom.h>
#include <init.h>
diff --git a/board/samtec/vining_fpga/socfpga.c b/board/samtec/vining_fpga/socfpga.c
index 1ea89063889..9a57b3deefb 100644
--- a/board/samtec/vining_fpga/socfpga.c
+++ b/board/samtec/vining_fpga/socfpga.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <eeprom_legacy.h>
#include <env.h>
#include <init.h>
#include <status_led.h>
diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
index c4018498aad..99ab7c86cc9 100644
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
@@ -8,6 +8,7 @@
*/
#include <common.h>
+#include <eeprom_legacy.h>
#include <env.h>
#include <i2c.h>
#include <init.h>
diff --git a/board/ti/common/board_detect.c b/board/ti/common/board_detect.c
index bc89cc57bd7..79f6ea423d6 100644
--- a/board/ti/common/board_detect.c
+++ b/board/ti/common/board_detect.c
@@ -8,6 +8,7 @@
*/
#include <common.h>
+#include <eeprom_legacy.h>
#include <asm/arch/hardware.h>
#include <asm/omap_common.h>
#include <dm/uclass.h>
diff --git a/board/ti/ks2_evm/board_k2g.c b/board/ti/ks2_evm/board_k2g.c
index a0fd03a39fb..05f17727251 100644
--- a/board/ti/ks2_evm/board_k2g.c
+++ b/board/ti/ks2_evm/board_k2g.c
@@ -6,6 +6,7 @@
* Texas Instruments Incorporated, <www.ti.com>
*/
#include <common.h>
+#include <eeprom_legacy.h>
#include <env.h>
#include <init.h>
#include <asm/arch/clock.h>
diff --git a/cmd/eeprom.c b/cmd/eeprom.c
index 19953df082f..8ed27a66215 100644
--- a/cmd/eeprom.c
+++ b/cmd/eeprom.c
@@ -22,6 +22,7 @@
#include <common.h>
#include <config.h>
#include <command.h>
+#include <eeprom_legacy.h>
#include <i2c.h>
#include <eeprom_layout.h>
diff --git a/drivers/misc/i2c_eeprom.c b/drivers/misc/i2c_eeprom.c
index 8f2349ad5a7..8999b05f4a5 100644
--- a/drivers/misc/i2c_eeprom.c
+++ b/drivers/misc/i2c_eeprom.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <eeprom_legacy.h>
#include <linux/err.h>
#include <linux/kernel.h>
#include <dm.h>
diff --git a/drivers/mtd/mw_eeprom.c b/drivers/mtd/mw_eeprom.c
index f7791b51a04..a2453902d44 100644
--- a/drivers/mtd/mw_eeprom.c
+++ b/drivers/mtd/mw_eeprom.c
@@ -1,6 +1,7 @@
/* Three-wire (MicroWire) serial eeprom driver (for 93C46 and compatibles) */
#include <common.h>
+#include <eeprom_legacy.h>
#include <asm/ic/ssi.h>
/*
diff --git a/drivers/rtc/rv3029.c b/drivers/rtc/rv3029.c
index 38acb9c9924..de9b68959fc 100644
--- a/drivers/rtc/rv3029.c
+++ b/drivers/rtc/rv3029.c
@@ -10,6 +10,7 @@
#include <common.h>
#include <command.h>
#include <dm.h>
+#include <eeprom_legacy.h>
#include <i2c.h>
#include <rtc.h>
diff --git a/env/eeprom.c b/env/eeprom.c
index f0bdf2a1416..cfd5dba10a6 100644
--- a/env/eeprom.c
+++ b/env/eeprom.c
@@ -9,6 +9,7 @@
#include <common.h>
#include <command.h>
+#include <eeprom_legacy.h>
#include <env.h>
#include <env_internal.h>
#include <linux/stddef.h>
diff --git a/include/common.h b/include/common.h
index 64d0cf542e8..8b37b587474 100644
--- a/include/common.h
+++ b/include/common.h
@@ -116,21 +116,6 @@ phys_size_t get_effective_memsize(void);
void reset_phy (void);
void fdc_hw_init (void);
-/* $(BOARD)/eeprom.c */
-#ifdef CONFIG_CMD_EEPROM
-void eeprom_init (int bus);
-int eeprom_read (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt);
-int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt);
-#else
-/*
- * Some EEPROM code is depecated because it used the legacy I2C interface. Add
- * some macros here so we don't have to touch every one of those uses
- */
-#define eeprom_init(bus)
-#define eeprom_read(dev_addr, offset, buffer, cnt) ((void)-ENOSYS)
-#define eeprom_write(dev_addr, offset, buffer, cnt) ((void)-ENOSYS)
-#endif
-
#if !defined(CONFIG_ENV_EEPROM_IS_ON_I2C) && defined(CONFIG_SYS_I2C_EEPROM_ADDR)
# define CONFIG_SYS_DEF_EEPROM_ADDR CONFIG_SYS_I2C_EEPROM_ADDR
#endif
diff --git a/include/eeprom_legacy.h b/include/eeprom_legacy.h
new file mode 100644
index 00000000000..61eb826a734
--- /dev/null
+++ b/include/eeprom_legacy.h
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2000-2009
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ */
+
+#ifndef __EEPROM_LEGACY_H
+#define __EEPROM_LEGACY_H
+
+#ifdef CONFIG_CMD_EEPROM
+void eeprom_init(int bus);
+int eeprom_read(uint dev_addr, uint offset, uchar *buffer, uint cnt);
+int eeprom_write(uint dev_addr, uint offset, uchar *buffer, uint cnt);
+#else
+/*
+ * Some EEPROM code is depecated because it used the legacy I2C interface. Add
+ * some macros here so we don't have to touch every one of those uses
+ */
+#define eeprom_init(bus)
+#define eeprom_read(dev_addr, offset, buffer, cnt) ((void)-ENOSYS)
+#define eeprom_write(dev_addr, offset, buffer, cnt) ((void)-ENOSYS)
+#endif
+
+#endif
--
2.23.0.444.g18eeb5a265-goog
More information about the U-Boot
mailing list