Skip to contentSkip to conversation

Add EEPROM-based board detect support for TI K3 SoCs

PATCH New Andreas Dannenberg 3 participants 38 messages Jun 4, 2019 – Jul 19, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 cover Add EEPROM-based board detect support for TI K3 SoCs

This is an updated EEPROM-based board detection series that can applied if staged with other patches in the sequence proposed earlier [1].

For completeness here is the proposed sequence again, avoiding merge conflicts, but this time from the perspective of this patch series.

Step 1) Faiz' "Add Support for eMMC in Am65x-evm" series [2]. It needs
a small update to actuall allow for eMMC boot I posted earlier.
Step 2) The updated (v2) SYSFW loader series just posted [3] Step 3) The updated AM654x EEPROM support proposed with this series Step 4) An updated version of Lokesh's "arm: k3: Allow for exclusive
and shared device requests" series [4]. In addition to a rebase such an updated series should include updating power domain properties for devices that were added during the previous steps.
Step 5) An updated version of Lokesh's "arm: k3: arm64: Initial support
Texas Instrument's J721E Platform" series [5] also adding in the few lines of codes to leverage SYSFW.
Step 6 & beyond) Various rproc patches, etc.

Changes since v2:
- Re-based for proposed staging K3 AM654x patch staging sequence

Changes since initial submission:
- Re-based onto latest 'master' branch
- Collected all review tags
- Re-tested

[1] https://lists.denx.de/pipermail/u-boot/2019-June/371739.html
[2] https://patchwork.ozlabs.org/project/uboot/list/?series=111723
[3] https://patchwork.ozlabs.org/project/uboot/list/?series=111844
[4] https://patchwork.ozlabs.org/project/uboot/list/?series=109163
[5] https://patchwork.ozlabs.org/project/uboot/list/?series=109296

--
Andreas Dannenberg
Texas Instruments Inc

Andreas Dannenberg (16):
arm: dts: k3-am65: Move pinctrl nodes out of U-Boot specific dtsi
arm: dts: k3-am65: Add I2C nodes
arm: dts: k3-am654-base-board: Enable wkup_i2c0 across all boot stages
configs: am65x_evm_defconfig: Enable I2C support
configs: am65x_hs_evm_defconfig: Enable I2C support
arm64: dts: k3-am654-base-board: Add I2C GPIO expander @ 0x38
configs: am65x_evm_a53: Enable PCA953X-type GPIO driver
configs: am65x_hs_evm_a53: Enable PCA953X-type GPIO driver
configs: am65x_evm_a53: Increase malloc pool before relocation
configs: am65x_hs_evm_a53: Increase malloc pool before relocation
arm: K3: am654: Map common EEPROM data into SRAM scratch space
ti: common: am6: Add support for board description EEPROM
ti: common: am6: Add support for setting MAC addresses
board: ti: am654: Use EEPROM-based board detection
configs: am65x_evm: Add support for applying overlays
configs: am65x_hs_evm: Add support for applying overlays

Vignesh R (2):
i2c: omap24xx_i2c: Adapt driver to support K3 devices
arm: omap_i2c: Remove unwanted header file inclusion

 arch/arm/dts/k3-am65-main.dtsi               |  52 ++++
 arch/arm/dts/k3-am65-mcu.dtsi                |  11 +
 arch/arm/dts/k3-am65-wakeup.dtsi             |  19 ++
 arch/arm/dts/k3-am65.dtsi                    |   7 +
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi |  27 +-
 arch/arm/dts/k3-am654-base-board.dts         |  22 ++
 arch/arm/dts/k3-am654-r5-base-board.dts      |  13 +
 arch/arm/include/asm/omap_i2c.h              |   2 -
 arch/arm/mach-k3/am6_init.c                  |   4 +
 arch/arm/mach-k3/include/mach/am6_hardware.h |   3 +
 arch/arm/mach-k3/include/mach/sys_proto.h    |   2 +
 board/ti/am65x/Kconfig                       |   7 +
 board/ti/am65x/evm.c                         | 241 ++++++++++++++++++
 board/ti/common/board_detect.c               | 246 +++++++++++++++++++
 board/ti/common/board_detect.h               | 206 ++++++++++++++++
 configs/am65x_evm_a53_defconfig              |  11 +-
 configs/am65x_evm_r5_defconfig               |   4 +
 configs/am65x_hs_evm_a53_defconfig           |  11 +-
 configs/am65x_hs_evm_r5_defconfig            |   4 +
 drivers/i2c/Kconfig                          |   2 +-
 include/configs/am65x_evm.h                  |  18 +-
 21 files changed, 884 insertions(+), 28 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH v3 1/18 i2c: omap24xx_i2c: Adapt driver to support K3 devices

From: Vignesh R <[email protected]>

K3 devices have I2C IP that is same as OMAP2+ family. Allow driver to be compiled for ARCH_K3.

---
 drivers/i2c/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/Kconfig +1 -1
index 095a9bc6a4..4772db3837 100644
@@ -330,7 +330,7 @@ endif
 
 config SYS_I2C_OMAP24XX
 	bool "TI OMAP2+ I2C driver"
-	depends on ARCH_OMAP2PLUS
+	depends on ARCH_OMAP2PLUS || ARCH_K3
 	help
 	  Add support for the OMAP2+ I2C driver.
 
Signature · 1 line
2.17.1
#2 lore raw

PATCH v3 1/18 i2c: omap24xx_i2c: Adapt driver to support K3 devices

Quoted 9 lines · Andreas Dannenberg

From: Vignesh R <[email protected]>

K3 devices have I2C IP that is same as OMAP2+ family. Allow driver to be compiled for ARCH_K3.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/64e60143/attachment.sig>
#3 lore raw

PATCH v3 2/18 arm: omap_i2c: Remove unwanted header file inclusion

In reply to Andreas Dannenberg

From: Vignesh R <[email protected]>

There is no need for to include this header here, so drop it.

---
 arch/arm/include/asm/omap_i2c.h | 2 --
 1 file changed, 2 deletions(-)
arch/arm/include/asm/omap_i2c.h +0 -2
index c1695cbbee..a6975401da 100644
@@ -3,8 +3,6 @@
 #ifndef _OMAP_I2C_H
 #define _OMAP_I2C_H
 
-#include <asm/arch/cpu.h>
-
 #ifdef CONFIG_DM_I2C
 
 /* Information about a GPIO bank */
Signature · 1 line
2.17.1
#4 lore raw

PATCH v3 2/18 arm: omap_i2c: Remove unwanted header file inclusion

Quoted 7 lines · Andreas Dannenberg

From: Vignesh R <[email protected]>

There is no need for to include this header here, so drop it.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/af18da2c/attachment.sig>
#5 lore raw

PATCH v3 3/18 arm: dts: k3-am65: Move pinctrl nodes out of U-Boot specific dtsi

In reply to Andreas Dannenberg

Only U-Boot specifc DT properties or overrides, must be in -u-boot.dtsi. Pinctrl nodes does not belong here. Now that pinctrl nodes are in kernel DT, there is no reason to be keep these in -u-boot.dtsi. Move them to proper places so that it would ease copying DT entries from kernel DT.

---
 arch/arm/dts/k3-am65-main.dtsi               |  8 ++++++++
 arch/arm/dts/k3-am65-wakeup.dtsi             |  8 ++++++++
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi | 15 ---------------
 3 files changed, 16 insertions(+), 15 deletions(-)
