Skip to contentSkip to conversation

i2c: Chip away at some old code

PATCH In review Simon Glass 2 participants 38 messages Aug 11, 2024 – Aug 13, 2024

Subsystems (6)
USB Arm i.MX and Layerscape MIPS I2C +2 more subsystems
lore
Share & tools
lore
#0 lore raw

v2 cover i2c: Chip away at some old code

This series aims to remove some of the older contents of i2c.h so that we can move towards having just the dm API.

It does not remove any boards, but instead removes functionality.

Changes in v2:
- Drop omap3_beagle.h change as that board was removed
- Leave pg_wcom alone as its boards were converted
- Drop patch "pg-wcom: Drop CFG_SYS_I2C_MAX_HOPS"

Simon Glass (18):
i2c: Remove board_i2c_init()
i2c: Remove IC2_xxx enum
i2c: Remove CFG_I2C_MULTI_BUS
mips: malta: Drop CMD_DATE
armv8: ls2085a: Drop CMD_DATE
mx28 / mx51: Drop CMD_DATE
MPC837XERDB: ethernut5: work_92105: Drop CMD_DATE
rtc: Drop CFG_SYS_RTC_BUS_NUM
date: Drop the legacy I2C code
fsl: mxc: Drop legacy I2c
i2c: Drop reference to SYS_I2C_INIT_BOARD
octeon: Drop OCTEON_I2C_FDT dead code
i2c: Remove I2C_SET_BUS()
i2c: Remove I2C_GET_BUS()
i2c: Drop CFG_SYS_MAX_I2C_BUS
i2c: Drop i2c_get_bus_num_fdt() and i2c_reset_port_fdt()
i2c: Remove CFG_SYS_I2C_MAX_HOPS
i2c: Remove CFG_SYS_I2C_DIRECT_BUS

 README                             |  27 +-----
 arch/mips/mach-octeon/octeon_fdt.c |   7 --
 cmd/date.c                         |  32 -------
 cmd/i2c.c                          |  23 -----
 configs/MPC837XERDB_defconfig      |   1 -
 configs/ethernut5_defconfig        |   1 -
 configs/ls2080aqds_nand_defconfig  |   1 -
 configs/ls2080aqds_qspi_defconfig  |   1 -
 configs/ls2080ardb_nand_defconfig  |   1 -
 configs/malta64_defconfig          |   1 -
 configs/malta64el_defconfig        |   1 -
 configs/malta_defconfig            |   1 -
 configs/maltael_defconfig          |   1 -
 configs/mx28evk_defconfig          |   1 -
 configs/mx51evk_defconfig          |   1 -
 configs/work_92105_defconfig       |   1 -
 doc/I2C_Edge_Conditions            |  10 +-
 drivers/ddr/fsl/main.c             |   3 +-
 drivers/i2c/i2c_core.c             | 141 -----------------------------
 drivers/i2c/mxc_i2c.c              |   1 +
 drivers/i2c/soft_i2c.c             |  11 ---
 drivers/power/power_i2c.c          |   5 -
 drivers/usb/host/ohci-lpc32xx.c    |   4 -
 include/configs/ethernut5.h        |   3 -
 include/configs/ls1028aqds.h       |   1 -
 include/configs/ls1028ardb.h       |   2 -
 include/configs/ls1046afrwy.h      |   1 -
 include/configs/lx2160aqds.h       |   3 -
 include/configs/lx2160ardb.h       |   3 -
 include/configs/lx2162aqds.h       |   3 -
 include/configs/m53menlo.h         |   2 -
 include/configs/sniper.h           |  14 ---
 include/configs/tqma6.h            |   3 -
 include/configs/tqma6_wru4.h       |   1 -
 include/i2c.h                      | 107 ----------------------
 35 files changed, 7 insertions(+), 412 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/18 i2c: Remove board_i2c_init()

This function is not used, so drop it.

---

(no changes since v1)

 include/i2c.h | 8 --------
 1 file changed, 8 deletions(-)
include/i2c.h +0 -8
index 4e59009cd93..8d91b24b43b 100644
@@ -972,14 +972,6 @@ enum {
 	I2C_8, I2C_9, I2C_10,
 };
 
-/**
- * Get FDT values for i2c bus.
- *
- * @param blob  Device tree blbo
- * Return: the number of I2C bus
- */
-void board_i2c_init(const void *blob);
-
 /**
  * Find the I2C bus number by given a FDT I2C node.
  *
Signature · 1 line
2.34.1
Reviewed-by on v2 1/18
#2 lore raw

Re: [PATCH v2 01/18] i2c: Remove board_i2c_init()

Hello Simon,

Quoted 9 lines · Simon Glass

This function is not used, so drop it.

---

(no changes since v1)

  include/i2c.h | 8 --------
  1 file changed, 8 deletions(-)

Thanks!

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#3 lore raw

PATCH v2 2/18 i2c: Remove IC2_xxx enum

In reply to Simon Glass

This is only used by devkit3250 which is being removed. Drop it.

---

(no changes since v1)

 drivers/usb/host/ohci-lpc32xx.c | 4 ----
 include/i2c.h                   | 6 ------
 2 files changed, 10 deletions(-)
drivers/usb/host/ohci-lpc32xx.c +0 -4
index ed04cae7afe..bf89bf8ab49 100644
@@ -94,10 +94,6 @@ static int isp1301_set_value(struct udevice *dev, int reg, u8 value)
 
 static void isp1301_configure(struct udevice *dev)
 {
-#if !CONFIG_IS_ENABLED(DM_I2C)
-	i2c_set_bus_num(I2C_2);
-#endif
-
 	/*
 	 * LPC32XX only supports DAT_SE0 USB mode
 	 * This sequence is important
include/i2c.h +0 -6
index 8d91b24b43b..1d3be3f6759 100644
@@ -966,12 +966,6 @@ static inline void I2C_SET_BUS(unsigned int bus)
 		i2c_set_bus_num(bus);
 }
 
-/* Multi I2C definitions */
-enum {
-	I2C_0, I2C_1, I2C_2, I2C_3, I2C_4, I2C_5, I2C_6, I2C_7,
-	I2C_8, I2C_9, I2C_10,
-};
-
 /**
  * Find the I2C bus number by given a FDT I2C node.
  *
Signature · 1 line
2.34.1
Reviewed-by on v2 2/18
#4 lore raw

Re: [PATCH v2 02/18] i2c: Remove IC2_xxx enum

Hello Simon,

Quoted 10 lines · Simon Glass

This is only used by devkit3250 which is being removed. Drop it.

---

(no changes since v1)

  drivers/usb/host/ohci-lpc32xx.c | 4 ----
  include/i2c.h                   | 6 ------
  2 files changed, 10 deletions(-)

Thanks!

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#5 lore raw

PATCH v2 3/18 i2c: Remove CFG_I2C_MULTI_BUS

In reply to Simon Glass

This is used by a few boards but we are years past the migration date, so let's drop it now.

---

Changes in v2:
- Drop omap3_beagle.h change as that board was removed

 README                   |  7 -------
 include/configs/sniper.h | 14 --------------
 include/configs/tqma6.h  |  3 ---
 include/i2c.h            |  2 +-
 4 files changed, 1 insertion(+), 25 deletions(-)
README +0 -7
index b76449b70a8..c3821c5ce4e 100644
@@ -883,13 +883,6 @@ The following options need to be configured:
 		You should define these to the GPIO value as given directly to
 		the generic GPIO functions.
 
-		CFG_I2C_MULTI_BUS
-
-		This option allows the use of multiple I2C buses, each of which
-		must have a controller.	 At any point in time, only one bus is
-		active.	 To switch to a different bus, use the 'i2c dev' command.
-		Note that bus numbering is zero-based.
-
 		CFG_SYS_I2C_NOPROBES
 
 		This option specifies a list of I2C devices that will be skipped
include/configs/sniper.h +0 -14
index 45a3102aeee..d0ae5e18605 100644
@@ -34,20 +34,6 @@
 
 #define CFG_SYS_SDRAM_BASE		0x80000000
 
-/*
- * I2C
- */
-
-#define CFG_I2C_MULTI_BUS
-
-/*
- * Input
- */
-
-/*
- * SPL
- */
-
 /*
  * Serial
  */
