Skip to contentSkip to conversation

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

PATCH Superseded Chuanhua Han 1 participant 4 messages Jun 13, 2019 Arm (32-bit)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/4 armv8: ls1028a: The ls1028a 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 ls1028a platform does not support dm.

---
depends on:
- https://patchwork.ozlabs.org/project/uboot/list/?series=113364
- https://patchwork.ozlabs.org/project/uboot/list/?series=110856
- https://patchwork.ozlabs.org/project/uboot/list/?series=109677

Changes in v2:
- No change.

 arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 8 --------
 board/freescale/ls1028a/ls1028a.c         | 8 ++++++++
 include/configs/ls1028a_common.h          | 3 ---
 include/configs/ls1028ardb.h              | 1 -
 4 files changed, 8 insertions(+), 12 deletions(-)
arch/arm/cpu/armv8/fsl-layerscape/Kconfig +0 -8
index f3eaab960b..ee2b3f4a5d 100644
@@ -40,14 +40,6 @@ config ARCH_LS1028A
 	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
-	select SYS_I2C_MXC_I2C5
-	select SYS_I2C_MXC_I2C6
-	select SYS_I2C_MXC_I2C7
-	select SYS_I2C_MXC_I2C8
 	select SYS_FSL_ERRATUM_A009007
 	select SYS_FSL_ERRATUM_A008514 if !TFABOOT
 	select SYS_FSL_ERRATUM_A009663 if !TFABOOT
board/freescale/ls1028a/ls1028a.c +8 -0
index e5de4eb70c..49a9292c31 100644
@@ -73,7 +73,15 @@ int board_init(void)
 #if defined(CONFIG_TARGET_LS1028ARDB)
 	u8 val = I2C_MUX_CH_DEFAULT;
 
+#ifndef CONFIG_DM_I2C
 	i2c_write(I2C_MUX_PCA_ADDR_PRI, 0x0b, 1, &val, 1);
+#else
+	struct udevice *dev;
+
+	if (!i2c_get_chip_for_busnum(0, I2C_MUX_PCA_ADDR_PRI, 1, &dev))
+		dm_i2c_write(dev, 0x0b, &val, 1);
+#endif
+
 #endif
 	return 0;
 }
include/configs/ls1028a_common.h +0 -3
index d3d787f14d..0fa5095fc8 100644
@@ -41,9 +41,6 @@
 /* Size of malloc() pool */
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 2048 * 1024)
 
-/* I2C */
-#define CONFIG_SYS_I2C
-
 /* Serial Port */
 #define CONFIG_CONS_INDEX       1
 #define CONFIG_SYS_NS16550_SERIAL
include/configs/ls1028ardb.h +0 -1
index 10791be824..b77c36d279 100644
@@ -22,7 +22,6 @@
 #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE
 
 #define CONFIG_QIXIS_I2C_ACCESS
