diff mbox

drm/tegra: Reset the SOR during initialization

Message ID 1427273979-394-1-git-send-email-tomeu.vizoso@collabora.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tomeu Vizoso March 25, 2015, 8:59 a.m. UTC
As there isn't a way for the firmware on the Nyan chromebooks to hand
over the display to the kernel, and the kernel isn't redoing the whole
configuration at present.

With this patch, the SOR is brought to a known state and we get correct
display on every boot.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>

---

v7:	* Move the reset to the host1x_client_ops.init callback as
	suggested by Thierry
	* Reduced the time during which the reset line is asserted from
	20ms to 2ms
---
 drivers/gpu/drm/tegra/sor.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Dmitry Osipenko March 26, 2015, 9:24 a.m. UTC | #1
25.03.2015 11:59, Tomeu Vizoso ?????:
> As there isn't a way for the firmware on the Nyan chromebooks to hand
> over the display to the kernel, and the kernel isn't redoing the whole
> configuration at present.
>
> With this patch, the SOR is brought to a known state and we get correct
> display on every boot.
>
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
>
> ---
>
> v7:	* Move the reset to the host1x_client_ops.init callback as
> 	suggested by Thierry
> 	* Reduced the time during which the reset line is asserted from
> 	20ms to 2ms
> ---
>   drivers/gpu/drm/tegra/sor.c | 18 ++++++++++++++++++
>   1 file changed, 18 insertions(+)
>
> diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
> index 2afe478..027a25d22 100644
> --- a/drivers/gpu/drm/tegra/sor.c
> +++ b/drivers/gpu/drm/tegra/sor.c
> @@ -1354,12 +1354,30 @@ static int tegra_sor_init(struct host1x_client *client)
>   		}
>   	}
>
> +	/*
> +	 * XXX: Remove this reset once proper hand-over from firmware to
> +	 * kernel is possible.
> +	 */
> +	err = reset_control_assert(sor->rst);
> +	if (err < 0) {
> +		dev_err(sor->dev, "failed to assert SOR reset: %d\n", err);
> +		return err;
> +	}
> +
>   	err = clk_prepare_enable(sor->clk);
>   	if (err < 0) {
>   		dev_err(sor->dev, "failed to enable clock: %d\n", err);
>   		return err;
>   	}
>
> +	msleep(2);
> +
> +	err = reset_control_deassert(sor->rst);
> +	if (err < 0) {
> +		dev_err(sor->dev, "failed to deassert SOR reset: %d\n", err);
> +		return err;
> +	}
> +
>   	err = clk_prepare_enable(sor->clk_safe);
>   	if (err < 0)
>   		return err;
>

According to kernel doc, you should use usleep_range() instead of msleep().

https://www.kernel.org/doc/Documentation/timers/timers-howto.txt
diff mbox

Patch

diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index 2afe478..027a25d22 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -1354,12 +1354,30 @@  static int tegra_sor_init(struct host1x_client *client)
 		}
 	}
 
+	/*
+	 * XXX: Remove this reset once proper hand-over from firmware to
+	 * kernel is possible.
+	 */
+	err = reset_control_assert(sor->rst);
+	if (err < 0) {
+		dev_err(sor->dev, "failed to assert SOR reset: %d\n", err);
+		return err;
+	}
+
 	err = clk_prepare_enable(sor->clk);
 	if (err < 0) {
 		dev_err(sor->dev, "failed to enable clock: %d\n", err);
 		return err;
 	}
 
+	msleep(2);
+
+	err = reset_control_deassert(sor->rst);
+	if (err < 0) {
+		dev_err(sor->dev, "failed to deassert SOR reset: %d\n", err);
+		return err;
+	}
+
 	err = clk_prepare_enable(sor->clk_safe);
 	if (err < 0)
 		return err;