include/configs/tqma6.h +0 -3
index 2da76f15431..ceeed174ec5 100644
@@ -26,9 +26,6 @@
 
 #define TQMA6_SPI_FLASH_SECTOR_SIZE	SZ_64K
 
-/* I2C Configs */
-#define CFG_I2C_MULTI_BUS
-
 #if !defined(CONFIG_DM_PMIC)
 #define CFG_POWER_PFUZE100_I2C_ADDR	0x08
 #define TQMA6_PFUZE100_I2C_BUS		2
include/i2c.h +1 -1
index 1d3be3f6759..622540c8265 100644
@@ -942,7 +942,7 @@ unsigned int i2c_get_bus_speed(void);
  * only for backwardcompatibility, should go away if we switched
  * completely to new multibus support.
  */
-#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) || defined(CFG_I2C_MULTI_BUS)
+#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
 # if !defined(CFG_SYS_MAX_I2C_BUS)
 #  define CFG_SYS_MAX_I2C_BUS		2
 # endif
Signature · 1 line
2.34.1
Reviewed-by on v2 3/18
#6 lore raw

Re: [PATCH v2 03/18] i2c: Remove CFG_I2C_MULTI_BUS

Hello Simon,

Quoted 6 lines · Simon Glass

This is used by a few boards but we are years past the migration date, so let's drop it now.

---

Quoted 8 lines

Changes in v2:
- Drop omap3_beagle.h change as that board was removed

  README                   |  7 -------
  include/configs/sniper.h | 14 --------------
  include/configs/tqma6.h  |  3 ---
  include/i2c.h            |  2 +-
  4 files changed, 1 insertion(+), 25 deletions(-)

Thanks!

bye,
Heiko

Signature · 4 lines
-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#7 lore raw

PATCH v2 4/18 mips: malta: Drop CMD_DATE

In reply to Simon Glass

These boards use pre-driver model code and it is several years since the migration deadline. Disable the 'date' command so that this old code can be removed.

---

(no changes since v1)

 configs/malta64_defconfig   | 1 -
 configs/malta64el_defconfig | 1 -
 configs/malta_defconfig     | 1 -
 configs/maltael_defconfig   | 1 -
 4 files changed, 4 deletions(-)
configs/malta64_defconfig +0 -1
index ff371daaa0d..8ac29b9289f 100644
@@ -27,7 +27,6 @@ CONFIG_CMD_PCI=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_DHCP=y
 CONFIG_CMD_PING=y
-CONFIG_CMD_DATE=y
 # CONFIG_ISO_PARTITION is not set
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_SYS_IDE_MAXBUS=1
configs/malta64el_defconfig +0 -1
index 5b130bcde9b..0a71013d5fc 100644
@@ -29,7 +29,6 @@ CONFIG_CMD_PCI=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_DHCP=y
 CONFIG_CMD_PING=y
-CONFIG_CMD_DATE=y
 # CONFIG_ISO_PARTITION is not set
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_SYS_IDE_MAXBUS=1
configs/malta_defconfig +0 -1
index ce917a69de5..355292ef950 100644
@@ -26,7 +26,6 @@ CONFIG_CMD_PCI=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_DHCP=y
 CONFIG_CMD_PING=y
-CONFIG_CMD_DATE=y
 # CONFIG_ISO_PARTITION is not set
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_SYS_IDE_MAXBUS=1
configs/maltael_defconfig +0 -1
index de29a7a3a5b..ffd27713963 100644
@@ -28,7 +28,6 @@ CONFIG_CMD_PCI=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_DHCP=y
 CONFIG_CMD_PING=y
-CONFIG_CMD_DATE=y
 # CONFIG_ISO_PARTITION is not set
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_SYS_IDE_MAXBUS=1
Signature · 1 line
2.34.1
Reviewed-by on v2 4/18
#8 lore raw

Re: [PATCH v2 04/18] mips: malta: Drop CMD_DATE

Hello Simon,

Quoted 7 lines · Simon Glass

These boards use pre-driver model code and it is several years since the migration deadline. Disable the 'date' command so that this old code can be removed.

---

Quoted 7 lines

(no changes since v1)

  configs/malta64_defconfig   | 1 -
  configs/malta64el_defconfig | 1 -
  configs/malta_defconfig     | 1 -
  configs/maltael_defconfig   | 1 -
  4 files changed, 4 deletions(-)

Thanks!

bye,
Heiko

Signature · 4 lines
-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#9 lore raw

PATCH v2 5/18 armv8: ls2085a: Drop CMD_DATE

In reply to Simon Glass

These boards use pre-driver model code and it is several years since the migration deadline. Disable the 'date' command so that this old code can be removed.

---

(no changes since v1)

 configs/ls2080aqds_nand_defconfig | 1 -
 configs/ls2080aqds_qspi_defconfig | 1 -
 configs/ls2080ardb_nand_defconfig | 1 -
 3 files changed, 3 deletions(-)
configs/ls2080aqds_nand_defconfig +0 -1
index 06e41546d67..0066414f0f5 100644
@@ -61,7 +61,6 @@ CONFIG_CMD_PCI=y
 CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_CACHE=y
-CONFIG_CMD_DATE=y
 # CONFIG_ISO_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_OF_CONTROL=y
configs/ls2080aqds_qspi_defconfig +0 -1
index 0b54bc999e7..44a1459749f 100644
@@ -43,7 +43,6 @@ CONFIG_CMD_PCI=y
 CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_CACHE=y
-CONFIG_CMD_DATE=y
 # CONFIG_ISO_PARTITION is not set
 CONFIG_OF_CONTROL=y
 CONFIG_OF_EMBED=y
configs/ls2080ardb_nand_defconfig +0 -1
index f1009e1738b..cbc8d6a5cf4 100644
@@ -68,7 +68,6 @@ CONFIG_CMD_PCI=y
 CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_CACHE=y
-CONFIG_CMD_DATE=y
 CONFIG_OF_CONTROL=y
 CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_NAND=y
Signature · 1 line
2.34.1
Reviewed-by on v2 5/18
#10 lore raw

Re: [PATCH v2 05/18] armv8: ls2085a: Drop CMD_DATE

Hello Simon,

Quoted 5 lines · Simon Glass

These boards use pre-driver model code and it is several years since the migration deadline. Disable the 'date' command so that this old code can be removed.

Quoted 8 lines

---

(no changes since v1)

  configs/ls2080aqds_nand_defconfig | 1 -
  configs/ls2080aqds_qspi_defconfig | 1 -
  configs/ls2080ardb_nand_defconfig | 1 -
  3 files changed, 3 deletions(-)

Thanks!

bye,
Heiko

Signature · 4 lines
-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#11 lore raw

PATCH v2 6/18 mx28 / mx51: Drop CMD_DATE

In reply to Simon Glass

These use pre-driver model code and it is several years since the migration deadline. Disable the 'date' command so that this old code can be removed.

---