arch/arm/dts/k3-am65-main.dtsi +8 -0
index 84fed12fbd..a97872f62e 100644
@@ -78,6 +78,14 @@
 		pinctrl-single,function-mask = <0xffffffff>;
 	};
 
+	main_pmx1: pinmux at 11c2e8 {
+		compatible = "pinctrl-single";
+		reg = <0x0 0x11c2e8 0x0 0x24>;
+		#pinctrl-cells = <1>;
+		pinctrl-single,register-width = <32>;
+		pinctrl-single,function-mask = <0xffffffff>;
+	};
+
 	sdhci0: sdhci at 4f80000 {
 		compatible = "ti,am654-sdhci-5.1";
 		reg = <0x0 0x4f80000 0x0 0x260>, <0x0 0x4f90000 0x0 0x134>;
arch/arm/dts/k3-am65-wakeup.dtsi +8 -0
index 1f591ef8bb..1b67747dfe 100644
@@ -34,6 +34,14 @@
 		};
 	};
 
+	wkup_pmx0: pinmux at 4301c000 {
+		compatible = "pinctrl-single";
+		reg = <0x4301c000 0x118>;
+		#pinctrl-cells = <1>;
+		pinctrl-single,register-width = <32>;
+		pinctrl-single,function-mask = <0xffffffff>;
+	};
+
 	wkup_uart0: serial at 42300000 {
 		compatible = "ti,am654-uart";
 		reg = <0x42300000 0x100>;
arch/arm/dts/k3-am654-base-board-u-boot.dtsi +0 -15
index c43888f36d..67535f76a5 100644
@@ -19,14 +19,6 @@
 &cbass_main{
 	u-boot,dm-spl;
 
-	main_pmx1: pinmux at 11c2e8 {
-		compatible = "pinctrl-single";
-		reg = <0x0 0x11c2e8 0x0 0x24>;
-		#pinctrl-cells = <1>;
-		pinctrl-single,register-width = <32>;
-		pinctrl-single,function-mask = <0xffffffff>;
-	};
-
 	sdhci1: sdhci at 04FA0000 {
 		compatible = "ti,am654-sdhci-5.1";
 		reg = <0x0 0x4FA0000 0x0 0x1000>,
@@ -42,13 +34,6 @@
 
 &cbass_mcu {
 	u-boot,dm-spl;
-	wkup_pmx0: pinmux at 4301c000 {
-		compatible = "pinctrl-single";
-		reg = <0x0 0x4301c000 0x0 0x118>;
-		#pinctrl-cells = <1>;
-		pinctrl-single,register-width = <32>;
-		pinctrl-single,function-mask = <0xffffffff>;
-	};
 
 	navss_mcu: navss-mcu {
 		compatible = "simple-bus";
Signature · 1 line
2.17.1
#6 lore raw

PATCH v3 3/18 arm: dts: k3-am65: Move pinctrl nodes out of U-Boot specific dtsi

Quoted 7 lines · Andreas Dannenberg

Only U-Boot specifc DT properties or overrides, must be in -u-boot.dtsi. Pinctrl nodes does not belong here. Now that pinctrl nodes are in kernel DT, there is no reason to be keep these in -u-boot.dtsi. Move them to proper places so that it would ease copying DT entries from kernel DT.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/a523c8fc/attachment.sig>
#7 lore raw

PATCH v3 4/18 arm: dts: k3-am65: Add I2C nodes

In reply to Andreas Dannenberg

Add I2C DT nodes

---
 arch/arm/dts/k3-am65-main.dtsi   | 44 ++++++++++++++++++++++++++++++++
 arch/arm/dts/k3-am65-mcu.dtsi    | 11 ++++++++
 arch/arm/dts/k3-am65-wakeup.dtsi | 11 ++++++++
 arch/arm/dts/k3-am65.dtsi        |  6 +++++
 4 files changed, 72 insertions(+)
arch/arm/dts/k3-am65-main.dtsi +44 -0
index a97872f62e..39fec03b4a 100644
@@ -99,4 +99,48 @@
 		ti,trm-icp = <0x8>;
 		dma-coherent;
 	};
+
+	main_i2c0: i2c at 2000000 {
+		compatible = "ti,am654-i2c", "ti,omap4-i2c";
+		reg = <0x0 0x2000000 0x0 0x100>;
+		interrupts = <GIC_SPI 200 IRQ_TYPE_LEVEL_HIGH>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		clock-names = "fck";
+		clocks = <&k3_clks 110 1>;
+		power-domains = <&k3_pds 110>;
+	};
+
+	main_i2c1: i2c at 2010000 {
+		compatible = "ti,am654-i2c", "ti,omap4-i2c";
+		reg = <0x0 0x2010000 0x0 0x100>;
+		interrupts = <GIC_SPI 201 IRQ_TYPE_LEVEL_HIGH>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		clock-names = "fck";
+		clocks = <&k3_clks 111 1>;
+		power-domains = <&k3_pds 111>;
+	};
+
+	main_i2c2: i2c at 2020000 {
+		compatible = "ti,am654-i2c", "ti,omap4-i2c";
+		reg = <0x0 0x2020000 0x0 0x100>;
+		interrupts = <GIC_SPI 202 IRQ_TYPE_LEVEL_HIGH>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		clock-names = "fck";
+		clocks = <&k3_clks 112 1>;
+		power-domains = <&k3_pds 112>;
+	};
+
+	main_i2c3: i2c at 2030000 {
+		compatible = "ti,am654-i2c", "ti,omap4-i2c";
+		reg = <0x0 0x2030000 0x0 0x100>;
+		interrupts = <GIC_SPI 203 IRQ_TYPE_LEVEL_HIGH>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		clock-names = "fck";
+		clocks = <&k3_clks 113 1>;
+		power-domains = <&k3_pds 113>;
+	};
 };
arch/arm/dts/k3-am65-mcu.dtsi +11 -0
index 8c611d16df..1fd027748e 100644
@@ -15,4 +15,15 @@
 			clock-frequency = <96000000>;
 			current-speed = <115200>;
 	};
+
+	mcu_i2c0: i2c at 40b00000 {
+		compatible = "ti,am654-i2c", "ti,omap4-i2c";
+		reg = <0x0 0x40b00000 0x0 0x100>;
+		interrupts = <GIC_SPI 564 IRQ_TYPE_LEVEL_HIGH>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		clock-names = "fck";
+		clocks = <&k3_clks 114 1>;
+		power-domains = <&k3_pds 114>;
+	};
 };
arch/arm/dts/k3-am65-wakeup.dtsi +11 -0
index 1b67747dfe..1f85006f55 100644
@@ -51,4 +51,15 @@
 		clock-frequency = <48000000>;
 		current-speed = <115200>;
 	};
+
+	wkup_i2c0: i2c at 42120000 {
+		compatible = "ti,am654-i2c", "ti,omap4-i2c";
+		reg = <0x42120000 0x100>;
+		interrupts = <GIC_SPI 696 IRQ_TYPE_LEVEL_HIGH>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		clock-names = "fck";
+		clocks = <&k3_clks 115 1>;
+		power-domains = <&k3_pds 115>;
+	};
 };
arch/arm/dts/k3-am65.dtsi +6 -0
index 3d4bf369d0..5bcf6e0693 100644
@@ -22,6 +22,12 @@
 		serial2 = &main_uart0;
 		serial3 = &main_uart1;
 		serial4 = &main_uart2;
