diff mbox

[U-Boot,v2,12/28] tegra: video: Don't power up the SOR twice

Message ID 20170531235737.11676-13-sjg@chromium.org
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass May 31, 2017, 11:57 p.m. UTC
If U-Boot is the secondary boot loader, or has been run from itself, the
SOR may already be powered up. Powering it up again causes a hang, so
detect this situation and skip it.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 drivers/video/tegra124/sor.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Anatolij Gustschin June 2, 2017, 5:36 a.m. UTC | #1
Hi Simon,

On Wed, 31 May 2017 17:57:20 -0600
Simon Glass sjg@chromium.org wrote:

> If U-Boot is the secondary boot loader, or has been run from itself, the
> SOR may already be powered up. Powering it up again causes a hang, so
> detect this situation and skip it.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
> Changes in v2: None
> 
>  drivers/video/tegra124/sor.c | 9 +++++++++
>  1 file changed, 9 insertions(+)

Acked-by: Anatolij Gustschin <agust@denx.de>
Simon Glass June 9, 2017, 12:01 a.m. UTC | #2
Hi Simon,

On Wed, 31 May 2017 17:57:20 -0600
Simon Glass sjg@chromium.org wrote:

> If U-Boot is the secondary boot loader, or has been run from itself, the
> SOR may already be powered up. Powering it up again causes a hang, so
> detect this situation and skip it.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2: None
>
>  drivers/video/tegra124/sor.c | 9 +++++++++
>  1 file changed, 9 insertions(+)

Acked-by: Anatolij Gustschin <agust@denx.de>

Applied to u-boot-dm, thanks!
diff mbox

Patch

diff --git a/drivers/video/tegra124/sor.c b/drivers/video/tegra124/sor.c
index 1f5e572bda..700ab25d46 100644
--- a/drivers/video/tegra124/sor.c
+++ b/drivers/video/tegra124/sor.c
@@ -466,11 +466,20 @@  void tegra_dc_sor_set_lane_count(struct udevice *dev, u8 lane_count)
 static int tegra_dc_sor_power_up(struct udevice *dev, int is_lvds)
 {
 	struct tegra_dc_sor_data *sor = dev_get_priv(dev);
+	u32 reg;
 	int ret;
 
 	if (sor->power_is_up)
 		return 0;
 
+	/*
+	 * If for some reason it is already powered up, don't do it again.
+	 * This can happen if U-Boot is the secondary boot loader.
+	 */
+	reg = tegra_sor_readl(sor, DP_PADCTL(sor->portnum));
+	if (reg & DP_PADCTL_PD_TXD_0_NO)
+		return 0;
+
 	/* Set link bw */
 	tegra_dc_sor_set_link_bandwidth(dev, is_lvds ?
 					CLK_CNTRL_DP_LINK_SPEED_LVDS :