Skip to contentSkip to conversation

armv8: ls2088a: The ls2088a platform supports the I2C driver model.

PATCH Superseded Chuanhua Han 1 participant 5 messages Jul 2, 2019 Arm (32-bit)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/5 armv8: ls2088a: The ls2088a platform supports the I2C driver model.

DM_I2C_COMPAT is a compatibility layer that allows using the non-DM I2C API when DM_I2C is used.When DM_I2C_COMPAT is not enabled for compilation, a compilation error will be generated. This patch solves the problem that the i2c-related api of the ls2088a platform does not support dm.

---
depends on:
- http://patchwork.ozlabs.org/project/uboot/list/?series=109459
- http://patchwork.ozlabs.org/project/uboot/list/?series=113103

Change in v2:
- No change.

 arch/arm/cpu/armv8/fsl-layerscape/Kconfig |    4 ----
 board/freescale/ls2080ardb/ls2080ardb.c   |    9 +++++++++
 include/configs/ls2080a_common.h          |    3 ---
 include/configs/ls2080ardb.h              |    1 -
 4 files changed, 9 insertions(+), 8 deletions(-)
arch/arm/cpu/armv8/fsl-layerscape/Kconfig +0 -4
index ffda02a..8a69af4 100644
@@ -205,10 +205,6 @@ config ARCH_LS2080A
 	select ARCH_EARLY_INIT_R
 	select BOARD_EARLY_INIT_F
 	select SYS_I2C_MXC
-	select SYS_I2C_MXC_I2C1
-	select SYS_I2C_MXC_I2C2
-	select SYS_I2C_MXC_I2C3
-	select SYS_I2C_MXC_I2C4
 	imply DISTRO_DEFAULTS
 	imply PANIC_HANG
 
board/freescale/ls2080ardb/ls2080ardb.c +9 -0
index ce419df..8833ed3 100644
@@ -163,7 +163,16 @@ int select_i2c_ch_pca9547(u8 ch)
 {
 	int ret;
 
+#ifndef CONFIG_DM_I2C
 	ret = i2c_write(I2C_MUX_PCA_ADDR_PRI, 0, 1, &ch, 1);
+#else
+	struct udevice *dev;
+
+	ret = i2c_get_chip_for_busnum(0, I2C_MUX_PCA_ADDR_PRI, 1, &dev);
+	if (!ret)
+		ret = dm_i2c_write(dev, 0, &ch, 1);
+#endif
+
 	if (ret) {
 		puts("PCA: failed to select proper channel\n");
 		return ret;
include/configs/ls2080a_common.h +0 -3
index c7d8a3b..e776b5c 100644
@@ -74,9 +74,6 @@
 /* Size of malloc() pool */
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 2048 * 1024)
 
-/* I2C */
-#define CONFIG_SYS_I2C
-
 /* Serial Port */
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE     1
include/configs/ls2080ardb.h +0 -1
index bfb54be..db22f59 100644
@@ -13,7 +13,6 @@
 #ifdef CONFIG_TARGET_LS2081ARDB
 #define CONFIG_QIXIS_I2C_ACCESS
 #endif
-#define CONFIG_SYS_I2C_EARLY_INIT
 #endif
 
 #define I2C_MUX_CH_VOL_MONITOR		0xa
Signature · 1 line
1.7.1
#1 lore raw

PATCH v2 2/5 gpio: do not include <asm/arch/gpio.h> on ARCH_LS2080A

As no gpio.h is defined for this architecture, to avoid compilation failure, do not include <asm/arch/gpio.h> for arch ls2080a.

---
depends on:
- http://patchwork.ozlabs.org/project/uboot/list/?series=109459
- http://patchwork.ozlabs.org/project/uboot/list/?series=113103

Change in v2:
- No change.

 arch/arm/include/asm/gpio.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/include/asm/gpio.h +1 -1
index f78b976..292adfa 100644
@@ -1,7 +1,7 @@
 #if !defined(CONFIG_ARCH_UNIPHIER) && !defined(CONFIG_ARCH_STI) && \
 	!defined(CONFIG_ARCH_K3) && !defined(CONFIG_ARCH_BCM6858) && \
 	!defined(CONFIG_ARCH_BCM63158) && !defined(CONFIG_ARCH_ROCKCHIP) && \
-	!defined(CONFIG_ARCH_LX2160A)
+	!defined(CONFIG_ARCH_LX2160A) && !defined(CONFIG_ARCH_LS2080A)
 #include <asm/arch/gpio.h>
 #endif
 #include <asm-generic/gpio.h>
Signature · 1 line
1.7.1
#2 lore raw

PATCH v2 3/5 configs: ls2088a: enable DM support for rtc

In reply to Chuanhua Han

Enable related configs to support rtc DM feature for ls2088ardb board.

---
depends on:
- http://patchwork.ozlabs.org/project/uboot/list/?series=109459
- http://patchwork.ozlabs.org/project/uboot/list/?series=113103

Change in v2:
- No change.

 configs/ls2088ardb_tfa_SECURE_BOOT_defconfig |    7 ++++++-
 configs/ls2088ardb_tfa_defconfig             |    7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)
configs/ls2088ardb_tfa_SECURE_BOOT_defconfig +6 -1
index d3312c6..abc608f 100644
@@ -1,5 +1,6 @@
 CONFIG_ARM=y
 CONFIG_TARGET_LS2080ARDB=y