+		i2c0 = &wkup_i2c0;
+		i2c1 = &mcu_i2c0;
+		i2c2 = &main_i2c0;
+		i2c3 = &main_i2c1;
+		i2c4 = &main_i2c2;
+		i2c5 = &main_i2c3;
 	};
 
 	chosen { };
Signature · 1 line
2.17.1
#8 lore raw

PATCH v3 4/18 arm: dts: k3-am65: Add I2C nodes

Quoted 4 lines · Andreas Dannenberg

Add I2C DT nodes

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/8885bf64/attachment.sig>
#9 lore raw

PATCH v3 5/18 arm: dts: k3-am654-base-board: Enable wkup_i2c0 across all boot stages

In reply to Andreas Dannenberg

To enable the use of an EEPROM-based board detection scheme we need to be able to access the I2C bus associated with the EEPROMs across all 3 stages of U-Boot: R5 SPL, A53 SPL, and A53 U-Boot (proper). So go ahead and add/update the wkup_i2c0 peripheral module DTS definitions and its associated pinmux node accordingly.

---
 arch/arm/dts/k3-am65.dtsi                    |  1 +
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi | 12 ++++++++++++
 arch/arm/dts/k3-am654-base-board.dts         | 15 +++++++++++++++
 arch/arm/dts/k3-am654-r5-base-board.dts      | 13 +++++++++++++
 4 files changed, 41 insertions(+)
arch/arm/dts/k3-am65.dtsi +1 -0
index 5bcf6e0693..50f4be2047 100644
@@ -8,6 +8,7 @@
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/pinctrl/k3.h>
 
 / {
 	model = "Texas Instruments K3 AM654 SoC";
arch/arm/dts/k3-am654-base-board-u-boot.dtsi +12 -0
index 67535f76a5..e21562252f 100644
@@ -110,6 +110,14 @@
 	u-boot,dm-spl;
 };
 
+&wkup_pmx0 {
+	u-boot,dm-spl;
+
+	wkup_i2c0_pins_default {
+		u-boot,dm-spl;
+	};
+};
+
 &main_pmx0 {
 	u-boot,dm-spl;
 	main_uart0_pins_default: main_uart0_pins_default {
@@ -179,3 +187,7 @@
 	sdhci-caps-mask = <0x7 0x0>;
 	ti,driver-strength-ohm = <50>;
 };
+
+&wkup_i2c0 {
+	u-boot,dm-spl;
+};
arch/arm/dts/k3-am654-base-board.dts +15 -0
index ab233916c6..248d60e89b 100644
@@ -55,6 +55,15 @@
 	};
 };
 
+&wkup_pmx0 {
+	wkup_i2c0_pins_default: wkup-i2c0-pins-default {
+		pinctrl-single,pins = <
+			AM65X_WKUP_IOPAD(0x00e0, PIN_INPUT, 0) /* (AC7) WKUP_I2C0_SCL */
+			AM65X_WKUP_IOPAD(0x00e4, PIN_INPUT, 0) /* (AD6) WKUP_I2C0_SDA */
+		>;
+	};
+};
+
 &sdhci0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&main_mmc0_pins_default>;
@@ -62,3 +71,9 @@
 	non-removable;
 	ti,driver-strength-ohm = <50>;
 };
+
+&wkup_i2c0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&wkup_i2c0_pins_default>;
+	clock-frequency = <400000>;
+};
arch/arm/dts/k3-am654-r5-base-board.dts +13 -0
index 8deda328d0..9d9b3d5852 100644
@@ -136,6 +136,13 @@
 		>;
 		u-boot,dm-spl;
 	};
+
+	wkup_i2c0_pins_default: wkup-i2c0-pins-default {
+		pinctrl-single,pins = <
+			AM65X_WKUP_IOPAD(0x00e0, PIN_INPUT, 0) /* (AC7) WKUP_I2C0_SCL */
+			AM65X_WKUP_IOPAD(0x00e4, PIN_INPUT, 0) /* (AD6) WKUP_I2C0_SDA */
+		>;
+	};
 };
 
 &main_pmx0 {
@@ -176,3 +183,9 @@
 	/delete-property/ power-domains;
 	ti,driver-strength-ohm = <50>;
 };
+
+&wkup_i2c0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&wkup_i2c0_pins_default>;
+	clock-frequency = <400000>;
+};
Signature · 1 line
2.17.1
#10 lore raw

PATCH v3 5/18 arm: dts: k3-am654-base-board: Enable wkup_i2c0 across all boot stages

Quoted 8 lines · Andreas Dannenberg

To enable the use of an EEPROM-based board detection scheme we need to be able to access the I2C bus associated with the EEPROMs across all 3 stages of U-Boot: R5 SPL, A53 SPL, and A53 U-Boot (proper). So go ahead and add/update the wkup_i2c0 peripheral module DTS definitions and its associated pinmux node accordingly.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/abd2fdca/attachment.sig>
#11 lore raw

PATCH v3 6/18 configs: am65x_evm_defconfig: Enable I2C support

In reply to Andreas Dannenberg

Enable I2C via driver model as well as the associated set of U-Boot commands to allow us interacting with various I2C slave devices.

---
 configs/am65x_evm_a53_defconfig | 4 ++++
 configs/am65x_evm_r5_defconfig  | 4 ++++
 2 files changed, 8 insertions(+)
configs/am65x_evm_a53_defconfig +4 -0
index d5f8a01fae..1459512b15 100644
@@ -33,6 +33,7 @@ CONFIG_SPL_YMODEM_SUPPORT=y
 CONFIG_CMD_ASKENV=y
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_GPT=y
+CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_REMOTEPROC=y
 # CONFIG_CMD_SETEXPR is not set
@@ -55,6 +56,9 @@ CONFIG_CLK_TI_SCI=y
 CONFIG_DMA_CHANNELS=y
 CONFIG_TI_K3_NAVSS_UDMA=y
 CONFIG_TI_SCI_PROTOCOL=y
+CONFIG_DM_I2C=y
+CONFIG_I2C_SET_DEFAULT_BUS_NUM=y
+CONFIG_SYS_I2C_OMAP24XX=y
 CONFIG_DM_MAILBOX=y
 CONFIG_K3_SEC_PROXY=y
 CONFIG_DM_MMC=y
configs/am65x_evm_r5_defconfig +4 -0
index d81018b31d..7e81a98454 100644
@@ -37,6 +37,7 @@ CONFIG_CMD_BOOTZ=y
 CONFIG_CMD_ASKENV=y
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_GPT=y
+CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_REMOTEPROC=y
 # CONFIG_CMD_SETEXPR is not set
@@ -62,6 +63,9 @@ CONFIG_CLK_TI_SCI=y
 CONFIG_TI_SCI_PROTOCOL=y
 CONFIG_DM_GPIO=y
 CONFIG_DA8XX_GPIO=y
+CONFIG_DM_I2C=y
+CONFIG_I2C_SET_DEFAULT_BUS_NUM=y
+CONFIG_SYS_I2C_OMAP24XX=y
 CONFIG_DM_MAILBOX=y
 CONFIG_K3_SEC_PROXY=y
 CONFIG_MISC=y
Signature · 1 line
2.17.1
#12 lore raw

PATCH v3 6/18 configs: am65x_evm_defconfig: Enable I2C support

