All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Delaunay <patrick.delaunay@st.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 30/48] stm32mp1: board: enable v1v2_hdmi and v3v3_hdmi regulator on dk2 boot
Date: Tue, 30 Jul 2019 19:16:38 +0200	[thread overview]
Message-ID: <1564507016-16570-31-git-send-email-patrick.delaunay@st.com> (raw)
In-Reply-To: <1564507016-16570-1-git-send-email-patrick.delaunay@st.com>

As for Audio codec IC, HDMI IC is not "IO safe".
HDMI regulators (v3v3 and v1v2) must be enabled to allow
I2C1 bus usage. HDMI IC must be under reset during power up
and keep HDMI and AUDIO devices in reset while they are not
used in U-Boot to keep them in low power mode
(each device can be kept in reset independently keeping their
power supplies ON until kernel).

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

 arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi |  6 +++
 board/st/stm32mp1/Kconfig                |  4 ++
 board/st/stm32mp1/stm32mp1.c             | 70 ++++++++++++++++++++++++++++++++
 3 files changed, 80 insertions(+)

diff --git a/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi b/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi
index 06ef3a4..18ac1e3 100644
--- a/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi
+++ b/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi
@@ -4,3 +4,9 @@
  */
 
 #include "stm32mp157a-dk1-u-boot.dtsi"
+
+&i2c1 {
+	hdmi-transmitter at 39 {
+		reset-gpios = <&gpioa 10 GPIO_ACTIVE_LOW>;
+	};
+};
diff --git a/board/st/stm32mp1/Kconfig b/board/st/stm32mp1/Kconfig
index 87216c0..4fa2360 100644
--- a/board/st/stm32mp1/Kconfig
+++ b/board/st/stm32mp1/Kconfig
@@ -22,4 +22,8 @@ config CMD_STBOARD
 	  This compile the stboard command to
 	  read and write the board in the OTP.
 
+config TARGET_STM32MP157C_DK2
+	bool "support of STMicroelectronics STM32MP157C-DK2 Discovery Board"
+	default y
+
 endif
diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index ad3db31..2837e9a 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -504,6 +504,73 @@ static void sysconf_init(void)
 #endif
 }
 