-#define CONFIG_SYS_I2C_EARLY_INIT
 
 /*
  * QIXIS Definitions
Signature · 1 line
2.17.1
#1 lore raw

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

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

---
depends on:
- https://patchwork.ozlabs.org/project/uboot/list/?series=113364
- https://patchwork.ozlabs.org/project/uboot/list/?series=110856
- https://patchwork.ozlabs.org/project/uboot/list/?series=109677

Changes in v2:
- No change.

 arch/arm/include/asm/gpio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/include/asm/gpio.h +1 -1
index f78b976e10..b5adf5c816 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_LS1028A)
 #include <asm/arch/gpio.h>
 #endif
 #include <asm-generic/gpio.h>
Signature · 1 line
2.17.1
#2 lore raw

PATCH v2 3/4 configs: ls1028a: enable DM support for pcf2127 rtc

In reply to Chuanhua Han

Enable related configs to support pcf2127 rtc DM feature for ls1028ardb board.

---
depends on:
- https://patchwork.ozlabs.org/project/uboot/list/?series=113364
- https://patchwork.ozlabs.org/project/uboot/list/?series=110856
- https://patchwork.ozlabs.org/project/uboot/list/?series=109677

Changes in v2:
- Enable secure boot defconfig to support pcf2127 rtc DM
feature for ls1028ardb board.

 configs/ls1028ardb_tfa_SECURE_BOOT_defconfig | 9 ++++++++-
 configs/ls1028ardb_tfa_defconfig             | 9 ++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)
configs/ls1028ardb_tfa_SECURE_BOOT_defconfig +8 -1
index 3432f90087..c101a33a4b 100644
@@ -1,5 +1,6 @@
 CONFIG_ARM=y
 CONFIG_TARGET_LS1028ARDB=y
+CONFIG_SYS_MALLOC_F_LEN=0x6000
 CONFIG_SECURE_BOOT=y
 CONFIG_SYS_FSL_SDHC_CLK_DIV=1
 CONFIG_TFABOOT=y
@@ -8,7 +9,6 @@ CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y
 CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y
 CONFIG_AHCI=y
 CONFIG_DISTRO_DEFAULTS=y
-# CONFIG_SYS_MALLOC_F is not set
 CONFIG_FIT_VERBOSE=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
@@ -60,3 +60,10 @@ CONFIG_WDT=y
 CONFIG_WDT_SP805=y
 CONFIG_RSA=y
 CONFIG_EFI_LOADER_BOUNCE_BUFFER=y
+CONFIG_DM_I2C=y
+CONFIG_DM_RTC=y
+CONFIG_DM_GPIO=y
+CONFIG_CMD_DATE=y
+CONFIG_RTC_PCF2127=y
+CONFIG_I2C_MUX=y
+CONFIG_I2C_MUX_PCA954x=y
configs/ls1028ardb_tfa_defconfig +8 -1
index a8e4ddb7a8..440104cb18 100644
@@ -1,5 +1,6 @@
 CONFIG_ARM=y
 CONFIG_TARGET_LS1028ARDB=y
+CONFIG_SYS_MALLOC_F_LEN=0x6000
 CONFIG_SYS_FSL_SDHC_CLK_DIV=1
 CONFIG_TFABOOT=y
 CONFIG_NR_DRAM_BANKS=2
@@ -7,7 +8,6 @@ CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y
 CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y
 CONFIG_AHCI=y
 CONFIG_DISTRO_DEFAULTS=y
-# CONFIG_SYS_MALLOC_F is not set
 CONFIG_FIT_VERBOSE=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
@@ -62,3 +62,10 @@ CONFIG_USB_XHCI_DWC3=y
 CONFIG_WDT=y
 CONFIG_WDT_SP805=y
 CONFIG_EFI_LOADER_BOUNCE_BUFFER=y
+CONFIG_DM_I2C=y
+CONFIG_DM_RTC=y
+CONFIG_DM_GPIO=y
+CONFIG_CMD_DATE=y
+CONFIG_RTC_PCF2127=y
+CONFIG_I2C_MUX=y
+CONFIG_I2C_MUX_PCA954x=y
Signature · 1 line
2.17.1
#3 lore raw

PATCH v2 4/4 armv8: dts: ls1028ardb: 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:
- https://patchwork.ozlabs.org/project/uboot/list/?series=113364
- https://patchwork.ozlabs.org/project/uboot/list/?series=110856
- https://patchwork.ozlabs.org/project/uboot/list/?series=109677

Changes in v2:
- Delete unnecessary aliases about i2c.

 arch/arm/dts/fsl-ls1028a-rdb.dts | 67 ++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)
arch/arm/dts/fsl-ls1028a-rdb.dts +67 -0
index 932cfa2275..ec24373d29 100644
@@ -13,6 +13,20 @@
 / {
 	model = "NXP Layerscape 1028a RDB Board";
 	compatible = "fsl,ls1028a-rdb", "fsl,ls1028a";
+
+	sys_mclk: clock-mclk {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <25000000>;
+	};
+
+	reg_1p8v: regulator-1p8v {
+		compatible = "regulator-fixed";
+		regulator-name = "1P8V";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		regulator-always-on;
+	};
 };
 
 &dspi0 {
@@ -37,6 +51,59 @@
 
 &i2c0 {
 	status = "okay";
+	u-boot,dm-pre-reloc;
+
+	 i2c-mux at 77 {
+
+		compatible = "nxp,pca9547";
+		reg = <0x77>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		i2c at 1 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <0x1>;
+
+			codec: sgtl5000 at a {
+				#sound-dai-cells = <0>;
+				compatible = "fsl,sgtl5000";
+				reg = <0xa>;
+				VDDA-supply = <&reg_1p8v>;
+				VDDIO-supply = <&reg_1p8v>;
+				clocks = <&sys_mclk>;
+				sclk-strength = <3>;
+			};
+		};
+
+		i2c at 2 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <0x02>;
+
+			ina220 at 40 {
+				compatible = "ti,ina220";
+				reg = <0x40>;
+				shunt-resistor = <500>;
+			};
+		};
+
+		i2c at 3 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <0x3>;
+
+			sa56004 at 4c {
+				compatible = "nxp,sa56004";
+				reg = <0x4c>;
+			};
+
+			rtc at 51 {
+				compatible = "pcf2127-rtc";
+				reg = <0x51>;
+			};
+		};
+	};
 };
 
 &i2c1 {
Signature · 1 line
2.17.1