Quoted 6 lines · Andreas Dannenberg

Enable I2C via driver model as well as the associated set of U-Boot commands to allow us interacting with various I2C slave devices.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/138960c7/attachment.sig>
#13 lore raw

PATCH v3 7/18 configs: am65x_hs_evm_defconfig: Enable I2C support

In reply to Andreas Dannenberg

Enable I2C via driver model as well as the associated set of U-Boot commands to allow us interacting with various I2C slave devices.

---
 configs/am65x_hs_evm_a53_defconfig | 4 ++++
 configs/am65x_hs_evm_r5_defconfig  | 4 ++++
 2 files changed, 8 insertions(+)
configs/am65x_hs_evm_a53_defconfig +4 -0
index 62e9d720fe..7e36b2805b 100644
@@ -35,6 +35,7 @@ CONFIG_SPL_REMOTEPROC=y
 CONFIG_SPL_YMODEM_SUPPORT=y
 CONFIG_CMD_ASKENV=y
 # CONFIG_CMD_FLASH is not set
+CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_REMOTEPROC=y
 # CONFIG_CMD_SETEXPR is not set
@@ -58,6 +59,9 @@ CONFIG_CLK_TI_SCI=y
 CONFIG_DMA_CHANNELS=y
 CONFIG_TI_K3_NAVSS_UDMA=y
 CONFIG_TI_SCI_PROTOCOL=y
+CONFIG_DM_I2C=y
+CONFIG_I2C_SET_DEFAULT_BUS_NUM=y
+CONFIG_SYS_I2C_OMAP24XX=y
 CONFIG_DM_MAILBOX=y
 CONFIG_K3_SEC_PROXY=y
 CONFIG_DM_MMC=y
configs/am65x_hs_evm_r5_defconfig +4 -0
index 9e01899031..d378d1e9ee 100644
@@ -39,6 +39,7 @@ CONFIG_CMD_BOOTZ=y
 CONFIG_CMD_ASKENV=y
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_GPT=y
+CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_REMOTEPROC=y
 # CONFIG_CMD_SETEXPR is not set
@@ -62,6 +63,9 @@ CONFIG_CLK_TI_SCI=y
 CONFIG_TI_SCI_PROTOCOL=y
 CONFIG_DM_GPIO=y
 CONFIG_DA8XX_GPIO=y
+CONFIG_DM_I2C=y
+CONFIG_I2C_SET_DEFAULT_BUS_NUM=y
+CONFIG_SYS_I2C_OMAP24XX=y
 CONFIG_DM_MAILBOX=y
 CONFIG_K3_SEC_PROXY=y
 CONFIG_MISC=y
Signature · 1 line
2.17.1
#14 lore raw

PATCH v3 7/18 configs: am65x_hs_evm_defconfig: Enable I2C support

Quoted 6 lines · Andreas Dannenberg

Enable I2C via driver model as well as the associated set of U-Boot commands to allow us interacting with various I2C slave devices.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/fa1225cf/attachment.sig>
#15 lore raw

PATCH v3 8/18 arm64: dts: k3-am654-base-board: Add I2C GPIO expander @ 0x38

In reply to Andreas Dannenberg

The AM654 base board has a TCA9554/PCA9554-type GPIO expander on the wkup_i2c0 bus at address 0x38 that is used to detect the presence of daughter cards. Add a respective DTS description of this expander to enable its use.

---
 arch/arm/dts/k3-am654-base-board.dts | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/dts/k3-am654-base-board.dts +7 -0
index 248d60e89b..e73b9aa6b1 100644
@@ -76,4 +76,11 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&wkup_i2c0_pins_default>;
 	clock-frequency = <400000>;
+
+	tca9554: gpio at 38 {
+		compatible = "nxp,pca9554";
+		reg = <0x38>;
+		gpio-controller;
+		#gpio-cells = <2>;
+	};
 };
Signature · 1 line
2.17.1
#16 lore raw

PATCH v3 8/18 arm64: dts: k3-am654-base-board: Add I2C GPIO expander @ 0x38

Quoted 7 lines · Andreas Dannenberg

The AM654 base board has a TCA9554/PCA9554-type GPIO expander on the wkup_i2c0 bus at address 0x38 that is used to detect the presence of daughter cards. Add a respective DTS description of this expander to enable its use.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/94ab6ca1/attachment.sig>
#17 lore raw

PATCH v3 9/18 configs: am65x_evm_a53: Enable PCA953X-type GPIO driver

In reply to Andreas Dannenberg

Enable GPIO driver for PCA953X-compatible I2C-based I/O expander which includes support for the TCA9554/PCA9554-type expander found on the AM654 EVM base board.

---
 configs/am65x_evm_a53_defconfig | 2 ++
 1 file changed, 2 insertions(+)
configs/am65x_evm_a53_defconfig +2 -0
index 1459512b15..5fa7a7e657 100644
@@ -56,6 +56,8 @@ CONFIG_CLK_TI_SCI=y
 CONFIG_DMA_CHANNELS=y
 CONFIG_TI_K3_NAVSS_UDMA=y
 CONFIG_TI_SCI_PROTOCOL=y
+CONFIG_DM_GPIO=y
+CONFIG_DM_PCA953X=y
 CONFIG_DM_I2C=y
 CONFIG_I2C_SET_DEFAULT_BUS_NUM=y
 CONFIG_SYS_I2C_OMAP24XX=y
Signature · 1 line
2.17.1
#18 lore raw

PATCH v3 9/18 configs: am65x_evm_a53: Enable PCA953X-type GPIO driver

Quoted 6 lines · Andreas Dannenberg

Enable GPIO driver for PCA953X-compatible I2C-based I/O expander which includes support for the TCA9554/PCA9554-type expander found on the AM654 EVM base board.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/11362771/attachment.sig>
#19 lore raw

PATCH v3 10/18 configs: am65x_hs_evm_a53: Enable PCA953X-type GPIO driver

In reply to Andreas Dannenberg

Enable GPIO driver for PCA953X-compatible I2C-based I/O expander which includes support for the TCA9554/PCA9554-type expander found on the AM654 EVM base board.

---
 configs/am65x_hs_evm_a53_defconfig | 2 ++
 1 file changed, 2 insertions(+)
configs/am65x_hs_evm_a53_defconfig +2 -0
index 7e36b2805b..e619b794ea 100644
@@ -59,6 +59,8 @@ CONFIG_CLK_TI_SCI=y
 CONFIG_DMA_CHANNELS=y
 CONFIG_TI_K3_NAVSS_UDMA=y
 CONFIG_TI_SCI_PROTOCOL=y
+CONFIG_DM_GPIO=y
+CONFIG_DM_PCA953X=y
 CONFIG_DM_I2C=y
 CONFIG_I2C_SET_DEFAULT_BUS_NUM=y
 CONFIG_SYS_I2C_OMAP24XX=y
Signature · 1 line
2.17.1
#20 lore raw

PATCH v3 10/18 configs: am65x_hs_evm_a53: Enable PCA953X-type GPIO driver

Quoted 7 lines · Andreas Dannenberg

Enable GPIO driver for PCA953X-compatible I2C-based I/O expander which includes support for the TCA9554/PCA9554-type expander found on the AM654 EVM base board.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/1afa3702/attachment.sig>
#21 lore raw

PATCH v3 11/18 configs: am65x_evm_a53: Increase malloc pool before relocation