(no changes since v1)

 configs/mx28evk_defconfig | 1 -
 configs/mx51evk_defconfig | 1 -
 2 files changed, 2 deletions(-)
configs/mx28evk_defconfig +0 -1
index 1fe68ef93f9..dddb57efd3e 100644
@@ -32,7 +32,6 @@ CONFIG_CMD_MMC=y
 CONFIG_CMD_NAND_TRIMFFS=y
 CONFIG_CMD_USB_MASS_STORAGE=y
 CONFIG_CMD_CACHE=y
-CONFIG_CMD_DATE=y
 CONFIG_CMD_EXT4=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
configs/mx51evk_defconfig +0 -1
index e5178fb3d6b..5932a15a33d 100644
@@ -31,7 +31,6 @@ CONFIG_CMD_USB=y
 CONFIG_CMD_DHCP=y
 CONFIG_CMD_MII=y
 CONFIG_CMD_PING=y
-CONFIG_CMD_DATE=y
 CONFIG_CMD_FAT=y
 CONFIG_OF_CONTROL=y
 CONFIG_ENV_OVERWRITE=y
Signature · 1 line
2.34.1
Reviewed-by on v2 6/18
#12 lore raw

Re: [PATCH v2 06/18] mx28 / mx51: Drop CMD_DATE

Hello Simon,

Quoted 4 lines · Simon Glass

These use pre-driver model code and it is several years since the migration deadline. Disable the 'date' command so that this old code can be removed.

Quoted 8 lines

---

(no changes since v1)

  configs/mx28evk_defconfig | 1 -
  configs/mx51evk_defconfig | 1 -
  2 files changed, 2 deletions(-)

Thanks!

bye,
Heiko

Signature · 4 lines
-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#13 lore raw

PATCH v2 7/18 MPC837XERDB: ethernut5: work_92105: Drop CMD_DATE

In reply to Simon Glass

These use pre-driver model code and it is several years since the migration deadline. Disable the 'date' command so that this old code can be removed.

---

(no changes since v1)

 configs/MPC837XERDB_defconfig | 1 -
 configs/ethernut5_defconfig   | 1 -
 configs/work_92105_defconfig  | 1 -
 3 files changed, 3 deletions(-)
configs/MPC837XERDB_defconfig +0 -1
index 9eac43a0fcb..dd30e8d30da 100644
@@ -139,7 +139,6 @@ CONFIG_CMD_USB=y
 CONFIG_BOOTP_BOOTFILESIZE=y
 CONFIG_CMD_MII=y
 CONFIG_CMD_PING=y
-CONFIG_CMD_DATE=y
 CONFIG_CMD_EXT2=y
 CONFIG_CMD_FAT=y
 CONFIG_OF_CONTROL=y
configs/ethernut5_defconfig +0 -1
index cc2f567c8a8..004f1866162 100644
@@ -46,7 +46,6 @@ CONFIG_CMD_SNTP=y
 CONFIG_CMD_DNS=y
 CONFIG_CMD_BSP=y
 CONFIG_CMD_CACHE=y
-CONFIG_CMD_DATE=y
 CONFIG_CMD_EXT2=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_JFFS2=y
configs/work_92105_defconfig +0 -1
index 4b73e1551ce..e7da0de5df1 100644
@@ -47,7 +47,6 @@ CONFIG_CMD_NAND=y
 CONFIG_CMD_DHCP=y
 CONFIG_CMD_MII=y
 CONFIG_CMD_PING=y
-CONFIG_CMD_DATE=y
 CONFIG_DOS_PARTITION=y
 CONFIG_ENV_IS_IN_NAND=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
Signature · 1 line
2.34.1
Reviewed-by on v2 7/18
#14 lore raw

Re: [PATCH v2 07/18] MPC837XERDB: ethernut5: work_92105: Drop CMD_DATE

Hello Simon,

Quoted 5 lines · Simon Glass

These use pre-driver model code and it is several years since the migration deadline. Disable the 'date' command so that this old code can be removed.

Quoted 8 lines

---

(no changes since v1)

  configs/MPC837XERDB_defconfig | 1 -
  configs/ethernut5_defconfig   | 1 -
  configs/work_92105_defconfig  | 1 -
  3 files changed, 3 deletions(-)

Thanks!

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#15 lore raw

PATCH v2 8/18 rtc: Drop CFG_SYS_RTC_BUS_NUM

In reply to Simon Glass

This option is very old and the migration deadline was years ago. Drop it so that the I2C system can be simplified.

---

(no changes since v1)

 README                        | 5 -----
 cmd/date.c                    | 6 ------
 include/configs/ls1028aqds.h  | 1 -
 include/configs/ls1028ardb.h  | 2 --
 include/configs/ls1046afrwy.h | 1 -
 include/configs/lx2160aqds.h  | 3 ---
 include/configs/lx2160ardb.h  | 3 ---
 include/configs/lx2162aqds.h  | 3 ---
 include/configs/m53menlo.h    | 2 --
 include/configs/tqma6_wru4.h  | 1 -
 include/i2c.h                 | 5 -----
 11 files changed, 32 deletions(-)
README +0 -5
index c3821c5ce4e..37c959cc9c2 100644
@@ -893,11 +893,6 @@ The following options need to be configured:
 
 		will skip addresses 0x50 and 0x68 on a board with one I2C bus
 
-		CFG_SYS_RTC_BUS_NUM
-
-		If defined, then this indicates the I2C bus number for the RTC.
-		If not defined, then U-Boot assumes that RTC is on I2C bus 0.
-
 		CONFIG_SOFT_I2C_READ_REPEATED_START
 
 		defining this will force the i2c_read() function in
cmd/date.c +0 -6
index 755adec1e71..bdb3e199b43 100644
@@ -42,12 +42,6 @@ static int do_date(struct cmd_tbl *cmdtp, int flag, int argc,
 			return CMD_RET_FAILURE;
 		}
 	}
