From patchwork Mon Jan 27 17:52:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vignesh Raghavendra X-Patchwork-Id: 240324 List-Id: U-Boot discussion From: vigneshr at ti.com (Vignesh Raghavendra) Date: Mon, 27 Jan 2020 23:22:13 +0530 Subject: [PATCH 1/4] arm: dts: k3-j721e: Add I2C nodes In-Reply-To: <20200127175216.10380-1-vigneshr@ti.com> References: <20200127175216.10380-1-vigneshr@ti.com> Message-ID: <20200127175216.10380-2-vigneshr@ti.com> J721e SoC has 2 I2C instances in MCU domain and 7 I2C instances in main domain. Add DT nodes for the same Signed-off-by: Vignesh Raghavendra --- arch/arm/dts/k3-j721e-main.dtsi | 77 +++++++++++++++++++++++++++ arch/arm/dts/k3-j721e-mcu-wakeup.dtsi | 22 ++++++++ arch/arm/dts/k3-j721e.dtsi | 10 ++++ 3 files changed, 109 insertions(+) diff --git a/arch/arm/dts/k3-j721e-main.dtsi b/arch/arm/dts/k3-j721e-main.dtsi index 5083a0c3aef0..c785ab05121e 100644 --- a/arch/arm/dts/k3-j721e-main.dtsi +++ b/arch/arm/dts/k3-j721e-main.dtsi @@ -433,4 +433,81 @@ dma-coherent; }; }; + + main_i2c0: i2c at 2000000 { + compatible = "ti,j721e-i2c", "ti,omap4-i2c"; + reg = <0x0 0x2000000 0x0 0x100>; + interrupts = ; + #address-cells = <1>; + #size-cells = <0>; + clock-names = "fck"; + clocks = <&k3_clks 187 0>; + power-domains = <&k3_pds 187 TI_SCI_PD_EXCLUSIVE>; + }; + + main_i2c1: i2c at 2010000 { + compatible = "ti,j721e-i2c", "ti,omap4-i2c"; + reg = <0x0 0x2010000 0x0 0x100>; + interrupts = ; + #address-cells = <1>; + #size-cells = <0>; + clock-names = "fck"; + clocks = <&k3_clks 188 0>; + power-domains = <&k3_pds 188 TI_SCI_PD_EXCLUSIVE>; + }; + + main_i2c2: i2c at 2020000 { + compatible = "ti,j721e-i2c", "ti,omap4-i2c"; + reg = <0x0 0x2020000 0x0 0x100>; + interrupts = ; + #address-cells = <1>; + #size-cells = <0>; + clock-names = "fck"; + clocks = <&k3_clks 189 0>; + power-domains = <&k3_pds 189 TI_SCI_PD_EXCLUSIVE>; + }; + + main_i2c3: i2c at 2030000 { + compatible = "ti,j721e-i2c", "ti,omap4-i2c"; + reg = <0x0 0x2030000 0x0 0x100>; + interrupts = ; + #address-cells = <1>; + #size-cells = <0>; + clock-names = "fck"; + clocks = <&k3_clks 190 0>; + power-domains = <&k3_pds 190 TI_SCI_PD_EXCLUSIVE>; + }; + + main_i2c4: i2c at 2040000 { + compatible = "ti,j721e-i2c", "ti,omap4-i2c"; + reg = <0x0 0x2040000 0x0 0x100>; + interrupts = ; + #address-cells = <1>; + #size-cells = <0>; + clock-names = "fck"; + clocks = <&k3_clks 191 0>; + power-domains = <&k3_pds 191 TI_SCI_PD_EXCLUSIVE>; + }; + + main_i2c5: i2c at 2050000 { + compatible = "ti,j721e-i2c", "ti,omap4-i2c"; + reg = <0x0 0x2050000 0x0 0x100>; + interrupts = ; + #address-cells = <1>; + #size-cells = <0>; + clock-names = "fck"; + clocks = <&k3_clks 192 0>; + power-domains = <&k3_pds 192 TI_SCI_PD_EXCLUSIVE>; + }; + + main_i2c6: i2c at 2060000 { + compatible = "ti,j721e-i2c", "ti,omap4-i2c"; + reg = <0x0 0x2060000 0x0 0x100>; + interrupts = ; + #address-cells = <1>; + #size-cells = <0>; + clock-names = "fck"; + clocks = <&k3_clks 193 0>; + power-domains = <&k3_pds 193 TI_SCI_PD_EXCLUSIVE>; + }; }; diff --git a/arch/arm/dts/k3-j721e-mcu-wakeup.dtsi b/arch/arm/dts/k3-j721e-mcu-wakeup.dtsi index 5dd07ac4daf7..fe52fd1b2f9f 100644 --- a/arch/arm/dts/k3-j721e-mcu-wakeup.dtsi +++ b/arch/arm/dts/k3-j721e-mcu-wakeup.dtsi @@ -144,4 +144,26 @@ assigned-clock-rates = <250000000>; }; }; + + mcu_i2c0: i2c at 40b00000 { + compatible = "ti,j721e-i2c", "ti,omap4-i2c"; + reg = <0x0 0x40b00000 0x0 0x100>; + interrupts = ; + #address-cells = <1>; + #size-cells = <0>; + clock-names = "fck"; + clocks = <&k3_clks 194 0>; + power-domains = <&k3_pds 194 TI_SCI_PD_EXCLUSIVE>; + }; + + mcu_i2c1: i2c at 40b10000 { + compatible = "ti,j721e-i2c", "ti,omap4-i2c"; + reg = <0x0 0x40b10000 0x0 0x100>; + interrupts = ; + #address-cells = <1>; + #size-cells = <0>; + clock-names = "fck"; + clocks = <&k3_clks 195 0>; + power-domains = <&k3_pds 195 TI_SCI_PD_EXCLUSIVE>; + }; }; diff --git a/arch/arm/dts/k3-j721e.dtsi b/arch/arm/dts/k3-j721e.dtsi index aea17e25a291..68ba517e5009 100644 --- a/arch/arm/dts/k3-j721e.dtsi +++ b/arch/arm/dts/k3-j721e.dtsi @@ -30,6 +30,16 @@ serial9 = &main_uart7; serial10 = &main_uart8; serial11 = &main_uart9; + i2c0 = &wkup_i2c0; + i2c1 = &mcu_i2c0; + i2c2 = &mcu_i2c1; + i2c3 = &main_i2c0; + i2c4 = &main_i2c1; + i2c5 = &main_i2c2; + i2c6 = &main_i2c3; + i2c7 = &main_i2c4; + i2c8 = &main_i2c5; + i2c9 = &main_i2c6; }; chosen { }; From patchwork Mon Jan 27 17:52:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vignesh Raghavendra X-Patchwork-Id: 240323 List-Id: U-Boot discussion From: vigneshr at ti.com (Vignesh Raghavendra) Date: Mon, 27 Jan 2020 23:22:14 +0530 Subject: [PATCH 2/4] arm: dts: k3-j721e-common-proc-board: Add I2C GPIO expander In-Reply-To: <20200127175216.10380-1-vigneshr@ti.com> References: <20200127175216.10380-1-vigneshr@ti.com> Message-ID: <20200127175216.10380-3-vigneshr@ti.com> Add I2C GPIO expander required to power cycle MMC/SD Signed-off-by: Vignesh Raghavendra --- arch/arm/dts/k3-j721e-common-proc-board.dts | 27 +++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/arch/arm/dts/k3-j721e-common-proc-board.dts b/arch/arm/dts/k3-j721e-common-proc-board.dts index f33a6d5bcff5..d216b707fd2c 100644 --- a/arch/arm/dts/k3-j721e-common-proc-board.dts +++ b/arch/arm/dts/k3-j721e-common-proc-board.dts @@ -107,6 +107,13 @@ J721E_IOPAD(0x214, PIN_OUTPUT, 4) /* (V4) MCAN1_TX.USB1_DRVVBUS */ >; }; + + main_i2c0_pins_default: main-i2c0-pins-default { + pinctrl-single,pins = < + J721E_IOPAD(0x220, PIN_INPUT_PULLUP, 0) /* (AC5) I2C0_SCL */ + J721E_IOPAD(0x224, PIN_INPUT_PULLUP, 0) /* (AA5) I2C0_SDA */ + >; + }; }; &wkup_pmx0 { @@ -145,3 +152,23 @@ pinctrl-0 = <&wkup_i2c0_pins_default>; clock-frequency = <400000>; }; + +&main_i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&main_i2c0_pins_default>; + clock-frequency = <400000>; + + exp1: gpio at 20 { + compatible = "ti,tca6416"; + reg = <0x20>; + gpio-controller; + #gpio-cells = <2>; + }; + + exp2: gpio at 22 { + compatible = "ti,tca6424"; + reg = <0x22>; + gpio-controller; + #gpio-cells = <2>; + }; +}; From patchwork Mon Jan 27 17:52:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vignesh Raghavendra X-Patchwork-Id: 240326 List-Id: U-Boot discussion From: vigneshr at ti.com (Vignesh Raghavendra) Date: Mon, 27 Jan 2020 23:22:15 +0530 Subject: [PATCH 3/4] arm: dts: k3-j721e-common-proc-board: Enable I2C expander for SPL In-Reply-To: <20200127175216.10380-1-vigneshr@ti.com> References: <20200127175216.10380-1-vigneshr@ti.com> Message-ID: <20200127175216.10380-4-vigneshr@ti.com> IO expanders are required to power cycle SD card. So enable the same Signed-off-by: Vignesh Raghavendra --- .../k3-j721e-common-proc-board-u-boot.dtsi | 12 +++++++++ .../arm/dts/k3-j721e-r5-common-proc-board.dts | 27 +++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi b/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi index 7ea4d8de367e..a3a81932168e 100644 --- a/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi +++ b/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi @@ -337,3 +337,15 @@ &wkup_i2c0 { u-boot,dm-spl; }; + +&main_i2c0 { + u-boot,dm-spl; +}; + +&main_i2c0_pins_default { + u-boot,dm-spl; +}; + +&exp2 { + u-boot,dm-spl; +}; diff --git a/arch/arm/dts/k3-j721e-r5-common-proc-board.dts b/arch/arm/dts/k3-j721e-r5-common-proc-board.dts index 585cc839632b..1f14d71438b4 100644 --- a/arch/arm/dts/k3-j721e-r5-common-proc-board.dts +++ b/arch/arm/dts/k3-j721e-r5-common-proc-board.dts @@ -140,6 +140,13 @@ J721E_IOPAD(0x25c, PIN_INPUT, 0) /* (R28) MMC1_SDWP */ >; }; + + main_i2c0_pins_default: main-i2c0-pins-default { + pinctrl-single,pins = < + J721E_IOPAD(0x220, PIN_INPUT_PULLUP, 0) /* (AC5) I2C0_SCL */ + J721E_IOPAD(0x224, PIN_INPUT_PULLUP, 0) /* (AA5) I2C0_SDA */ + >; + }; }; &wkup_uart0 { @@ -225,4 +232,24 @@ ti,vbus-divider; }; +&main_i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&main_i2c0_pins_default>; + clock-frequency = <400000>; + + exp1: gpio at 20 { + compatible = "ti,tca6416"; + reg = <0x20>; + gpio-controller; + #gpio-cells = <2>; + }; + + exp2: gpio at 22 { + compatible = "ti,tca6424"; + reg = <0x22>; + gpio-controller; + #gpio-cells = <2>; + }; +}; + #include "k3-j721e-common-proc-board-u-boot.dtsi" From patchwork Mon Jan 27 17:52:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vignesh Raghavendra X-Patchwork-Id: 240325 List-Id: U-Boot discussion From: vigneshr at ti.com (Vignesh Raghavendra) Date: Mon, 27 Jan 2020 23:22:16 +0530 Subject: [PATCH 4/4] configs: j721e_evm_defconfig: Enable PCA953x IO expander In-Reply-To: <20200127175216.10380-1-vigneshr@ti.com> References: <20200127175216.10380-1-vigneshr@ti.com> Message-ID: <20200127175216.10380-5-vigneshr@ti.com> Enable PCA953x IO expander to control MMC/SD power lines. Signed-off-by: Vignesh Raghavendra --- configs/j721e_evm_a72_defconfig | 4 ++++ configs/j721e_evm_r5_defconfig | 1 + 2 files changed, 5 insertions(+) diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig index 162fa3b53caf..c9591eb25723 100644 --- a/configs/j721e_evm_a72_defconfig +++ b/configs/j721e_evm_a72_defconfig @@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_ARCH_K3=y +CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_SYS_MALLOC_F_LEN=0x8000 @@ -43,6 +44,7 @@ CONFIG_CMD_ASKENV=y CONFIG_CMD_DFU=y # CONFIG_CMD_FLASH is not set CONFIG_CMD_GPT=y +CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y CONFIG_CMD_MTD=y @@ -89,6 +91,8 @@ CONFIG_FASTBOOT_FLASH=y CONFIG_FASTBOOT_FLASH_MMC_DEV=0 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_TI_SCI_PROTOCOL=y +CONFIG_DM_GPIO=y +CONFIG_DM_PCA953X=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_OMAP24XX=y CONFIG_DM_MAILBOX=y diff --git a/configs/j721e_evm_r5_defconfig b/configs/j721e_evm_r5_defconfig index 116470fb5e47..19fbd450c754 100644 --- a/configs/j721e_evm_r5_defconfig +++ b/configs/j721e_evm_r5_defconfig @@ -66,6 +66,7 @@ CONFIG_SPL_CLK=y CONFIG_CLK_TI_SCI=y CONFIG_TI_SCI_PROTOCOL=y CONFIG_DA8XX_GPIO=y +CONFIG_DM_PCA953X=y CONFIG_DM_I2C=y CONFIG_I2C_SET_DEFAULT_BUS_NUM=y CONFIG_SYS_I2C_OMAP24XX=y