In reply to Andreas Dannenberg

The malloc pool used before relocation is getting tight leading to out of memory errors doing certain DM-related calls. Since we are running the A53 SPL out of DDR let's just go ahead and bump its size as used in U-Boot proper as well as SPL (via Kconfig default value) from 8KB to 32KB.

---
 configs/am65x_evm_a53_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configs/am65x_evm_a53_defconfig +1 -1
index 5fa7a7e657..8d90014778 100644
@@ -2,7 +2,7 @@ CONFIG_ARM=y
 CONFIG_ARCH_K3=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
-CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_SYS_MALLOC_F_LEN=0x8000
 CONFIG_SOC_K3_AM6=y
 CONFIG_TARGET_AM654_A53_EVM=y
 CONFIG_SPL_MMC_SUPPORT=y
Signature · 1 line
2.17.1
#22 lore raw

PATCH v3 11/18 configs: am65x_evm_a53: Increase malloc pool before relocation

Quoted 8 lines · Andreas Dannenberg

The malloc pool used before relocation is getting tight leading to out of memory errors doing certain DM-related calls. Since we are running the A53 SPL out of DDR let's just go ahead and bump its size as used in U-Boot proper as well as SPL (via Kconfig default value) from 8KB to 32KB.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/289dc8a3/attachment.sig>
#23 lore raw

PATCH v3 12/18 configs: am65x_hs_evm_a53: Increase malloc pool before relocation

In reply to Andreas Dannenberg

The malloc pool used before relocation is getting tight leading to out of memory errors doing certain DM-related calls. Since we are running the A53 SPL out of DDR let's just go ahead and bump its size as used in U-Boot proper as well as SPL (via Kconfig default value) from 8KB to 32KB.

---
 configs/am65x_hs_evm_a53_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configs/am65x_hs_evm_a53_defconfig +1 -1
index e619b794ea..7d7a673714 100644
@@ -3,7 +3,7 @@ CONFIG_ARCH_K3=y
 CONFIG_TI_SECURE_DEVICE=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
-CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_SYS_MALLOC_F_LEN=0x8000
 CONFIG_SOC_K3_AM6=y
 CONFIG_TARGET_AM654_A53_EVM=y
 CONFIG_SPL_MMC_SUPPORT=y
Signature · 1 line
2.17.1
#24 lore raw

PATCH v3 12/18 configs: am65x_hs_evm_a53: Increase malloc pool before relocation

Quoted 9 lines · Andreas Dannenberg

The malloc pool used before relocation is getting tight leading to out of memory errors doing certain DM-related calls. Since we are running the A53 SPL out of DDR let's just go ahead and bump its size as used in U-Boot proper as well as SPL (via Kconfig default value) from 8KB to 32KB.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/b9939500/attachment.sig>
#25 lore raw

PATCH v3 13/18 arm: K3: am654: Map common EEPROM data into SRAM scratch space

In reply to Andreas Dannenberg

The board detection scheme employed on various TI EVMs makes use of SRAM scratch space to share data read from an on-board EEPROM between the different bootloading stages. Map the associated definition that's used to locate this data into the SRAM scratch space we use on AM654x.

---
 arch/arm/mach-k3/include/mach/am6_hardware.h | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/mach-k3/include/mach/am6_hardware.h +3 -0
index 3343233aa3..6df7631545 100644
@@ -44,4 +44,7 @@
 #define CTRLMMR_LOCK_KICK1				0x0100c
 #define CTRLMMR_LOCK_KICK1_UNLOCK_VAL			0xd172bc5a
 
+/* MCU SCRATCHPAD usage */
+#define TI_SRAM_SCRATCH_BOARD_EEPROM_START CONFIG_SYS_K3_MCU_SCRATCHPAD_BASE
+
 #endif /* __ASM_ARCH_AM6_HARDWARE_H */
Signature · 1 line
2.17.1
#26 lore raw

PATCH v3 13/18 arm: K3: am654: Map common EEPROM data into SRAM scratch space

Quoted 7 lines · Andreas Dannenberg

The board detection scheme employed on various TI EVMs makes use of SRAM scratch space to share data read from an on-board EEPROM between the different bootloading stages. Map the associated definition that's used to locate this data into the SRAM scratch space we use on AM654x.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/9cda7e58/attachment.sig>
#27 lore raw

PATCH v3 14/18 ti: common: am6: Add support for board description EEPROM

In reply to Andreas Dannenberg

The AM654x EVM based on the TI K3 family of SoCs have an updated board detection EEPROM structure, now comprising variable-sized TLV-type records, containing a superset of what is already being provided on earlier platforms such as DRA7. Add basic support for parsing the new data structures contained on the base board into the common TI EEPROM structure while also providing infrastructure that can be used later on to parse data from additional EEPROMs such as the ones that are used on daughtercards for this platform.

---
 board/ti/common/board_detect.c | 214 +++++++++++++++++++++++++++++++++
 board/ti/common/board_detect.h | 194 ++++++++++++++++++++++++++++++
 2 files changed, 408 insertions(+)
board/ti/common/board_detect.c +214 -0
index e258e22f37..fea39f21e8 100644
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <asm/arch/hardware.h>
 #include <asm/omap_common.h>
 #include <dm/uclass.h>
 #include <i2c.h>
@@ -284,6 +285,191 @@ int __maybe_unused ti_i2c_eeprom_dra7_get(int bus_addr, int dev_addr)
 	return 0;
 }
 