-#elif CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
-	old_bus = i2c_get_bus_num();
-	i2c_set_bus_num(CFG_SYS_RTC_BUS_NUM);
-#else
-	old_bus = I2C_GET_BUS();
-	I2C_SET_BUS(CFG_SYS_RTC_BUS_NUM);
 #endif
 
 	switch (argc) {
include/configs/ls1028aqds.h +0 -1
index 769ece901c1..ed93b51d808 100644
@@ -47,7 +47,6 @@
 #endif
 
 /* RTC */
-#define CFG_SYS_RTC_BUS_NUM         1
 #define I2C_MUX_CH_RTC                 0xB
 
 /* Store environment at top of flash */
include/configs/ls1028ardb.h +0 -2
index 0f591e3c4ab..d44ce45fd6b 100644
@@ -10,8 +10,6 @@
 
 #define COUNTER_FREQUENCY_REAL		(get_board_sys_clk() / 4)
 
-#define CFG_SYS_RTC_BUS_NUM         0
-
 /* Store environment at top of flash */
 
 /*
include/configs/ls1046afrwy.h +0 -1
index 5e03a962d10..21804fc6654 100644
@@ -66,7 +66,6 @@
 
 /* RTC */
 #define CFG_SYS_I2C_RTC_ADDR		0x51  /* Channel 0 I2C bus 0*/
-#define CFG_SYS_RTC_BUS_NUM			0
 
 /*
  * Environment
include/configs/lx2160aqds.h +0 -3
index 3a316e73308..5b397e23d89 100644
@@ -8,9 +8,6 @@
 
 #include "lx2160a_common.h"
 
-/* RTC */
-#define CFG_SYS_RTC_BUS_NUM		0
-
 /* MAC/PHY configuration */
 
 /* Initial environment variables */
include/configs/lx2160ardb.h +0 -3
index 6404b359111..e700a7b1135 100644
@@ -8,9 +8,6 @@
 
 #include "lx2160a_common.h"
 
-/* RTC */
-#define CFG_SYS_RTC_BUS_NUM		4
-
 #if defined(CONFIG_FSL_MC_ENET)
 #define AQR113C_PHY_ADDR1		0x0
 #define AQR113C_PHY_ADDR2		0x08
include/configs/lx2162aqds.h +0 -3
index 54d7cea4c59..2d0db47b334 100644
@@ -10,9 +10,6 @@
 
 /* USB */
 
-/* RTC */
-#define CFG_SYS_RTC_BUS_NUM		0
-
 /* Initial environment variables */
 #define CFG_EXTRA_ENV_SETTINGS		\
 	EXTRA_ENV_SETTINGS			\
include/configs/m53menlo.h +0 -2
index 9cf46b2c362..c245cbe427b 100644
@@ -57,8 +57,6 @@
 #define CFG_FEC_MXC_PHYADDR		0x0
 #endif
 
-#define CFG_SYS_RTC_BUS_NUM		1 /* I2C2 */
-
 /*
  * RTC
  */
include/configs/tqma6_wru4.h +0 -1
index e06fc7fe155..5e21463305a 100644
@@ -16,7 +16,6 @@
 /* Watchdog */
 
 /* Config on-board RTC */
-#define CFG_SYS_RTC_BUS_NUM		2
 #define CFG_SYS_I2C_RTC_ADDR		0x68
 /* Turn off RTC square-wave output to save battery */
 
include/i2c.h +0 -5
index 622540c8265..45ca3d63e3f 100644
@@ -655,11 +655,6 @@ void i2c_early_init_f(void);
 #undef CFG_SYS_I2C_DIRECT_BUS
 #endif
 
-/* define the I2C bus number for RTC and DTT if not already done */
-#if !defined(CFG_SYS_RTC_BUS_NUM)
-#define CFG_SYS_RTC_BUS_NUM		0
-#endif
-
 struct i2c_adapter {
 	void		(*init)(struct i2c_adapter *adap, int speed,
 				int slaveaddr);
Signature · 1 line
2.34.1
Reviewed-by on v2 8/18
#16 lore raw

Re: [PATCH v2 08/18] rtc: Drop CFG_SYS_RTC_BUS_NUM

Hello Simon,

Quoted 8 lines · Simon Glass

This option is very old and the migration deadline was years ago. Drop it so that the I2C system can be simplified.

---

(no changes since v1)

Quoted 12 lines
  README                        | 5 -----
  cmd/date.c                    | 6 ------
  include/configs/ls1028aqds.h  | 1 -
  include/configs/ls1028ardb.h  | 2 --
  include/configs/ls1046afrwy.h | 1 -
  include/configs/lx2160aqds.h  | 3 ---
  include/configs/lx2160ardb.h  | 3 ---
  include/configs/lx2162aqds.h  | 3 ---
  include/configs/m53menlo.h    | 2 --
  include/configs/tqma6_wru4.h  | 1 -
  include/i2c.h                 | 5 -----
  11 files changed, 32 deletions(-)

Thanks!

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#17 lore raw

PATCH v2 9/18 date: Drop the legacy I2C code

In reply to Simon Glass

Drop two generations of old code in this command. All boards should use driver model for I2C from 2021.

---

(no changes since v1)

 cmd/date.c | 26 --------------------------
 1 file changed, 26 deletions(-)
cmd/date.c +0 -26
index bdb3e199b43..8614f022761 100644
@@ -31,7 +31,6 @@ static int do_date(struct cmd_tbl *cmdtp, int flag, int argc,
 	int old_bus __maybe_unused;
 
 	/* switch to correct I2C bus */
-#ifdef CONFIG_DM_RTC
 	struct udevice *dev;
 
 	rcode = uclass_get_device_by_seq(UCLASS_RTC, 0, &dev);
@@ -42,29 +41,19 @@ static int do_date(struct cmd_tbl *cmdtp, int flag, int argc,
 			return CMD_RET_FAILURE;
 		}
 	}
-#endif
 
 	switch (argc) {
 	case 2:			/* set date & time */
 		if (strcmp(argv[1],"reset") == 0) {
 			puts ("Reset RTC...\n");
-#ifdef CONFIG_DM_RTC
 			rcode = dm_rtc_reset(dev);
 			if (!rcode)
 				rcode = dm_rtc_set(dev, &default_tm);
-#else
-			rtc_reset();
-			rcode = rtc_set(&default_tm);
-#endif
 			if (rcode)
 				puts("## Failed to set date after RTC reset\n");
 		} else {
 			/* initialize tm with current time */
-#ifdef CONFIG_DM_RTC
 			rcode = dm_rtc_get(dev, &tm);
-#else
-			rcode = rtc_get(&tm);
-#endif
 			if (!rcode) {
 				/* insert new date & time */
 				if (mk_date(argv[1], &tm) != 0) {
@@ -72,11 +61,7 @@ static int do_date(struct cmd_tbl *cmdtp, int flag, int argc,
 					break;
 				}
 				/* and write to RTC */
-#ifdef CONFIG_DM_RTC
 				rcode = dm_rtc_set(dev, &tm);
-#else
-				rcode = rtc_set(&tm);
-#endif
 				if (rcode) {
 					printf("## Set date failed: err=%d\n",
 					       rcode);
@@ -87,11 +72,7 @@ static int do_date(struct cmd_tbl *cmdtp, int flag, int argc,
 		}
 		fallthrough;
 	case 1:			/* get date & time */
-#ifdef CONFIG_DM_RTC
 		rcode = dm_rtc_get(dev, &tm);
-#else
-		rcode = rtc_get(&tm);
-#endif
 		if (rcode) {
 			puts("## Get date failed\n");
 			break;
@@ -108,13 +89,6 @@ static int do_date(struct cmd_tbl *cmdtp, int flag, int argc,
 		rcode = CMD_RET_USAGE;
 	}
 
-	/* switch back to original I2C bus */
-#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
-	i2c_set_bus_num(old_bus);
-#elif !defined(CONFIG_DM_RTC)
-	I2C_SET_BUS(old_bus);
-#endif
-
 	return rcode ? CMD_RET_FAILURE : 0;
 }
 
Signature · 1 line
2.34.1
Reviewed-by on v2 9/18
#18 lore raw

Re: [PATCH v2 09/18] date: Drop the legacy I2C code

Hello Simon,

Quoted 10 lines · Simon Glass

Drop two generations of old code in this command. All boards should use driver model for I2C from 2021.

---

(no changes since v1)

  cmd/date.c | 26 --------------------------
  1 file changed, 26 deletions(-)

Thanks!

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#19 lore raw

PATCH v2 10/18 fsl: mxc: Drop legacy I2c

In reply to Simon Glass

Drop some old code from the mxc_i2c and ddr/fsl drivers. This will allow removal of very old common I2C code.

---

Changes in v2:
- Leave pg_wcom alone as its boards were converted

 drivers/ddr/fsl/main.c | 3 +--
 drivers/i2c/mxc_i2c.c  | 1 +
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/ddr/fsl/main.c +1 -2
index 31091bb4495..888dfb7ff33 100644
@@ -111,7 +111,7 @@ static int ddr_i2c_read(DEV_TYPE *dev, unsigned int addr,
 #if CONFIG_IS_ENABLED(DM_I2C)
 	ret = dm_i2c_read(dev, 0, buf, len);
 #else
-	ret = i2c_read(dev->chip, addr, alen, buf, len);
+	ret = 0;
 #endif
 
 	return ret;
@@ -162,7 +162,6 @@ static void __get_spd(generic_spd_eeprom_t *spd, u8 i2c_address)
 	};
 	dev = &ldev;
 
-	i2c_set_bus_num(CONFIG_SYS_SPD_BUS_NUM);
 #endif
 
 #ifdef CONFIG_SYS_FSL_DDR4
drivers/i2c/mxc_i2c.c +1 -0
index 84c0050eac0..2f3cb5908c9 100644
@@ -620,6 +620,7 @@ int enable_i2c_clk(unsigned char enable, unsigned int i2c_num)
 	__attribute__((weak, alias("__enable_i2c_clk")));
 
 #if !CONFIG_IS_ENABLED(DM_I2C)
+
 /*
  * Read data from I2C device
  *
Signature · 1 line
2.34.1
Reviewed-by on v2 10/18
#20 lore raw

Re: [PATCH v2 10/18] fsl: mxc: Drop legacy I2c

Hello Simon,

Quoted 4 lines · Simon Glass

Drop some old code from the mxc_i2c and ddr/fsl drivers. This will allow removal of very old common I2C code.

Quoted 8 lines

---

Changes in v2:
- Leave pg_wcom alone as its boards were converted

  drivers/ddr/fsl/main.c | 3 +--
  drivers/i2c/mxc_i2c.c  | 1 +
  2 files changed, 2 insertions(+), 2 deletions(-)

Thanks!

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#21 lore raw

PATCH v2 11/18 i2c: Drop reference to SYS_I2C_INIT_BOARD

In reply to Simon Glass

This is not now used by any boards, so drop it.

---

(no changes since v1)

 doc/I2C_Edge_Conditions | 10 ++++------
 drivers/i2c/soft_i2c.c  | 11 -----------
 2 files changed, 4 insertions(+), 17 deletions(-)
doc/I2C_Edge_Conditions +4 -6
index f4a99687011..9ccb21c5092 100644
@@ -31,12 +31,10 @@ Notes
 !!!THIS IS AN UNDOCUMENTED I2C BUS BUG, NOT A AMCC 4xx BUG!!!
 
 This reset edge condition could possibly be present in every I2C
-controller and device available. For boards where a I2C bus reset
-function can be implemented a i2c_init_board() function should be
-provided and enabled by #define'ing CONFIG_SYS_I2C_INIT_BOARD in your
-board's config file. Note that this is NOT necessary when using the
-bit-banging I2C driver (common/soft_i2c.c) as this already includes
-the I2C bus reset sequence.
+controller and device available.
+
+Note that this problem does not happen when using the bit-banging I2C driver
+(common/soft_i2c.c) as this already includes the I2C bus reset sequence.
 
 
 Many thanks to Bill Hunter for finding this serious BUG.
drivers/i2c/soft_i2c.c +0 -11
index 89ddf821063..79f7a320502 100644
@@ -107,16 +107,13 @@ DECLARE_GLOBAL_DATA_PTR;
 /*-----------------------------------------------------------------------
  * Local functions
  */
-#if !defined(CONFIG_SYS_I2C_INIT_BOARD)
 static void  send_reset	(void);
-#endif
 static void  send_start	(void);
 static void  send_stop	(void);
 static void  send_ack	(int);
 static int   write_byte	(uchar byte);
 static uchar read_byte	(int);
 
-#if !defined(CONFIG_SYS_I2C_INIT_BOARD)
 /*-----------------------------------------------------------------------
  * Send a reset sequence consisting of 9 clocks with the data signal high
  * to clock any confused device back into an idle state.  Also send a
@@ -144,7 +141,6 @@ static void send_reset(void)
 	send_stop();
 	I2C_TRISTATE;
 }
-#endif
 
 /*-----------------------------------------------------------------------
  * START: High -> Low on SDA while SCL is High
@@ -277,12 +273,6 @@ static uchar read_byte(int ack)
  */
 static void soft_i2c_init(struct i2c_adapter *adap, int speed, int slaveaddr)
 {
-#if defined(CONFIG_SYS_I2C_INIT_BOARD)
-	/* call board specific i2c bus reset routine before accessing the   */
-	/* environment, which might be in a chip on that bus. For details   */
-	/* about this problem see doc/I2C_Edge_Conditions.                  */
-	i2c_init_board();
-#else
 	/*
 	 * WARNING: Do NOT save speed in a static variable: if the
 	 * I2C routines are called before RAM is initialized (to read
@@ -290,7 +280,6 @@ static void soft_i2c_init(struct i2c_adapter *adap, int speed, int slaveaddr)
 	 * system will crash.
 	 */
 	send_reset ();
-#endif
 }
 
 /*-----------------------------------------------------------------------
Signature · 1 line
2.34.1
Reviewed-by on v2 11/18
#22 lore raw

Re: [PATCH v2 11/18] i2c: Drop reference to SYS_I2C_INIT_BOARD

Hello Simon,

Quoted 10 lines · Simon Glass

This is not now used by any boards, so drop it.

---

(no changes since v1)

  doc/I2C_Edge_Conditions | 10 ++++------
  drivers/i2c/soft_i2c.c  | 11 -----------
  2 files changed, 4 insertions(+), 17 deletions(-)

Thanks!

bye,
Heiko

Signature · 4 lines
-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#23 lore raw

PATCH v2 12/18 octeon: Drop OCTEON_I2C_FDT dead code

In reply to Simon Glass

This option is not defined by any board, so drop the code.

---

(no changes since v1)

 arch/mips/mach-octeon/octeon_fdt.c | 7 -------
 1 file changed, 7 deletions(-)
arch/mips/mach-octeon/octeon_fdt.c +0 -7
index c74fe9d9fb8..15ce292be95 100644
@@ -687,13 +687,6 @@ int octeon_fdt_i2c_get_bus(const void *fdt, int node_offset)
 	while (node_offset > 0 &&
 	       !(found = !fdt_node_check_compatible(fdt, node_offset, compat))) {
 		node_offset = fdt_parent_offset(fdt, node_offset);
-#ifdef CONFIG_OCTEON_I2C_FDT
-		bus = i2c_get_bus_num_fdt(node_offset);
-		if (bus >= 0) {
-			debug("%s: Found bus 0x%x\n", __func__, bus);
-			return bus;
-		}
-#endif
 	}
 	if (!found) {
 		printf("Error: node %d in device tree is not a child of the I2C bus\n",
Signature · 1 line
2.34.1
Reviewed-by on v2 12/18
#24 lore raw

Re: [PATCH v2 12/18] octeon: Drop OCTEON_I2C_FDT dead code

Hello Simon,

Quoted 9 lines · Simon Glass

This option is not defined by any board, so drop the code.

---

(no changes since v1)

  arch/mips/mach-octeon/octeon_fdt.c | 7 -------
  1 file changed, 7 deletions(-)

Thanks!

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#25 lore raw

PATCH v2 13/18 i2c: Remove I2C_SET_BUS()

In reply to Simon Glass

This is very old, predating even the legacy I2C support, so drop it.

---

(no changes since v1)

 drivers/power/power_i2c.c | 5 -----
 include/i2c.h             | 7 -------
 2 files changed, 12 deletions(-)
drivers/power/power_i2c.c +0 -5
index a871fc41987..c2fc1c6b42f 100644
@@ -33,8 +33,6 @@ int pmic_reg_write(struct pmic *p, u32 reg, u32 val)
 		       p->bus);
 		return -ENXIO;
 	}
-#else /* Non DM I2C support - will be removed */
-	I2C_SET_BUS(p->bus);
 #endif
 
 	switch (pmic_i2c_tx_num) {
@@ -93,9 +91,6 @@ int pmic_reg_read(struct pmic *p, u32 reg, u32 *val)
 		return -ENXIO;
 	}
 	ret = dm_i2c_read(dev, reg, buf, pmic_i2c_tx_num);
-#else /* Non DM I2C support - will be removed */
-	I2C_SET_BUS(p->bus);
-	ret = i2c_read(pmic_i2c_addr, reg, 1, buf, pmic_i2c_tx_num);
 #endif
 	if (ret)
 		return ret;
include/i2c.h +0 -7
index 45ca3d63e3f..1d1430b74a6 100644
@@ -954,13 +954,6 @@ static inline unsigned int I2C_GET_BUS(void)
 	return I2C_MULTI_BUS ? i2c_get_bus_num() : 0;
 }
 
-static inline void I2C_SET_BUS(unsigned int bus) __attribute__((always_inline));
-static inline void I2C_SET_BUS(unsigned int bus)
-{
-	if (I2C_MULTI_BUS)
-		i2c_set_bus_num(bus);
-}
-
 /**
  * Find the I2C bus number by given a FDT I2C node.
  *
Signature · 1 line
2.34.1
Reviewed-by on v2 13/18
#26 lore raw

Re: [PATCH v2 13/18] i2c: Remove I2C_SET_BUS()

Hello Simon,

Quoted 10 lines · Simon Glass

This is very old, predating even the legacy I2C support, so drop it.

---

(no changes since v1)

  drivers/power/power_i2c.c | 5 -----
  include/i2c.h             | 7 -------
  2 files changed, 12 deletions(-)

Thanks!

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#27 lore raw

PATCH v2 14/18 i2c: Remove I2C_GET_BUS()

In reply to Simon Glass

This is very old, predating even the legacy I2C support, so drop it.

---

(no changes since v1)

 include/i2c.h | 7 -------
 1 file changed, 7 deletions(-)
include/i2c.h +0 -7
index 1d1430b74a6..b6727bb2a73 100644
@@ -947,13 +947,6 @@ unsigned int i2c_get_bus_speed(void);
 # define I2C_MULTI_BUS				0
 #endif
 
-/* NOTE: These two functions MUST be always_inline to avoid code growth! */
-static inline unsigned int I2C_GET_BUS(void) __attribute__((always_inline));
-static inline unsigned int I2C_GET_BUS(void)
-{
-	return I2C_MULTI_BUS ? i2c_get_bus_num() : 0;
-}
-
 /**
  * Find the I2C bus number by given a FDT I2C node.
  *
Signature · 1 line
2.34.1
Reviewed-by on v2 14/18
#28 lore raw

Re: [PATCH v2 14/18] i2c: Remove I2C_GET_BUS()

Hello Simon,

Quoted 9 lines · Simon Glass

This is very old, predating even the legacy I2C support, so drop it.

---

(no changes since v1)

  include/i2c.h | 7 -------
  1 file changed, 7 deletions(-)

Thanks!

bye,
Heiko

Signature · 4 lines
-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#29 lore raw

PATCH v2 15/18 i2c: Drop CFG_SYS_MAX_I2C_BUS

In reply to Simon Glass

Only one board uses this option and it is very old. Let's drop it.

---

(no changes since v1)

 include/configs/ethernut5.h |  3 ---
 include/i2c.h               | 14 --------------
 2 files changed, 17 deletions(-)
include/configs/ethernut5.h +0 -3
index 807c6963192..c327bbbe07d 100644
@@ -59,9 +59,6 @@
 #define CFG_SYS_I2C_RTC_ADDR		0x51
 #endif
 
-/* I2C */
-#define CFG_SYS_MAX_I2C_BUS	1
-
 #define I2C_SOFT_DECLARATIONS
 
 #define GPIO_I2C_SCL		AT91_PIO_PORTA, 24
include/i2c.h +0 -14
index b6727bb2a73..282f3cd700f 100644
@@ -933,20 +933,6 @@ int i2c_set_bus_speed(unsigned int);
 unsigned int i2c_get_bus_speed(void);
 #endif /* CONFIG_SYS_I2C_LEGACY */
 
-/*
- * only for backwardcompatibility, should go away if we switched
- * completely to new multibus support.
- */
-#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
-# if !defined(CFG_SYS_MAX_I2C_BUS)
-#  define CFG_SYS_MAX_I2C_BUS		2
-# endif
-# define I2C_MULTI_BUS				1
-#else
-# define CFG_SYS_MAX_I2C_BUS		1
-# define I2C_MULTI_BUS				0
-#endif
-
 /**
  * Find the I2C bus number by given a FDT I2C node.
  *
Signature · 1 line
2.34.1
Reviewed-by on v2 15/18
#30 lore raw

Re: [PATCH v2 15/18] i2c: Drop CFG_SYS_MAX_I2C_BUS

Hello Simon,

Quoted 10 lines · Simon Glass

Only one board uses this option and it is very old. Let's drop it.

---

(no changes since v1)

  include/configs/ethernut5.h |  3 ---
  include/i2c.h               | 14 --------------
  2 files changed, 17 deletions(-)

Thanks!

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#31 lore raw

PATCH v2 16/18 i2c: Drop i2c_get_bus_num_fdt() and i2c_reset_port_fdt()

In reply to Simon Glass

These functions are 11 years old and are only used by one board. Drop them.

---

(no changes since v1)

 include/i2c.h | 18 ------------------
 1 file changed, 18 deletions(-)
include/i2c.h +0 -18
index 282f3cd700f..f468b52cd7b 100644
@@ -933,24 +933,6 @@ int i2c_set_bus_speed(unsigned int);
 unsigned int i2c_get_bus_speed(void);
 #endif /* CONFIG_SYS_I2C_LEGACY */
 
-/**
- * Find the I2C bus number by given a FDT I2C node.
- *
- * @param blob  Device tree blbo
- * @param node  FDT I2C node to find
- * Return: the number of I2C bus (zero based), or -1 on error
- */
-int i2c_get_bus_num_fdt(int node);
-
-/**
- * Reset the I2C bus represented by the given a FDT I2C node.
- *
- * @param blob  Device tree blbo
- * @param node  FDT I2C node to find
- * Return: 0 if port was reset, -1 if not found
- */
-int i2c_reset_port_fdt(const void *blob, int node);
-
 #endif /* !CONFIG_DM_I2C */
 
 #endif	/* _I2C_H_ */
Signature · 1 line
2.34.1
Reviewed-by on v2 16/18
#32 lore raw

Re: [PATCH v2 16/18] i2c: Drop i2c_get_bus_num_fdt() and i2c_reset_port_fdt()

Hello Simon,

Quoted 10 lines · Simon Glass

These functions are 11 years old and are only used by one board. Drop them.

---

(no changes since v1)

  include/i2c.h | 18 ------------------
  1 file changed, 18 deletions(-)

Thanks!

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#33 lore raw

PATCH v2 17/18 i2c: Remove CFG_SYS_I2C_MAX_HOPS

In reply to Simon Glass

Now that this is always 0, remove it and the associated dead code.

---

(no changes since v1)

 README                 | 10 +---------
 cmd/i2c.c              | 23 -----------------------
 drivers/i2c/i2c_core.c | 37 -------------------------------------
 include/i2c.h          |  7 -------
 4 files changed, 1 insertion(+), 76 deletions(-)
README +1 -9
index 37c959cc9c2..4ffa4b8b68c 100644
@@ -773,19 +773,11 @@ The following options need to be configured:
 
 		CFG_SYS_I2C_DIRECT_BUS
 		define this, if you don't use i2c muxes on your hardware.
-		if CFG_SYS_I2C_MAX_HOPS is not defined or == 0 you can
-		omit this define.
-
-		CFG_SYS_I2C_MAX_HOPS
-		define how many muxes are maximal consecutively connected
-		on one i2c bus. If you not use i2c muxes, omit this
-		define.
 
 		CFG_SYS_I2C_BUSES
 		hold a list of buses you want to use, only used if
 		CFG_SYS_I2C_DIRECT_BUS is not defined, for example
-		a board with CFG_SYS_I2C_MAX_HOPS = 1 and
-		CFG_SYS_NUM_I2C_BUSES = 9:
+		a board with CFG_SYS_NUM_I2C_BUSES = 9:
 
 		 CFG_SYS_I2C_BUSES	{{0, {I2C_NULL_HOP}}, \
 					{0, {{I2C_MUX_PCA9547, 0x70, 1}}}, \
cmd/i2c.c +0 -23
index 7dac0a9fb6c..7246c4fa3e7 100644
@@ -1698,18 +1698,6 @@ static int do_i2c_show_bus(struct cmd_tbl *cmdtp, int flag, int argc,
 
 		for (i = 0; i < CFG_SYS_NUM_I2C_BUSES; i++) {
 			printf("Bus %d:\t%s", i, I2C_ADAP_NR(i)->name);
-#ifndef CFG_SYS_I2C_DIRECT_BUS
-			int j;
-
-			for (j = 0; j < CFG_SYS_I2C_MAX_HOPS; j++) {
-				if (i2c_bus[i].next_hop[j].chip == 0)
-					break;
-				printf("->%s@0x%2x:%d",
-				       i2c_bus[i].next_hop[j].mux.name,
-				       i2c_bus[i].next_hop[j].chip,
-				       i2c_bus[i].next_hop[j].channel);
-			}
-#endif
 			printf("\n");
 		}
 #endif
@@ -1734,17 +1722,6 @@ static int do_i2c_show_bus(struct cmd_tbl *cmdtp, int flag, int argc,
 			return -1;
 		}
 		printf("Bus %d:\t%s", i, I2C_ADAP_NR(i)->name);
-#ifndef CFG_SYS_I2C_DIRECT_BUS
-			int j;
-			for (j = 0; j < CFG_SYS_I2C_MAX_HOPS; j++) {
-				if (i2c_bus[i].next_hop[j].chip == 0)
-					break;
-				printf("->%s@0x%2x:%d",
-				       i2c_bus[i].next_hop[j].mux.name,
-				       i2c_bus[i].next_hop[j].chip,
-				       i2c_bus[i].next_hop[j].channel);
-			}
-#endif
 		printf("\n");
 #endif
 	}
drivers/i2c/i2c_core.c +0 -37
index 7c43a5546d3..f371d952af5 100644
@@ -111,23 +111,6 @@ static int i2c_mux_set_all(void)
 	struct i2c_bus_hose *i2c_bus_tmp = &i2c_bus[I2C_BUS];
 	int i;
 
-	/* Connect requested bus if behind muxes */
-	if (i2c_bus_tmp->next_hop[0].chip != 0) {
-		/* Set all muxes along the path to that bus */
-		for (i = 0; i < CFG_SYS_I2C_MAX_HOPS; i++) {
-			int	ret;
-
-			if (i2c_bus_tmp->next_hop[i].chip == 0)
-				break;
-
-			ret = i2c_mux_set(I2C_ADAP,
-					i2c_bus_tmp->next_hop[i].mux.id,
-					i2c_bus_tmp->next_hop[i].chip,
-					i2c_bus_tmp->next_hop[i].channel);
-			if (ret != 0)
-				return ret;
-		}
-	}
 	return 0;
 }
 
@@ -140,26 +123,6 @@ static int i2c_mux_disconnect_all(void)
 	if (I2C_ADAP->init_done == 0)
 		return 0;
 
-	/* Disconnect current bus (turn off muxes if any) */
-	if ((i2c_bus_tmp->next_hop[0].chip != 0) &&
-	    (I2C_ADAP->init_done != 0)) {
-		i = CFG_SYS_I2C_MAX_HOPS;
-		do {
-			uint8_t	chip;
-			int ret;
-
-			chip = i2c_bus_tmp->next_hop[--i].chip;
-			if (chip == 0)
-				continue;
-
-			ret = I2C_ADAP->write(I2C_ADAP, chip, 0, 0, &buf, 1);
-			if (ret != 0) {
-				printf("i2c: mux disconnect error\n");
-				return ret;
-			}
-		} while (i > 0);
-	}
-
 	return 0;
 }
 #endif
include/i2c.h +0 -7
index f468b52cd7b..180b71f1451 100644
@@ -645,15 +645,9 @@ void i2c_early_init_f(void);
  */
 #define I2C_RXTX_LEN	128	/* maximum tx/rx buffer length */
 
-#if !defined(CFG_SYS_I2C_MAX_HOPS)
 /* no muxes used bus = i2c adapters */
 #define CFG_SYS_I2C_DIRECT_BUS	1
-#define CFG_SYS_I2C_MAX_HOPS		0
 #define CFG_SYS_NUM_I2C_BUSES	ll_entry_count(struct i2c_adapter, i2c)
-#else
-/* we use i2c muxes */
-#undef CFG_SYS_I2C_DIRECT_BUS
-#endif
 
 struct i2c_adapter {
 	void		(*init)(struct i2c_adapter *adap, int speed,
@@ -712,7 +706,6 @@ struct i2c_next_hop {
 
 struct i2c_bus_hose {
 	int	adapter;
-	struct i2c_next_hop	next_hop[CFG_SYS_I2C_MAX_HOPS];
 };
 #define I2C_NULL_HOP	{{-1, ""}, 0, 0}
 extern struct i2c_bus_hose	i2c_bus[];
Signature · 1 line
2.34.1
Reviewed-by on v2 17/18
#34 lore raw

Re: [PATCH v2 17/18] i2c: Remove CFG_SYS_I2C_MAX_HOPS

Hello Simon.

Quoted 5 lines · Simon Glass

Now that this is always 0, remove it and the associated dead code.

---

Quoted 7 lines

(no changes since v1)

  README                 | 10 +---------
  cmd/i2c.c              | 23 -----------------------
  drivers/i2c/i2c_core.c | 37 -------------------------------------
  include/i2c.h          |  7 -------
  4 files changed, 1 insertion(+), 76 deletions(-)

Thanks!

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#35 lore raw

PATCH v2 18/18 i2c: Remove CFG_SYS_I2C_DIRECT_BUS

In reply to Simon Glass

Now that this is always 1, remove it and the associated dead code.

---

Changes in v2:
- Drop patch "pg-wcom: Drop CFG_SYS_I2C_MAX_HOPS"

 README                 |   7 +--
 drivers/i2c/i2c_core.c | 104 -----------------------------------------
 include/i2c.h          |  35 --------------
 3 files changed, 1 insertion(+), 145 deletions(-)
README +1 -6
index 4ffa4b8b68c..4be1e8c22a0 100644
@@ -771,13 +771,8 @@ The following options need to be configured:
 		CFG_SYS_NUM_I2C_BUSES
 		Hold the number of i2c buses you want to use.
 
-		CFG_SYS_I2C_DIRECT_BUS
-		define this, if you don't use i2c muxes on your hardware.
-
 		CFG_SYS_I2C_BUSES
-		hold a list of buses you want to use, only used if
-		CFG_SYS_I2C_DIRECT_BUS is not defined, for example
-		a board with CFG_SYS_NUM_I2C_BUSES = 9:
+		hold a list of buses you want to use
 
 		 CFG_SYS_I2C_BUSES	{{0, {I2C_NULL_HOP}}, \
 					{0, {{I2C_MUX_PCA9547, 0x70, 1}}}, \
drivers/i2c/i2c_core.c +0 -104

128 lines not on this page · raw message

include/i2c.h +0 -35
index 180b71f1451..91917f54be9 100644
@@ -646,7 +646,6 @@ void i2c_early_init_f(void);
 #define I2C_RXTX_LEN	128	/* maximum tx/rx buffer length */
 
 /* no muxes used bus = i2c adapters */
-#define CFG_SYS_I2C_DIRECT_BUS	1
 #define CFG_SYS_NUM_I2C_BUSES	ll_entry_count(struct i2c_adapter, i2c)
 
 struct i2c_adapter {
@@ -692,47 +691,13 @@ struct i2c_adapter {
 
 struct i2c_adapter *i2c_get_adapter(int index);
 
-#ifndef CFG_SYS_I2C_DIRECT_BUS
-struct i2c_mux {
-	int	id;
-	char	name[16];
-};
-
-struct i2c_next_hop {
-	struct i2c_mux		mux;
-	uint8_t		chip;
-	uint8_t		channel;
-};
-
-struct i2c_bus_hose {
-	int	adapter;
-};
-#define I2C_NULL_HOP	{{-1, ""}, 0, 0}
-extern struct i2c_bus_hose	i2c_bus[];
-
-#define I2C_ADAPTER(bus)	i2c_bus[bus].adapter
-#else
 #define I2C_ADAPTER(bus)	bus
-#endif
 #define	I2C_BUS			gd->cur_i2c_bus
 
 #define	I2C_ADAP_NR(bus)	i2c_get_adapter(I2C_ADAPTER(bus))
 #define	I2C_ADAP		I2C_ADAP_NR(gd->cur_i2c_bus)
 #define I2C_ADAP_HWNR		(I2C_ADAP->hwadapnr)
 
-#ifndef CFG_SYS_I2C_DIRECT_BUS
-#define I2C_MUX_PCA9540_ID	1
-#define I2C_MUX_PCA9540		{I2C_MUX_PCA9540_ID, "PCA9540B"}
-#define I2C_MUX_PCA9542_ID	2
-#define I2C_MUX_PCA9542		{I2C_MUX_PCA9542_ID, "PCA9542A"}
-#define I2C_MUX_PCA9544_ID	3
-#define I2C_MUX_PCA9544		{I2C_MUX_PCA9544_ID, "PCA9544A"}
-#define I2C_MUX_PCA9547_ID	4
-#define I2C_MUX_PCA9547		{I2C_MUX_PCA9547_ID, "PCA9547A"}
-#define I2C_MUX_PCA9548_ID	5
-#define I2C_MUX_PCA9548		{I2C_MUX_PCA9548_ID, "PCA9548"}
-#endif
-
 #ifndef I2C_SOFT_DECLARATIONS
 # if (defined(CONFIG_AT91RM9200) || \
 	defined(CONFIG_AT91SAM9260) ||  defined(CONFIG_AT91SAM9261) || \
Signature · 1 line
2.34.1
Reviewed-by on v2 18/18
#36 lore raw

Re: [PATCH v2 18/18] i2c: Remove CFG_SYS_I2C_DIRECT_BUS

Hello Simon,

Quoted 5 lines · Simon Glass

Now that this is always 1, remove it and the associated dead code.

---

Quoted 7 lines

Changes in v2:
- Drop patch "pg-wcom: Drop CFG_SYS_I2C_MAX_HOPS"

  README                 |   7 +--
  drivers/i2c/i2c_core.c | 104 -----------------------------------------
  include/i2c.h          |  35 --------------
  3 files changed, 1 insertion(+), 145 deletions(-)

Thanks!

bye,
HEiko

Signature · 4 lines
-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#37 lore raw
In reply to Simon Glass

Hello Simon,

Quoted 58 lines · Simon Glass

This series aims to remove some of the older contents of i2c.h so that we can move towards having just the dm API.

It does not remove any boards, but instead removes functionality.

Changes in v2:
- Drop omap3_beagle.h change as that board was removed
- Leave pg_wcom alone as its boards were converted
- Drop patch "pg-wcom: Drop CFG_SYS_I2C_MAX_HOPS"

Simon Glass (18):
i2c: Remove board_i2c_init()
i2c: Remove IC2_xxx enum
i2c: Remove CFG_I2C_MULTI_BUS
mips: malta: Drop CMD_DATE
armv8: ls2085a: Drop CMD_DATE
mx28 / mx51: Drop CMD_DATE
MPC837XERDB: ethernut5: work_92105: Drop CMD_DATE
rtc: Drop CFG_SYS_RTC_BUS_NUM
date: Drop the legacy I2C code
fsl: mxc: Drop legacy I2c
i2c: Drop reference to SYS_I2C_INIT_BOARD
octeon: Drop OCTEON_I2C_FDT dead code
i2c: Remove I2C_SET_BUS()
i2c: Remove I2C_GET_BUS()
i2c: Drop CFG_SYS_MAX_I2C_BUS
i2c: Drop i2c_get_bus_num_fdt() and i2c_reset_port_fdt()
i2c: Remove CFG_SYS_I2C_MAX_HOPS
i2c: Remove CFG_SYS_I2C_DIRECT_BUS

  README                             |  27 +-----
  arch/mips/mach-octeon/octeon_fdt.c |   7 --
  cmd/date.c                         |  32 -------
  cmd/i2c.c                          |  23 -----
  configs/MPC837XERDB_defconfig      |   1 -
  configs/ethernut5_defconfig        |   1 -
  configs/ls2080aqds_nand_defconfig  |   1 -
  configs/ls2080aqds_qspi_defconfig  |   1 -
  configs/ls2080ardb_nand_defconfig  |   1 -
  configs/malta64_defconfig          |   1 -
  configs/malta64el_defconfig        |   1 -
  configs/malta_defconfig            |   1 -
  configs/maltael_defconfig          |   1 -
  configs/mx28evk_defconfig          |   1 -
  configs/mx51evk_defconfig          |   1 -
  configs/work_92105_defconfig       |   1 -
  doc/I2C_Edge_Conditions            |  10 +-
  drivers/ddr/fsl/main.c             |   3 +-
  drivers/i2c/i2c_core.c             | 141 -----------------------------
  drivers/i2c/mxc_i2c.c              |   1 +
  drivers/i2c/soft_i2c.c             |  11 ---
  drivers/power/power_i2c.c          |   5 -
  drivers/usb/host/ohci-lpc32xx.c    |   4 -
  include/configs/ethernut5.h        |   3 -
  include/configs/ls1028aqds.h       |   1 -
  include/configs/ls1028ardb.h       |   2 -
  include/configs/ls1046afrwy.h      |   1 -
  include/configs/lx2160aqds.h       |   3 -
Quoted 9 lines
  include/configs/lx2160ardb.h       |   3 -
  include/configs/lx2162aqds.h       |   3 -
  include/configs/m53menlo.h         |   2 -
  include/configs/sniper.h           |  14 ---
  include/configs/tqma6.h            |   3 -
  include/configs/tqma6_wru4.h       |   1 -
  include/i2c.h                      | 107 ----------------------
  35 files changed, 7 insertions(+), 412 deletions(-)

Many thanks for this work. Applied them locally base on origin/next and started azure build:

https://dev.azure.com/hs0298/hs/_build/results?buildId=122&view=results

If all is fine, I sent pull request to Tom.

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]