+#ifdef CONFIG_DM_REGULATOR
+/* Fix to make I2C1 usable on DK2 for touchscreen usage in kernel */
+static int dk2_i2c1_fix(void)
+{
+	ofnode node;
+	struct gpio_desc hdmi, audio;
+	int ret = 0;
+
+	node = ofnode_path("/soc/i2c at 40012000/hdmi-transmitter at 39");
+	if (!ofnode_valid(node)) {
+		pr_debug("%s: no hdmi-transmitter at 39 ?\n", __func__);
+		return -ENOENT;
+	}
+
+	if (gpio_request_by_name_nodev(node, "reset-gpios", 0,
+				       &hdmi, GPIOD_IS_OUT)) {
+		pr_debug("%s: could not find reset-gpios\n",
+			 __func__);
+		return -ENOENT;
+	}
+
+	node = ofnode_path("/soc/i2c at 40012000/cs42l51 at 4a");
+	if (!ofnode_valid(node)) {
+		pr_debug("%s: no cs42l51 at 4a ?\n", __func__);
+		return -ENOENT;
+	}
+
+	if (gpio_request_by_name_nodev(node, "reset-gpios", 0,
+				       &audio, GPIOD_IS_OUT)) {
+		pr_debug("%s: could not find reset-gpios\n",
+			 __func__);
+		return -ENOENT;
+	}
+
+	/* before power up, insure that HDMI and AUDIO IC is under reset */
+	ret = dm_gpio_set_value(&hdmi, 1);
+	if (ret) {
+		pr_err("%s: can't set_value for hdmi_nrst gpio", __func__);
+		goto error;
+	}
+	ret = dm_gpio_set_value(&audio, 1);
+	if (ret) {
+		pr_err("%s: can't set_value for audio_nrst gpio", __func__);
+		goto error;
+	}
+
+	/* power-up audio IC */
+	regulator_autoset_by_name("v1v8_audio", NULL);
+
+	/* power-up HDMI IC */
+	regulator_autoset_by_name("v1v2_hdmi", NULL);
+	regulator_autoset_by_name("v3v3_hdmi", NULL);
+
+error:
+	return ret;
+}
+
+static bool board_is_dk2(void)
+{
+	if (CONFIG_IS_ENABLED(TARGET_STM32MP157C_DK2) &&
+	    of_machine_is_compatible("st,stm32mp157c-dk2"))
+		return true;
+
+	return false;
+}
+#endif
+
 /* board dependent setup after realloc */
 int board_init(void)
 {
@@ -522,6 +589,9 @@ int board_init(void)
 	board_key_check();
 
 #ifdef CONFIG_DM_REGULATOR
+	if (board_is_dk2())
+		dk2_i2c1_fix();
+
 	regulators_enable_boot_on(_DEBUG);
 #endif
 
-- 
2.7.4

  parent reply	other threads:[~2019-07-30 17:16 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-30 17:16 [U-Boot] [PATCH 00/48] stm32mp1 patches for v2019.10 Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 01/48] stm32mp1: cosmetic: remove comment Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 02/48] pinctrl: pinctrl_stm32: cosmetic: Reorder include files Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 03/48] pinctrl: stmfx: update pinconf settings Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 04/48] ARM: dts: stm32mp1: sync device tree with v5.3-rc2 Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 05/48] ARM: dts: stm32mp1: DDR config v1.45 Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 06/48] ARM: dts: stm32mp1: Add iwdg2 support for SPL Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 07/48] ARM: dts: stm32mp1: Add PSCI node access before relocation Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 08/48] ARM: dts: stm32mp1: add ldtc pre-reloc proper in SOC file Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 09/48] ARM: dts: stm32mp1: add key support on DK1/DK2 Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 10/48] ARM: dts: stm32mp1: add pull-up on serial rx of console connected to STLINK Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 11/48] dt-bindings: clock: stm32mp1: support disabled fixed clock Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 12/48] stpmic1: program pmic to keep only the debug unit on Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 13/48] stm32mp1: configs: remove CONFIG_SYS_HZ Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 14/48] stm32mp1: configs: activate CONFIG_SILENT_CONSOLE Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 15/48] stm32mp1: configs: activate PRE_CONSOLE_BUFFER Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 16/48] stm32mp1: configs: deactivate ARMV7_VIRT for basic boot Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 17/48] stm32mp1: configs: select CONFIG_STM32_SERIAL Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 18/48] stm32mp1: configs: Activate DISABLE_CONSOLE Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 19/48] stm32mp1: configs: support MTDPARTS only if needed Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 20/48] stm32mp1: configs: imply CONFIG_OF_LIBFDT_OVERLAY Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 21/48] stm32mp1: configs: Deactivate SPI_FLASH_BAR Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 22/48] stm32mp1: configs: add CONFIG_DM_VIDEO Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 23/48] stm32mp1: configs: add BACKLIGHT_GPIO support Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 24/48] stm32mp1: configs: add CONFIG_CMD_BMP Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 25/48] stm32mp1: configs: add condition to activate WATCHDOG in SPL Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 26/48] stm32mp1: configs: add altbootcmd Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 27/48] stm32mp1: configs: Set bootdelay to 1 Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 28/48] stm32mp1: configs: add spi load support in spl Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 29/48] stm32mp1: board: add environment variable for board id and board rev Patrick Delaunay
2019-07-30 17:16 ` Patrick Delaunay [this message]
2019-07-30 17:16 ` [U-Boot] [PATCH 31/48] stm32mp1: board: support of error led on ed1/ev1 board Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 32/48] stm32mp1: board: protect the led function calls Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 33/48] stm32mp1: board: check the boot-source to disable bootdelay Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 34/48] stm32mp1: board: Update the way vdd-supply is retrieved from DT Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 35/48] stm32mp1: board: remove board_check_usb_power when ADC is not activated Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 36/48] stm32mp1: board: cosmetic: cleanup file Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 37/48] mmc: stm32_sdmmc2: reload watchdog Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 38/48] serial: stm32: add Framing error support Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 39/48] serial: stm32: remove unused include Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 40/48] stm32mp1: ram: cosmetic: remove unused prototype Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 41/48] stm32mp1: ram: fix address issue in 2 tests Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 42/48] stm32mp1: ram: update loop management in infinite test Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 43/48] stm32mp1: ram: reload watchdog during ddr test Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 44/48] stm32mp1: ram: add pattern parameter in infinite write test Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 45/48] stm32mp1: Makefile cleanup Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 46/48] stm32mp1: clk: remove debug traces Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 47/48] stm32mp1: clk: use gd to store frequency information Patrick Delaunay
2019-07-30 17:16 ` [U-Boot] [PATCH 48/48] MAINTAINERS: update ARM STM STM32MP and STM32MP1 BOARD Patrick Delaunay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1564507016-16570-31-git-send-email-patrick.delaunay@st.com \
    --to=patrick.delaunay@st.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.