+static int ti_i2c_eeprom_am6_parse_record(struct ti_am6_eeprom_record *record,
+					  struct ti_am6_eeprom *ep,
+					  char **mac_addr,
+					  u8 mac_addr_max_cnt,
+					  u8 *mac_addr_cnt)
+{
+	switch (record->header.id) {
+	case TI_AM6_EEPROM_RECORD_BOARD_INFO:
+		if (record->header.len != sizeof(record->data.board_info))
+			return -EINVAL;
+
+		if (!ep)
+			break;
+
+		/* Populate (and clean, if needed) the board name */
+		strlcpy(ep->name, record->data.board_info.name,
+			sizeof(ep->name));
+		ti_eeprom_string_cleanup(ep->name);
+
+		/* Populate selected other fields from the board info record */
+		strlcpy(ep->version, record->data.board_info.version,
+			sizeof(ep->version));
+		strlcpy(ep->software_revision,
+			record->data.board_info.software_revision,
+			sizeof(ep->software_revision));
+		strlcpy(ep->serial, record->data.board_info.serial,
+			sizeof(ep->serial));
+		break;
+	case TI_AM6_EEPROM_RECORD_MAC_INFO:
+		if (record->header.len != sizeof(record->data.mac_info))
+			return -EINVAL;
+
+		if (!mac_addr || !mac_addr_max_cnt)
+			break;
+
+		*mac_addr_cnt = ((record->data.mac_info.mac_control &
+				 TI_AM6_EEPROM_MAC_ADDR_COUNT_MASK) >>
+				 TI_AM6_EEPROM_MAC_ADDR_COUNT_SHIFT) + 1;
+
+		/*
+		 * The EEPROM can (but may not) hold a very large amount
+		 * of MAC addresses, by far exceeding what we want/can store
+		 * in the common memory array, so only grab what we can fit.
+		 * Note that a value of 0 means 1 MAC address, and so on.
+		 */
+		*mac_addr_cnt = min(*mac_addr_cnt, mac_addr_max_cnt);
+
+		memcpy(mac_addr, record->data.mac_info.mac_addr,
+		       *mac_addr_cnt * TI_EEPROM_HDR_ETH_ALEN);
+		break;
+	case 0x00:
+		/* Illegal value... Fall through... */
+	case 0xFF:
+		/* Illegal value... Something went horribly wrong... */
+		return -EINVAL;
+	default:
+		pr_warn("%s: Ignoring record id %u\n", __func__,
+			record->header.id);
+	}
+
+	return 0;
+}
+
+int __maybe_unused ti_i2c_eeprom_am6_get(int bus_addr, int dev_addr,
+					 struct ti_am6_eeprom *ep,
+					 char **mac_addr,
+					 u8 mac_addr_max_cnt,
+					 u8 *mac_addr_cnt)
+{
+	struct udevice *dev;
+	struct udevice *bus;
+	unsigned int eeprom_addr;
+	struct ti_am6_eeprom_record_board_id board_id;
+	struct ti_am6_eeprom_record record;
+	int rc;
+
+	/* Initialize with a known bad marker for i2c fails.. */
+	memset(ep, 0, sizeof(*ep));
+	ep->header = TI_DEAD_EEPROM_MAGIC;
+
+	/* Read the board ID record which is always the first EEPROM record */
+	rc = ti_i2c_eeprom_get(bus_addr, dev_addr, TI_EEPROM_HEADER_MAGIC,
+			       sizeof(board_id), (uint8_t *)&board_id);
+	if (rc)
+		return rc;
+
+	if (board_id.header.id != TI_AM6_EEPROM_RECORD_BOARD_ID) {
+		pr_err("%s: Invalid board ID record!\n", __func__);
+		return -EINVAL;
+	}
+
+	/* Establish DM handle to board config EEPROM */
+	rc = uclass_get_device_by_seq(UCLASS_I2C, bus_addr, &bus);
+	if (rc)
+		return rc;
+	rc = i2c_get_chip(bus, dev_addr, 1, &dev);
+	if (rc)
+		return rc;
+
+	ep->header = TI_EEPROM_HEADER_MAGIC;
+
+	/* Ready to parse TLV structure. Initialize variables... */
+	*mac_addr_cnt = 0;
+
+	/*
+	 * After the all-encompassing board ID record all other records follow
+	 * a TLV-type scheme. Point to the first such record and then start
+	 * parsing those one by one.
+	 */
+	eeprom_addr = sizeof(board_id);
+
+	while (true) {
+		rc = dm_i2c_read(dev, eeprom_addr, (uint8_t *)&record.header,
+				 sizeof(record.header));
+		if (rc)
+			return rc;
+
+		/*
+		 * Check for end of list marker. If we reached it don't go
+		 * any further and stop parsing right here.
+		 */
+		if (record.header.id == TI_AM6_EEPROM_RECORD_END_LIST)
+			break;
+
+		eeprom_addr += sizeof(record.header);
+
+		debug("%s: dev_addr=0x%02x header.id=%u header.len=%u\n",
+		      __func__, dev_addr, record.header.id,
+		      record.header.len);
+
+		/* Read record into memory if it fits */
+		if (record.header.len <= sizeof(record.data)) {
+			rc = dm_i2c_read(dev, eeprom_addr,
+					 (uint8_t *)&record.data,
+					 record.header.len);
+			if (rc)
+				return rc;
+
+			/* Process record */
+			rc = ti_i2c_eeprom_am6_parse_record(&record, ep,
+							    mac_addr,
+							    mac_addr_max_cnt,
+							    mac_addr_cnt);
+			if (rc) {
+				pr_err("%s: EEPROM parsing error!\n", __func__);
+				return rc;
+			}
+		} else {
+			/*
+			 * We may get here in case of larger records which
+			 * are not yet understood.
+			 */
+			pr_err("%s: Ignoring record id %u\n", __func__,
+			       record.header.id);
+		}
+
+		eeprom_addr += record.header.len;
+	}
+
+	return 0;
+}
+
+int __maybe_unused ti_i2c_eeprom_am6_get_base(int bus_addr, int dev_addr)
+{
+	struct ti_am6_eeprom *ep = TI_AM6_EEPROM_DATA;
+	int ret;
+
+	/*
+	 * Always execute EEPROM read by not allowing to bypass it during the
+	 * first invocation of SPL which happens on the R5 core.
+	 */
+#if !(defined(CONFIG_SPL_BUILD) && defined(CONFIG_CPU_V7R))
+	if (ep->header == TI_EEPROM_HEADER_MAGIC) {
+		debug("%s: EEPROM has already been read\n", __func__);
+		return 0;
+	}
+#endif
+
+	ret = ti_i2c_eeprom_am6_get(bus_addr, dev_addr, ep,
+				    (char **)ep->mac_addr,
+				    AM6_EEPROM_HDR_NO_OF_MAC_ADDR,
+				    &ep->mac_addr_cnt);
+	return ret;
+}
+
 bool __maybe_unused board_ti_is(char *name_tag)
 {
 	struct ti_common_eeprom *ep = TI_EEPROM_DATA;
@@ -391,6 +577,34 @@ void __maybe_unused set_board_info_env(char *name)
 		env_set("board_serial", unknown);
 }
 
+void __maybe_unused set_board_info_env_am6(char *name)
+{
+	char *unknown = "unknown";
+	struct ti_am6_eeprom *ep = TI_AM6_EEPROM_DATA;
+
+	if (name)
+		env_set("board_name", name);
+	else if (ep->name)
+		env_set("board_name", ep->name);
+	else
+		env_set("board_name", unknown);
+
+	if (ep->version)
+		env_set("board_rev", ep->version);
+	else
+		env_set("board_rev", unknown);
+
+	if (ep->software_revision)
+		env_set("board_software_revision", ep->software_revision);
+	else
+		env_set("board_software_revision", unknown);
+
+	if (ep->serial)
+		env_set("board_serial", ep->serial);
+	else
+		env_set("board_serial", unknown);
+}
+
 static u64 mac_to_u64(u8 mac[6])
 {
 	int i;
board/ti/common/board_detect.h +194 -0

218 lines not on this page · raw message

Signature · 1 line
2.17.1
#28 lore raw

PATCH v3 14/18 ti: common: am6: Add support for board description EEPROM

Quoted 11 lines · Andreas Dannenberg

The AM654x EVM based on the TI K3 family of SoCs have an updated board detection EEPROM structure, now comprising variable-sized TLV-type records, containing a superset of what is already being provided on earlier platforms such as DRA7. Add basic support for parsing the new data structures contained on the base board into the common TI EEPROM structure while also providing infrastructure that can be used later on to parse data from additional EEPROMs such as the ones that are used on daughtercards for this platform.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/0988014c/attachment.sig>
#29 lore raw

PATCH v3 15/18 ti: common: am6: Add support for setting MAC addresses

In reply to Andreas Dannenberg

The AM654x EVM based on the TI K3 family of SoCs has an updated board detection EEPROM structure that contains a TLV record of dedicated MAC addresses rather than a range of MAC addresses as it was used on earlier platforms such as DRA7. Add a basic function that allows us setting up Ethernet MAC addresses into the U-Boot environment based on the MAC address record contained in the common TI EEPROM structure.

---
 board/ti/common/board_detect.c | 32 ++++++++++++++++++++++++++++++++
 board/ti/common/board_detect.h | 12 ++++++++++++
 2 files changed, 44 insertions(+)
board/ti/common/board_detect.c +32 -0
index fea39f21e8..32fa10599e 100644
@@ -534,6 +534,25 @@ fail:
 	memset(mac_addr, 0, TI_EEPROM_HDR_ETH_ALEN);
 }
 