+CONFIG_SYS_MALLOC_F_LEN=0x6000
 CONFIG_SYS_TEXT_BASE=0x82000000
 CONFIG_SECURE_BOOT=y
 CONFIG_QSPI_AHB_INIT=y
@@ -8,7 +9,6 @@ CONFIG_NR_DRAM_BANKS=3
 CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y
 CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y
 CONFIG_AHCI=y
-# CONFIG_SYS_MALLOC_F is not set
 CONFIG_FIT_VERBOSE=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
@@ -69,3 +69,8 @@ CONFIG_RSA=y
 CONFIG_SPL_RSA=y
 CONFIG_RSA_SOFTWARE_EXP=y
 CONFIG_EFI_LOADER_BOUNCE_BUFFER=y
+CONFIG_DM_I2C=y
+CONFIG_DM_GPIO=y
+CONFIG_I2C_MUX=y
+CONFIG_I2C_MUX_PCA954x=y
+CONFIG_DM_RTC=y
configs/ls2088ardb_tfa_defconfig +6 -1
index 1aa8dd9..c273a75 100644
@@ -1,5 +1,6 @@
 CONFIG_ARM=y
 CONFIG_TARGET_LS2080ARDB=y
+CONFIG_SYS_MALLOC_F_LEN=0x6000
 CONFIG_SYS_TEXT_BASE=0x82000000
 CONFIG_QSPI_AHB_INIT=y
 CONFIG_TFABOOT=y
@@ -7,7 +8,6 @@ CONFIG_NR_DRAM_BANKS=3
 CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y
 CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y
 CONFIG_AHCI=y
-# CONFIG_SYS_MALLOC_F is not set
 CONFIG_FIT_VERBOSE=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
@@ -70,3 +70,8 @@ CONFIG_DM_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
 CONFIG_EFI_LOADER_BOUNCE_BUFFER=y
+CONFIG_DM_I2C=y
+CONFIG_DM_GPIO=y
+CONFIG_I2C_MUX=y
+CONFIG_I2C_MUX_PCA954x=y
+CONFIG_DM_RTC=y
Signature · 1 line
1.7.1
#3 lore raw

PATCH v2 4/5 armv8: dts: fsl-ls2088a: add i2c node support

In reply to Chuanhua Han

From: chuanhua han <[email protected]>

One ls2088a, there is four I2C controllers.
This patch is to add I2C node for ls2088a.

---
depends on:
- http://patchwork.ozlabs.org/project/uboot/list/?series=109459
- http://patchwork.ozlabs.org/project/uboot/list/?series=113103

Change in v2:
- No change.

 arch/arm/dts/fsl-ls2080a.dtsi |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)
arch/arm/dts/fsl-ls2080a.dtsi +36 -0
index 5c0769b..99ed33a 100644
@@ -56,6 +56,42 @@
 		      <0x00000000 0x08340000 0 0x40000>; /* MC control reg */
 	};
 
+	i2c0: i2c at 2000000 {
+		status = "disabled";
+		compatible = "fsl,vf610-i2c";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x0 0x2000000 0x0 0x10000>;
+		interrupts = <0 34 0x4>; /* Level high type */
+	};
+
+	i2c1: i2c at 2010000 {
+		status = "disabled";
+		compatible = "fsl,vf610-i2c";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x0 0x2010000 0x0 0x10000>;
+		interrupts = <0 34 0x4>; /* Level high type */
+	};
+
+	i2c2: i2c at 2020000 {
+		status = "disabled";
+		compatible = "fsl,vf610-i2c";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x0 0x2020000 0x0 0x10000>;
+		interrupts = <0 35 0x4>; /* Level high type */
+	};
+
+	i2c3: i2c at 2030000 {
+		status = "disabled";
+		compatible = "fsl,vf610-i2c";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x0 0x2030000 0x0 0x10000>;
+		interrupts = <0 35 0x4>; /* Level high type */
+	};
+
 	dspi: dspi at 2100000 {
 		compatible = "fsl,vf610-dspi";
 		#address-cells = <1>;
Signature · 1 line
1.7.1
#4 lore raw

PATCH v2 5/5 armv8: dts: ls2088ardb: Add slave nodes under the i2c0 controller

In reply to Chuanhua Han

This patch adds some slave nodes to support the i2c dm on the device side under the i2c0 controller.

---
depends on:
- http://patchwork.ozlabs.org/project/uboot/list/?series=109459
- http://patchwork.ozlabs.org/project/uboot/list/?series=113103

Change in v2:
- Delete unnecessary i2c slave nodes.

 arch/arm/dts/fsl-ls2088a-rdb-qspi.dts |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
arch/arm/dts/fsl-ls2088a-rdb-qspi.dts +22 -0
index bf97d13..72b2177 100644
@@ -57,6 +57,28 @@
 	};
 };
 
+&i2c0 {
+	status = "okay";
+	u-boot,dm-pre-reloc;
+
+	pca9547 at 75 {
+		compatible = "nxp,pca9547";
+		reg = <0x75>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		 i2c at 1 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <0x01>;
+			rtc at 68 {
+				compatible = "dallas,ds3232";
+				reg = <0x68>;
+			};
+		};
+	};
+};
+
 &sata {
 	status = "okay";
 };
Signature · 1 line
1.7.1