Skip to contentSkip to conversation

arm: dts: k3-am68-phyboard-izar-u-boot: Add mcu_i2c0

PATCH In review Dominik Haller 2 participants 3 messages Jul 15 – Jul 28 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 arm: dts: k3-am68-phyboard-izar-u-boot: Add mcu_i2c0

Add mcu_i2c0 to access the pmic watchdog control registers.

---
 arch/arm/dts/k3-am68-phyboard-izar-u-boot.dtsi | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
arch/arm/dts/k3-am68-phyboard-izar-u-boot.dtsi +15 -2
index cd40506d3ac6..503ed69d123f 100644
@@ -8,14 +8,27 @@
 
 #include "k3-am68-phycore-som-binman.dtsi"
 
+&wkup_pmx2 {
+	mcu_i2c0_pins_default: mcu-i2c0-default-pins {
+		pinctrl-single,pins = <
+			J721S2_WKUP_IOPAD(0x0a0, PIN_INPUT, 0) /* (G24) MCU_I2C0_SCL */
+			J721S2_WKUP_IOPAD(0x0a4, PIN_INPUT, 0) /* (J25) MCU_I2C0_SDA */
+		>;
+	};
+};
+
 &cbass_main {
 	bootph-all;
 };
 
-&watchdog1 {
-	status = "disabled";
+&mcu_i2c0 {
+	status = "okay";
 };
 
 &mcu_uart0 {
 	bootph-all;
 };
+
+&watchdog1 {
+	status = "disabled";
+};
Signature · 1 line
2.43.0
#1 lore raw

PATCH 2/2 board: phytec: phycore_am68x: Turn off pmic watchdog

Starting with pmic firmware version 5 the watchdog is enabled with a timeout window of 13 minutes by default.

The TI EVMs use a dip switch to control a gpio on the pmic which gets configured as DISABLE_WDOG by the firmware.
On the phycore_am68x there is no such dip switch so pull resistors would be necessary. Using mcu_i2c0 to turn off the pmic watchdog works with all hardware and pmic firmware combinations.

---
 board/phytec/phycore_am68x/phycore-am68x.c | 41 ++++++++++++++++++++++
 configs/phycore_am68x_a72_defconfig        |  1 -
 2 files changed, 41 insertions(+), 1 deletion(-)
board/phytec/phycore_am68x/phycore-am68x.c +41 -0
index 312d7ece23e2..9b71a4bdc680 100644
@@ -21,6 +21,7 @@
 #include <dm/uclass-internal.h>
 #include <dm/root.h>
 #include <asm/arch/k3-ddr.h>
+#include <i2c.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -69,6 +70,46 @@ void spl_perform_board_fixups(struct spl_image_info *spl_image)
 }
 #endif
 
+#define TPS6594_I2C_WD_ADDR	0x12
+#define WD_THR_CFG_REG		0x09
+#define WD_EN			BIT(6)
+
+int tps6594_disable_watchdog(void)
+{
+	struct udevice *i2c_bus, *i2c_dev;
+	int ret;
+	u8 val;
+
+	ret = uclass_get_device_by_name(UCLASS_I2C, "i2c@40b00000", &i2c_bus);
+	if (ret)
+		return ret;
+
+	ret = dm_i2c_probe(i2c_bus, TPS6594_I2C_WD_ADDR, 0, &i2c_dev);
+	if (ret)
+		return ret;
+
+	ret = dm_i2c_reg_read(i2c_dev, WD_THR_CFG_REG);
+	if (ret < 0)
+		return ret;
+
+	val = (u8)ret;
+	val &= ~WD_EN;
+	ret = dm_i2c_reg_write(i2c_dev, WD_THR_CFG_REG, val);
+
+	return ret;
+}
+
+int board_init(void)
+{
+	int ret;
+
+	ret = tps6594_disable_watchdog();
+	if (ret)
+		printf("disabling TPS6594 watchdog failed: %d\n", ret);
+
+	return 0;
+}
+
 void spl_board_init(void)
 {
 	struct udevice *dev;
configs/phycore_am68x_a72_defconfig +0 -1
index 5ede3eb73e7f..e74e604e1bc7 100644
@@ -38,7 +38,6 @@ CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_BOOTCOMMAND="bootflow scan -lb; run ${boot}boot"
 CONFIG_DEFAULT_FDT_FILE="oftree"
 CONFIG_LOGLEVEL=7
-# CONFIG_BOARD_INIT is not set
 CONFIG_SPL_MAX_SIZE=0xc0000
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
Signature · 1 line
2.43.0
#2 lore raw
In reply to Dominik Haller
Quoted 3 lines · Dominik Haller

Add mcu_i2c0 to access the pmic watchdog control registers.

Applied to u-boot/main, thanks!

[1/2] arm: dts: k3-am68-phyboard-izar-u-boot: Add mcu_i2c0

      commit: 1efe750e728e18fb37c1705d4ec3f6176ca3d9d5
[2/2] board: phytec: phycore_am68x: Turn off pmic watchdog
      commit: cecee552a732500cf822c94014fdc56fddd1af4e
Signature · 1 line
Tom