+void __maybe_unused
+board_ti_am6_get_eth_mac_addr(int index,
+			      u8 mac_addr[TI_EEPROM_HDR_ETH_ALEN])
+{
+	struct ti_am6_eeprom *ep = TI_AM6_EEPROM_DATA;
+
+	if (ep->header == TI_DEAD_EEPROM_MAGIC)
+		goto fail;
+
+	if (index < 0 || index >= ep->mac_addr_cnt)
+		goto fail;
+
+	memcpy(mac_addr, ep->mac_addr[index], TI_EEPROM_HDR_ETH_ALEN);
+	return;
+
+fail:
+	memset(mac_addr, 0, TI_EEPROM_HDR_ETH_ALEN);
+}
+
 u64 __maybe_unused board_ti_get_emif1_size(void)
 {
 	struct ti_common_eeprom *ep = TI_EEPROM_DATA;
@@ -667,6 +686,19 @@ void board_ti_set_ethaddr(int index)
 	}
 }
 
+void board_ti_am6_set_ethaddr(int index, int count)
+{
+	u8 mac_addr[6];
+	int i;
+
+	for (i = 0; i < count; i++) {
+		board_ti_am6_get_eth_mac_addr(i, mac_addr);
+		if (is_valid_ethaddr(mac_addr))
+			eth_env_set_enetaddr_by_index("eth", i + index,
+						      mac_addr);
+	}
+}
+
 bool __maybe_unused board_ti_was_eeprom_read(void)
 {
 	struct ti_common_eeprom *ep = TI_EEPROM_DATA;
board/ti/common/board_detect.h +12 -0
index bf563c84c8..a45d8961b9 100644
@@ -398,6 +398,18 @@ void set_board_info_env_am6(char *name);
  */
 void board_ti_set_ethaddr(int index);
 
+/**
+ * board_ti_am6_set_ethaddr- Sets the ethaddr environment from EEPROM
+ * @index: The first eth<index>addr environment variable to set
+ * @count: The number of MAC addresses to process
+ *
+ * EEPROM should be already read before calling this function. The EEPROM
+ * contains n dedicated MAC addresses. This function sets the ethaddr
+ * environment variable for all the available MAC addresses starting
+ * from eth<index>addr.
+ */
+void board_ti_am6_set_ethaddr(int index, int count);
+
 /**
  * board_ti_was_eeprom_read() - Check to see if the eeprom contents have been read
  *
Signature · 1 line
2.17.1
#30 lore raw

PATCH v3 15/18 ti: common: am6: Add support for setting MAC addresses

Quoted 9 lines · Andreas Dannenberg

The AM654x EVM based on the TI K3 family of SoCs has an updated board detection EEPROM structure that contains a TLV record of dedicated MAC addresses rather than a range of MAC addresses as it was used on earlier platforms such as DRA7. Add a basic function that allows us setting up Ethernet MAC addresses into the U-Boot environment based on the MAC address record contained in the common TI EEPROM structure.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/8acb9a16/attachment.sig>
#31 lore raw

PATCH v3 16/18 board: ti: am654: Use EEPROM-based board detection

In reply to Andreas Dannenberg

The TI AM654x EVM base board and the associated daughtercards have on- board I2C-based EEPROMs containing board configuration data. Use the board detection infrastructure introduced earlier to do the following:

1) Parse the AM654x EVM base board EEPROM and populate items like board name and MAC addresses into the TI common EEPROM data structure residing in SRAM scratch space
2) Check for presence of daughter card(s) by probing the associated presence signals via an I2C-based GPIO expander. Then, if such a card is found, parse the data such as additional Ethernet MAC addresses from its on-board EEPROM and populate into U-Boot accordingly
3) Dynamically create an U-Boot ENV variable called overlay_files containing a list of daugherboard-specific DTB overlays based on daughercards found.

This patch adds support for the AM654x base board ("AM6-COMPROCEVM") as well as for the IDK ("AM6-IDKAPPEVM"), OLDI LCD ("OLDI-LCD1EVM") PCIe/USB3.0 ("SER-PCIEUSBEVM"), 2 Lane PCIe/USB2.0 ("SER-PCIE2LEVM"), and general purpuse ("AM6-GPAPPEVM") daughtercards.

---
 arch/arm/mach-k3/am6_init.c               |   4 +
 arch/arm/mach-k3/include/mach/sys_proto.h |   2 +
 board/ti/am65x/Kconfig                    |   7 +
 board/ti/am65x/evm.c                      | 241 ++++++++++++++++++++++
 include/configs/am65x_evm.h               |   9 +-
 5 files changed, 257 insertions(+), 6 deletions(-)
arch/arm/mach-k3/am6_init.c +4 -0
index e326f575e5..cb96581bfb 100644
@@ -11,6 +11,7 @@
 #include <spl.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/sysfw-loader.h>
+#include <asm/arch/sys_proto.h>
 #include "common.h"
 #include <dm.h>
 #include <dm/uclass-internal.h>
@@ -111,6 +112,9 @@ void board_init_f(ulong dummy)
 	preloader_console_init();
 #endif
 
+	/* Perform EEPROM-based board detection */
+	do_board_detect();
+
 #ifdef CONFIG_K3_AM654_DDRSS
 	ret = uclass_get_device(UCLASS_RAM, 0, &dev);
 	if (ret)
arch/arm/mach-k3/include/mach/sys_proto.h +2 -0
index 018725b4d1..787a274492 100644
@@ -12,4 +12,6 @@ u32 wait_on_value(u32 read_bit_mask, u32 match_value, void *read_addr,
 		  u32 bound);
 struct ti_sci_handle *get_ti_sci_handle(void);
 int fdt_fixup_msmc_ram(void *blob, char *parent_path, char *node_name);
+int do_board_detect(void);
+
 #endif
board/ti/am65x/Kconfig +7 -0
index 60bb834aca..47b41cd6af 100644
@@ -12,6 +12,8 @@ config TARGET_AM654_A53_EVM
 	select ARM64
 	select SOC_K3_AM6
 	select SYS_DISABLE_DCACHE_OPS
+	select BOARD_LATE_INIT
+	imply TI_I2C_BOARD_DETECT
 
 config TARGET_AM654_R5_EVM
 	bool "TI K3 based AM654 EVM running on R5"
@@ -21,6 +23,7 @@ config TARGET_AM654_R5_EVM
 	select K3_LOAD_SYSFW
 	select K3_AM654_DDRSS
 	imply SYS_K3_SPL_ATF
+	imply TI_I2C_BOARD_DETECT
 
 endchoice
 
@@ -35,6 +38,8 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
        default "am65x_evm"
 
+source "board/ti/common/Kconfig"
+
 endif
 
 if TARGET_AM654_R5_EVM
@@ -51,4 +56,6 @@ config SYS_CONFIG_NAME
 config SPL_LDSCRIPT
 	default "arch/arm/mach-omap2/u-boot-spl.lds"
 
+source "board/ti/common/Kconfig"
+
 endif
board/ti/am65x/evm.c +241 -0

254 lines not on this page · raw message

include/configs/am65x_evm.h +3 -6
index 1d291f5724..552ef780bd 100644
@@ -65,12 +65,9 @@
 /* U-Boot general configuration */
 #define EXTRA_ENV_AM65X_BOARD_SETTINGS					\
 	"findfdt="							\
-		"if test $board_name = am65x; then "			\
-			"setenv name_fdt k3-am654-base-board.dtb; "	\
-		"else if test $name_fdt = undefined; then "		\
-			"echo WARNING: Could not determine device tree to use;"\
-		"fi; fi; "						\
-		"setenv fdtfile ${name_fdt}\0"				\
+		"setenv name_fdt k3-am654-base-board.dtb;"		\
+		"setenv fdtfile ${name_fdt};"				\
+		"setenv overlay_files ${name_overlays}\0"		\
 	"loadaddr=0x80080000\0"						\
 	"fdtaddr=0x82000000\0"						\
 	"name_kern=Image\0"						\
Signature · 1 line
2.17.1
#32 lore raw

PATCH v3 16/18 board: ti: am654: Use EEPROM-based board detection

Quoted 16 lines · Andreas Dannenberg

The TI AM654x EVM base board and the associated daughtercards have on- board I2C-based EEPROMs containing board configuration data. Use the board detection infrastructure introduced earlier to do the following:

1) Parse the AM654x EVM base board EEPROM and populate items like board name and MAC addresses into the TI common EEPROM data structure residing in SRAM scratch space
2) Check for presence of daughter card(s) by probing the associated presence signals via an I2C-based GPIO expander. Then, if such a card is found, parse the data such as additional Ethernet MAC addresses from its on-board EEPROM and populate into U-Boot accordingly
3) Dynamically create an U-Boot ENV variable called overlay_files containing a list of daugherboard-specific DTB overlays based on daughercards found.

Quoted 7 lines

This patch adds support for the AM654x base board ("AM6-COMPROCEVM") as well as for the IDK ("AM6-IDKAPPEVM"), OLDI LCD ("OLDI-LCD1EVM") PCIe/USB3.0 ("SER-PCIEUSBEVM"), 2 Lane PCIe/USB2.0 ("SER-PCIE2LEVM"), and general purpuse ("AM6-GPAPPEVM") daughtercards.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/ce4a80ca/attachment.sig>
#33 lore raw

PATCH v3 17/18 configs: am65x_evm: Add support for applying overlays

In reply to Andreas Dannenberg

This will allow for downloading and applying overlays from an MMC/SD boot media based on the overlay_files ENV variable containing a list of overlay files.

---
 configs/am65x_evm_a53_defconfig | 3 ++-
 include/configs/am65x_evm.h     | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
configs/am65x_evm_a53_defconfig +2 -1
index 8d90014778..b0c080ebf1 100644
@@ -16,7 +16,7 @@ CONFIG_DISTRO_DEFAULTS=y
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_OF_BOARD_SETUP=y
-CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run get_kern_${boot}; run get_fdt_${boot}; run run_kern"
+CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_SPL_TEXT_BASE=0x80080000
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
@@ -83,3 +83,4 @@ CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
 CONFIG_FAT_WRITE=y
+CONFIG_OF_LIBFDT_OVERLAY=y
include/configs/am65x_evm.h +9 -0
index 552ef780bd..1415bb1b15 100644
@@ -70,6 +70,7 @@
 		"setenv overlay_files ${name_overlays}\0"		\
 	"loadaddr=0x80080000\0"						\
 	"fdtaddr=0x82000000\0"						\
+	"overlayaddr=0x83000000\0"					\
 	"name_kern=Image\0"						\
 	"console=ttyS2,115200n8\0"					\
 	"args_all=setenv optargs earlycon=ns16550a,mmio32,0x02800000\0" \
@@ -84,6 +85,14 @@
 	"rd_spec=-\0"							\
 	"init_mmc=run args_all args_mmc\0"				\
 	"get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${name_fdt}\0" \
+	"get_overlay_mmc="						\
+		"fdt address ${fdtaddr};"				\
+		"fdt resize 0x100000;"					\
+		"for overlay in $overlay_files;"			\
+		"do;"							\
+		"load mmc ${bootpart} ${overlayaddr} ${bootdir}/${overlay};"	\
+		"fdt apply ${overlayaddr};"				\
+		"done;\0"						\
 	"get_kern_mmc=load mmc ${bootpart} ${loadaddr} "		\
 		"${bootdir}/${name_kern}\0"				\
 	"partitions=" PARTS_DEFAULT
Signature · 1 line
2.17.1
#34 lore raw

PATCH v3 17/18 configs: am65x_evm: Add support for applying overlays

Quoted 6 lines · Andreas Dannenberg

This will allow for downloading and applying overlays from an MMC/SD boot media based on the overlay_files ENV variable containing a list of overlay files.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/eb4c0211/attachment.sig>
#35 lore raw

PATCH v3 18/18 configs: am65x_hs_evm: Add support for applying overlays

In reply to Andreas Dannenberg

This will allow for downloading and applying overlays from an MMC/SD boot media based on the overlay_files ENV variable containing a list of overlay files.

---
 configs/am65x_hs_evm_a53_defconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
configs/am65x_hs_evm_a53_defconfig +2 -1
index 7d7a673714..56052f73f3 100644
@@ -19,7 +19,7 @@ CONFIG_FIT_IMAGE_POST_PROCESS=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y
 CONFIG_OF_BOARD_SETUP=y
-CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run get_kern_${boot}; run get_fdt_${boot}; run run_kern"
+CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_SPL_TEXT_BASE=0x80080000
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
@@ -85,3 +85,4 @@ CONFIG_SOC_TI=y
 CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
+CONFIG_OF_LIBFDT_OVERLAY=y
Signature · 1 line
2.17.1
#36 lore raw

PATCH v3 18/18 configs: am65x_hs_evm: Add support for applying overlays

Quoted 6 lines · Andreas Dannenberg

This will allow for downloading and applying overlays from an MMC/SD boot media based on the overlay_files ENV variable containing a list of overlay files.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/617efcfe/attachment.sig>
#37 lore raw

v3 cover Add EEPROM-based board detect support for TI K3 SoCs

In reply to Andreas Dannenberg
Quoted 6 lines · Andreas Dannenberg

This is an updated EEPROM-based board detection series that can applied if staged with other patches in the sequence proposed earlier [1].

For completeness here is the proposed sequence again, avoiding merge conflicts, but this time from the perspective of this patch series.

Quoted 14 lines

Step 1) Faiz' "Add Support for eMMC in Am65x-evm" series [2]. It needs
a small update to actuall allow for eMMC boot I posted earlier.
Step 2) The updated (v2) SYSFW loader series just posted [3] Step 3) The updated AM654x EEPROM support proposed with this series Step 4) An updated version of Lokesh's "arm: k3: Allow for exclusive
and shared device requests" series [4]. In addition to a rebase such an updated series should include updating power domain properties for devices that were added during the previous steps.
Step 5) An updated version of Lokesh's "arm: k3: arm64: Initial support
Texas Instrument's J721E Platform" series [5] also adding in the few lines of codes to leverage SYSFW.
Step 6 & beyond) Various rproc patches, etc.

tested this series on AM654 evm using SD boot. FWIW:

Thanks and regards,
Lokesh