All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] drm: mxsfb_crtc: Reset the eLCDIF controller
@ 2017-05-05 18:01 ` Fabio Estevam
  0 siblings, 0 replies; 17+ messages in thread
From: Fabio Estevam @ 2017-05-05 18:01 UTC (permalink / raw)
  To: marex; +Cc: festevam, stefan, kernel, dri-devel, Fabio Estevam, stable

According to the eLCDIF initialization steps listed in the MX6SX
Reference Manual the eLCDIF block reset is mandatory. 

Without performing the eLCDIF reset the display shows garbage content
when the kernel boots.

In earlier tests this issue has not been observed because the bootloader
was previously showing a splash screen and the bootloader display driver
does properly implement the eLCDIF reset.

Add the eLCDIF reset to the driver, so that it can operate correctly
independently of the bootloader.

Tested on a imx6sx-sdb board.

Cc: <stable@vger.kernel.org>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
Changes since v2:

- Remove unneeded udelay(1) - Marek

 drivers/gpu/drm/mxsfb/mxsfb_crtc.c | 42 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/drivers/gpu/drm/mxsfb/mxsfb_crtc.c b/drivers/gpu/drm/mxsfb/mxsfb_crtc.c
index 1144e0c..0abe776 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_crtc.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_crtc.c
@@ -35,6 +35,13 @@
 #include "mxsfb_drv.h"
 #include "mxsfb_regs.h"
 
+#define MXS_SET_ADDR		0x4
+#define MXS_CLR_ADDR		0x8
+#define MODULE_CLKGATE		BIT(30)
+#define MODULE_SFTRST		BIT(31)
+/* 1 second delay should be plenty of time for block reset */
+#define RESET_TIMEOUT		1000000
+
 static u32 set_hsync_pulse_width(struct mxsfb_drm_private *mxsfb, u32 val)
 {
 	return (val & mxsfb->devdata->hs_wdth_mask) <<
@@ -159,6 +166,36 @@ static void mxsfb_disable_controller(struct mxsfb_drm_private *mxsfb)
 		clk_disable_unprepare(mxsfb->clk_disp_axi);
 }
 
+/*
+ * Clear the bit and poll it cleared.  This is usually called with
+ * a reset address and mask being either SFTRST(bit 31) or CLKGATE
+ * (bit 30).
+ */
+static int clear_poll_bit(void __iomem *addr, u32 mask)
+{
+	u32 reg;
+
+	writel(mask, addr + MXS_CLR_ADDR);
+	return readl_poll_timeout(addr, reg, !(reg & mask), 0, RESET_TIMEOUT);
+}
+
+static int mxsfb_reset_block(void __iomem *reset_addr)
+{
+	int ret;
+
+	ret = clear_poll_bit(reset_addr, MODULE_SFTRST);
+	if (ret)
+		return ret;
+
+	writel(MODULE_CLKGATE, reset_addr + MXS_CLR_ADDR);
+
+	ret = clear_poll_bit(reset_addr, MODULE_SFTRST);
+	if (ret)
+		return ret;
+
+	return clear_poll_bit(reset_addr, MODULE_CLKGATE);
+}
+
 static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb)
 {
 	struct drm_display_mode *m = &mxsfb->pipe.crtc.state->adjusted_mode;
@@ -173,6 +210,11 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb)
 	 */
 	mxsfb_enable_axi_clk(mxsfb);
 
+	/* Mandatory eLCDIF reset as per the Reference Manual */
+	err = mxsfb_reset_block(mxsfb->base);
+	if (err)
+		return;
+
 	/* Clear the FIFOs */
 	writel(CTRL1_FIFO_CLEAR, mxsfb->base + LCDC_CTRL1 + REG_SET);
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v3] drm: mxsfb_crtc: Reset the eLCDIF controller
@ 2017-05-05 18:01 ` Fabio Estevam
  0 siblings, 0 replies; 17+ messages in thread
From: Fabio Estevam @ 2017-05-05 18:01 UTC (permalink / raw)
  To: marex; +Cc: festevam, stefan, kernel, dri-devel, Fabio Estevam, stable

According to the eLCDIF initialization steps listed in the MX6SX
Reference Manual the eLCDIF block reset is mandatory. 

Without performing the eLCDIF reset the display shows garbage content
when the kernel boots.

In earlier tests this issue has not been observed because the bootloader
was previously showing a splash screen and the bootloader display driver
does properly implement the eLCDIF reset.

Add the eLCDIF reset to the driver, so that it can operate correctly
independently of the bootloader.

Tested on a imx6sx-sdb board.

Cc: <stable@vger.kernel.org>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
Changes since v2:

- Remove unneeded udelay(1) - Marek

 drivers/gpu/drm/mxsfb/mxsfb_crtc.c | 42 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/drivers/gpu/drm/mxsfb/mxsfb_crtc.c b/drivers/gpu/drm/mxsfb/mxsfb_crtc.c
index 1144e0c..0abe776 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_crtc.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_crtc.c
@@ -35,6 +35,13 @@
 #include "mxsfb_drv.h"
 #include "mxsfb_regs.h"
 
+#define MXS_SET_ADDR		0x4
+#define MXS_CLR_ADDR		0x8
+#define MODULE_CLKGATE		BIT(30)
+#define MODULE_SFTRST		BIT(31)
+/* 1 second delay should be plenty of time for block reset */
+#define RESET_TIMEOUT		1000000
+
 static u32 set_hsync_pulse_width(struct mxsfb_drm_private *mxsfb, u32 val)
 {
 	return (val & mxsfb->devdata->hs_wdth_mask) <<
@@ -159,6 +166,36 @@ static void mxsfb_disable_controller(struct mxsfb_drm_private *mxsfb)
 		clk_disable_unprepare(mxsfb->clk_disp_axi);
 }
 
+/*
+ * Clear the bit and poll it cleared.  This is usually called with
+ * a reset address and mask being either SFTRST(bit 31) or CLKGATE
+ * (bit 30).
+ */
+static int clear_poll_bit(void __iomem *addr, u32 mask)
+{
+	u32 reg;
+
+	writel(mask, addr + MXS_CLR_ADDR);
+	return readl_poll_timeout(addr, reg, !(reg & mask), 0, RESET_TIMEOUT);
+}
+
+static int mxsfb_reset_block(void __iomem *reset_addr)
+{
+	int ret;
+
+	ret = clear_poll_bit(reset_addr, MODULE_SFTRST);
+	if (ret)
+		return ret;
+
+	writel(MODULE_CLKGATE, reset_addr + MXS_CLR_ADDR);
+
+	ret = clear_poll_bit(reset_addr, MODULE_SFTRST);
+	if (ret)
+		return ret;
+
+	return clear_poll_bit(reset_addr, MODULE_CLKGATE);
+}
+
 static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb)
 {
 	struct drm_display_mode *m = &mxsfb->pipe.crtc.state->adjusted_mode;
@@ -173,6 +210,11 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb)
 	 */
 	mxsfb_enable_axi_clk(mxsfb);
 
+	/* Mandatory eLCDIF reset as per the Reference Manual */
+	err = mxsfb_reset_block(mxsfb->base);
+	if (err)
+		return;
+
 	/* Clear the FIFOs */
 	writel(CTRL1_FIFO_CLEAR, mxsfb->base + LCDC_CTRL1 + REG_SET);
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH v3] drm: mxsfb_crtc: Reset the eLCDIF controller
  2017-05-05 18:01 ` Fabio Estevam
  (?)
@ 2017-05-22 13:55 ` Fabio Estevam
  2017-05-22 14:20   ` Marek Vasut
  -1 siblings, 1 reply; 17+ messages in thread
From: Fabio Estevam @ 2017-05-22 13:55 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Marek Vasut, Stefan Agner, Sascha Hauer, DRI mailing list, stable

Hi Marek,

On Fri, May 5, 2017 at 3:01 PM, Fabio Estevam <fabio.estevam@nxp.com> wrote:
> According to the eLCDIF initialization steps listed in the MX6SX
> Reference Manual the eLCDIF block reset is mandatory.
>
> Without performing the eLCDIF reset the display shows garbage content
> when the kernel boots.
>
> In earlier tests this issue has not been observed because the bootloader
> was previously showing a splash screen and the bootloader display driver
> does properly implement the eLCDIF reset.
>
> Add the eLCDIF reset to the driver, so that it can operate correctly
> independently of the bootloader.
>
> Tested on a imx6sx-sdb board.
>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
> ---
> Changes since v2:
>
> - Remove unneeded udelay(1) - Marek

Any comments about v3?

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3] drm: mxsfb_crtc: Reset the eLCDIF controller
  2017-05-22 13:55 ` Fabio Estevam
@ 2017-05-22 14:20   ` Marek Vasut
  2017-05-22 18:52     ` Fabio Estevam
  0 siblings, 1 reply; 17+ messages in thread
From: Marek Vasut @ 2017-05-22 14:20 UTC (permalink / raw)
  To: Fabio Estevam, Fabio Estevam
  Cc: Stefan Agner, Sascha Hauer, DRI mailing list, stable

On 05/22/2017 03:55 PM, Fabio Estevam wrote:
> Hi Marek,
> 
> On Fri, May 5, 2017 at 3:01 PM, Fabio Estevam <fabio.estevam@nxp.com> wrote:
>> According to the eLCDIF initialization steps listed in the MX6SX
>> Reference Manual the eLCDIF block reset is mandatory.
>>
>> Without performing the eLCDIF reset the display shows garbage content
>> when the kernel boots.
>>
>> In earlier tests this issue has not been observed because the bootloader
>> was previously showing a splash screen and the bootloader display driver
>> does properly implement the eLCDIF reset.
>>
>> Add the eLCDIF reset to the driver, so that it can operate correctly
>> independently of the bootloader.
>>
>> Tested on a imx6sx-sdb board.
>>
>> Cc: <stable@vger.kernel.org>
>> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
>> ---
>> Changes since v2:
>>
>> - Remove unneeded udelay(1) - Marek
> 
> Any comments about v3?
> 
IMO it's OK.

Reviewed-by: Marek Vasut <marex@denx.de>

-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3] drm: mxsfb_crtc: Reset the eLCDIF controller
  2017-05-22 14:20   ` Marek Vasut
@ 2017-05-22 18:52     ` Fabio Estevam
  2017-05-22 20:33       ` Marek Vasut
  0 siblings, 1 reply; 17+ messages in thread
From: Fabio Estevam @ 2017-05-22 18:52 UTC (permalink / raw)
  To: Marek Vasut
  Cc: Fabio Estevam, Stefan Agner, Sascha Hauer, DRI mailing list, stable

Hi Marek,

On Mon, May 22, 2017 at 11:20 AM, Marek Vasut <marex@denx.de> wrote:

> IMO it's OK.
>
> Reviewed-by: Marek Vasut <marex@denx.de>

Thanks for the feedback.

Do you plan to send Dave a pull request so that this one can reach 4.12-rc?

Thanks

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3] drm: mxsfb_crtc: Reset the eLCDIF controller
  2017-05-22 18:52     ` Fabio Estevam
@ 2017-05-22 20:33       ` Marek Vasut
  2017-06-05 12:03         ` Fabio Estevam
  0 siblings, 1 reply; 17+ messages in thread
From: Marek Vasut @ 2017-05-22 20:33 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Fabio Estevam, Stefan Agner, Sascha Hauer, DRI mailing list, stable

On 05/22/2017 08:52 PM, Fabio Estevam wrote:
> Hi Marek,

Hi!

> On Mon, May 22, 2017 at 11:20 AM, Marek Vasut <marex@denx.de> wrote:
> 
>> IMO it's OK.
>>
>> Reviewed-by: Marek Vasut <marex@denx.de>
> 
> Thanks for the feedback.
> 
> Do you plan to send Dave a pull request so that this one can reach 4.12-rc?

You could probably get it in via drm-misc ?

-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3] drm: mxsfb_crtc: Reset the eLCDIF controller
  2017-05-22 20:33       ` Marek Vasut
@ 2017-06-05 12:03         ` Fabio Estevam
  2017-06-05 12:08           ` Marek Vasut
  0 siblings, 1 reply; 17+ messages in thread
From: Fabio Estevam @ 2017-06-05 12:03 UTC (permalink / raw)
  To: Marek Vasut
  Cc: Fabio Estevam, Stefan Agner, Sascha Hauer, DRI mailing list, stable

Hi Marek,

On Mon, May 22, 2017 at 5:33 PM, Marek Vasut <marex@denx.de> wrote:

>> Do you plan to send Dave a pull request so that this one can reach 4.12-rc?
>
> You could probably get it in via drm-misc ?

I tried it, but no response so far.

Care to send Dave a pull request so that this one can get into 4.12-rc?

Thanks

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3] drm: mxsfb_crtc: Reset the eLCDIF controller
  2017-06-05 12:03         ` Fabio Estevam
@ 2017-06-05 12:08           ` Marek Vasut
  2017-06-15 15:12               ` Fabio Estevam
  0 siblings, 1 reply; 17+ messages in thread
From: Marek Vasut @ 2017-06-05 12:08 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Fabio Estevam, Stefan Agner, Sascha Hauer, DRI mailing list, stable

On 06/05/2017 02:03 PM, Fabio Estevam wrote:
> Hi Marek,

Hi,

> On Mon, May 22, 2017 at 5:33 PM, Marek Vasut <marex@denx.de> wrote:
> 
>>> Do you plan to send Dave a pull request so that this one can reach 4.12-rc?
>>
>> You could probably get it in via drm-misc ?
> 
> I tried it, but no response so far.
> 
> Care to send Dave a pull request so that this one can get into 4.12-rc?

I'm currently on vacation, try one more time and if it doesn't work out
(which means this trivial list is not really working?), I'll send a PR
sometime mid-month.

-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3] drm: mxsfb_crtc: Reset the eLCDIF controller
  2017-06-05 12:08           ` Marek Vasut
@ 2017-06-15 15:12               ` Fabio Estevam
  0 siblings, 0 replies; 17+ messages in thread
From: Fabio Estevam @ 2017-06-15 15:12 UTC (permalink / raw)
  To: Marek Vasut
  Cc: Fabio Estevam, Stefan Agner, Sascha Hauer, DRI mailing list, stable

Hi Marek,

On Mon, Jun 5, 2017 at 9:08 AM, Marek Vasut <marex@denx.de> wrote:

> I'm currently on vacation, try one more time and if it doesn't work out
> (which means this trivial list is not really working?), I'll send a PR
> sometime mid-month.

Tried your suggestion, but it did not work.

Could you please consider sending Dave Airlie a pull request with this patch?

Thanks

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3] drm: mxsfb_crtc: Reset the eLCDIF controller
@ 2017-06-15 15:12               ` Fabio Estevam
  0 siblings, 0 replies; 17+ messages in thread
From: Fabio Estevam @ 2017-06-15 15:12 UTC (permalink / raw)
  To: Marek Vasut; +Cc: Fabio Estevam, stable, DRI mailing list, Sascha Hauer

Hi Marek,

On Mon, Jun 5, 2017 at 9:08 AM, Marek Vasut <marex@denx.de> wrote:

> I'm currently on vacation, try one more time and if it doesn't work out
> (which means this trivial list is not really working?), I'll send a PR
> sometime mid-month.

Tried your suggestion, but it did not work.

Could you please consider sending Dave Airlie a pull request with this patch?

Thanks
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3] drm: mxsfb_crtc: Reset the eLCDIF controller
  2017-06-15 15:12               ` Fabio Estevam
  (?)
@ 2017-06-15 17:26               ` Marek Vasut
  2017-06-16  2:57                   ` Stefan Agner
  -1 siblings, 1 reply; 17+ messages in thread
From: Marek Vasut @ 2017-06-15 17:26 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Fabio Estevam, Stefan Agner, Sascha Hauer, DRI mailing list, stable

On 06/15/2017 05:12 PM, Fabio Estevam wrote:
> Hi Marek,
> 
> On Mon, Jun 5, 2017 at 9:08 AM, Marek Vasut <marex@denx.de> wrote:
> 
>> I'm currently on vacation, try one more time and if it doesn't work out
>> (which means this trivial list is not really working?), I'll send a PR
>> sometime mid-month.
> 
> Tried your suggestion, but it did not work.
> 
> Could you please consider sending Dave Airlie a pull request with this patch?

I poked the DRM people on IRC, so they should pick it up.

Stefan, can you test and add a T-B ?

-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3] drm: mxsfb_crtc: Reset the eLCDIF controller
  2017-05-05 18:01 ` Fabio Estevam
  (?)
  (?)
@ 2017-06-15 17:53 ` Sean Paul
  2017-06-15 20:02   ` Sean Paul
  -1 siblings, 1 reply; 17+ messages in thread
From: Sean Paul @ 2017-06-15 17:53 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: marex, stable, dri-devel, kernel

On Fri, May 05, 2017 at 03:01:41PM -0300, Fabio Estevam wrote:
> According to the eLCDIF initialization steps listed in the MX6SX
> Reference Manual the eLCDIF block reset is mandatory. 
> 
> Without performing the eLCDIF reset the display shows garbage content
> when the kernel boots.
> 
> In earlier tests this issue has not been observed because the bootloader
> was previously showing a splash screen and the bootloader display driver
> does properly implement the eLCDIF reset.
> 
> Add the eLCDIF reset to the driver, so that it can operate correctly
> independently of the bootloader.
> 
> Tested on a imx6sx-sdb board.
> 
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>

Per Marek's request, this has been applied to drm-misc-next

Thanks,

Sean

> ---
> Changes since v2:
> 
> - Remove unneeded udelay(1) - Marek
> 
>  drivers/gpu/drm/mxsfb/mxsfb_crtc.c | 42 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 42 insertions(+)
> 
> diff --git a/drivers/gpu/drm/mxsfb/mxsfb_crtc.c b/drivers/gpu/drm/mxsfb/mxsfb_crtc.c
> index 1144e0c..0abe776 100644
> --- a/drivers/gpu/drm/mxsfb/mxsfb_crtc.c
> +++ b/drivers/gpu/drm/mxsfb/mxsfb_crtc.c
> @@ -35,6 +35,13 @@
>  #include "mxsfb_drv.h"
>  #include "mxsfb_regs.h"
>  
> +#define MXS_SET_ADDR		0x4
> +#define MXS_CLR_ADDR		0x8
> +#define MODULE_CLKGATE		BIT(30)
> +#define MODULE_SFTRST		BIT(31)
> +/* 1 second delay should be plenty of time for block reset */
> +#define RESET_TIMEOUT		1000000
> +
>  static u32 set_hsync_pulse_width(struct mxsfb_drm_private *mxsfb, u32 val)
>  {
>  	return (val & mxsfb->devdata->hs_wdth_mask) <<
> @@ -159,6 +166,36 @@ static void mxsfb_disable_controller(struct mxsfb_drm_private *mxsfb)
>  		clk_disable_unprepare(mxsfb->clk_disp_axi);
>  }
>  
> +/*
> + * Clear the bit and poll it cleared.  This is usually called with
> + * a reset address and mask being either SFTRST(bit 31) or CLKGATE
> + * (bit 30).
> + */
> +static int clear_poll_bit(void __iomem *addr, u32 mask)
> +{
> +	u32 reg;
> +
> +	writel(mask, addr + MXS_CLR_ADDR);
> +	return readl_poll_timeout(addr, reg, !(reg & mask), 0, RESET_TIMEOUT);
> +}
> +
> +static int mxsfb_reset_block(void __iomem *reset_addr)
> +{
> +	int ret;
> +
> +	ret = clear_poll_bit(reset_addr, MODULE_SFTRST);
> +	if (ret)
> +		return ret;
> +
> +	writel(MODULE_CLKGATE, reset_addr + MXS_CLR_ADDR);
> +
> +	ret = clear_poll_bit(reset_addr, MODULE_SFTRST);
> +	if (ret)
> +		return ret;
> +
> +	return clear_poll_bit(reset_addr, MODULE_CLKGATE);
> +}
> +
>  static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb)
>  {
>  	struct drm_display_mode *m = &mxsfb->pipe.crtc.state->adjusted_mode;
> @@ -173,6 +210,11 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb)
>  	 */
>  	mxsfb_enable_axi_clk(mxsfb);
>  
> +	/* Mandatory eLCDIF reset as per the Reference Manual */
> +	err = mxsfb_reset_block(mxsfb->base);
> +	if (err)
> +		return;
> +
>  	/* Clear the FIFOs */
>  	writel(CTRL1_FIFO_CLEAR, mxsfb->base + LCDC_CTRL1 + REG_SET);
>  
> -- 
> 2.7.4
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Sean Paul, Software Engineer, Google / Chromium OS

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3] drm: mxsfb_crtc: Reset the eLCDIF controller
  2017-06-15 17:53 ` Sean Paul
@ 2017-06-15 20:02   ` Sean Paul
  2017-06-16  6:10     ` Marek Vasut
  0 siblings, 1 reply; 17+ messages in thread
From: Sean Paul @ 2017-06-15 20:02 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: marex, stable, dri-devel, kernel

On Thu, Jun 15, 2017 at 01:53:15PM -0400, Sean Paul wrote:
> On Fri, May 05, 2017 at 03:01:41PM -0300, Fabio Estevam wrote:
> > According to the eLCDIF initialization steps listed in the MX6SX
> > Reference Manual the eLCDIF block reset is mandatory. 
> > 
> > Without performing the eLCDIF reset the display shows garbage content
> > when the kernel boots.
> > 
> > In earlier tests this issue has not been observed because the bootloader
> > was previously showing a splash screen and the bootloader display driver
> > does properly implement the eLCDIF reset.
> > 
> > Add the eLCDIF reset to the driver, so that it can operate correctly
> > independently of the bootloader.
> > 
> > Tested on a imx6sx-sdb board.
> > 
> > Cc: <stable@vger.kernel.org>
> > Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
> 
> Per Marek's request, this has been applied to drm-misc-next
> 

Now applied to misc-fixes per Jani's request :)

Sean

> Thanks,
> 
> Sean
> 
> > ---
> > Changes since v2:
> > 
> > - Remove unneeded udelay(1) - Marek
> > 
> >  drivers/gpu/drm/mxsfb/mxsfb_crtc.c | 42 ++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 42 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/mxsfb/mxsfb_crtc.c b/drivers/gpu/drm/mxsfb/mxsfb_crtc.c
> > index 1144e0c..0abe776 100644
> > --- a/drivers/gpu/drm/mxsfb/mxsfb_crtc.c
> > +++ b/drivers/gpu/drm/mxsfb/mxsfb_crtc.c
> > @@ -35,6 +35,13 @@
> >  #include "mxsfb_drv.h"
> >  #include "mxsfb_regs.h"
> >  
> > +#define MXS_SET_ADDR		0x4
> > +#define MXS_CLR_ADDR		0x8
> > +#define MODULE_CLKGATE		BIT(30)
> > +#define MODULE_SFTRST		BIT(31)
> > +/* 1 second delay should be plenty of time for block reset */
> > +#define RESET_TIMEOUT		1000000
> > +
> >  static u32 set_hsync_pulse_width(struct mxsfb_drm_private *mxsfb, u32 val)
> >  {
> >  	return (val & mxsfb->devdata->hs_wdth_mask) <<
> > @@ -159,6 +166,36 @@ static void mxsfb_disable_controller(struct mxsfb_drm_private *mxsfb)
> >  		clk_disable_unprepare(mxsfb->clk_disp_axi);
> >  }
> >  
> > +/*
> > + * Clear the bit and poll it cleared.  This is usually called with
> > + * a reset address and mask being either SFTRST(bit 31) or CLKGATE
> > + * (bit 30).
> > + */
> > +static int clear_poll_bit(void __iomem *addr, u32 mask)
> > +{
> > +	u32 reg;
> > +
> > +	writel(mask, addr + MXS_CLR_ADDR);
> > +	return readl_poll_timeout(addr, reg, !(reg & mask), 0, RESET_TIMEOUT);
> > +}
> > +
> > +static int mxsfb_reset_block(void __iomem *reset_addr)
> > +{
> > +	int ret;
> > +
> > +	ret = clear_poll_bit(reset_addr, MODULE_SFTRST);
> > +	if (ret)
> > +		return ret;
> > +
> > +	writel(MODULE_CLKGATE, reset_addr + MXS_CLR_ADDR);
> > +
> > +	ret = clear_poll_bit(reset_addr, MODULE_SFTRST);
> > +	if (ret)
> > +		return ret;
> > +
> > +	return clear_poll_bit(reset_addr, MODULE_CLKGATE);
> > +}
> > +
> >  static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb)
> >  {
> >  	struct drm_display_mode *m = &mxsfb->pipe.crtc.state->adjusted_mode;
> > @@ -173,6 +210,11 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb)
> >  	 */
> >  	mxsfb_enable_axi_clk(mxsfb);
> >  
> > +	/* Mandatory eLCDIF reset as per the Reference Manual */
> > +	err = mxsfb_reset_block(mxsfb->base);
> > +	if (err)
> > +		return;
> > +
> >  	/* Clear the FIFOs */
> >  	writel(CTRL1_FIFO_CLEAR, mxsfb->base + LCDC_CTRL1 + REG_SET);
> >  
> > -- 
> > 2.7.4
> > 
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
> -- 
> Sean Paul, Software Engineer, Google / Chromium OS

-- 
Sean Paul, Software Engineer, Google / Chromium OS

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3] drm: mxsfb_crtc: Reset the eLCDIF controller
  2017-06-15 17:26               ` Marek Vasut
@ 2017-06-16  2:57                   ` Stefan Agner
  0 siblings, 0 replies; 17+ messages in thread
From: Stefan Agner @ 2017-06-16  2:57 UTC (permalink / raw)
  To: Marek Vasut, Sanchayan Maity
  Cc: Fabio Estevam, Fabio Estevam, Sascha Hauer, DRI mailing list, stable

On 2017-06-15 10:26, Marek Vasut wrote:
> On 06/15/2017 05:12 PM, Fabio Estevam wrote:
>> Hi Marek,
>>
>> On Mon, Jun 5, 2017 at 9:08 AM, Marek Vasut <marex@denx.de> wrote:
>>
>>> I'm currently on vacation, try one more time and if it doesn't work out
>>> (which means this trivial list is not really working?), I'll send a PR
>>> sometime mid-month.
>>
>> Tried your suggestion, but it did not work.
>>
>> Could you please consider sending Dave Airlie a pull request with this patch?
> 
> I poked the DRM people on IRC, so they should pick it up.
> 
> Stefan, can you test and add a T-B ?

Sorry, I am on vacation too, no access to actual hardware.

@Sanchayan, can you maybe check this patch on mainline?

--
Stefan

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3] drm: mxsfb_crtc: Reset the eLCDIF controller
@ 2017-06-16  2:57                   ` Stefan Agner
  0 siblings, 0 replies; 17+ messages in thread
From: Stefan Agner @ 2017-06-16  2:57 UTC (permalink / raw)
  To: Marek Vasut, Sanchayan Maity
  Cc: Fabio Estevam, Fabio Estevam, Sascha Hauer, DRI mailing list, stable

On 2017-06-15 10:26, Marek Vasut wrote:
> On 06/15/2017 05:12 PM, Fabio Estevam wrote:
>> Hi Marek,
>>
>> On Mon, Jun 5, 2017 at 9:08 AM, Marek Vasut <marex@denx.de> wrote:
>>
>>> I'm currently on vacation, try one more time and if it doesn't work out
>>> (which means this trivial list is not really working?), I'll send a PR
>>> sometime mid-month.
>>
>> Tried your suggestion, but it did not work.
>>
>> Could you please consider sending Dave Airlie a pull request with this patch?
> 
> I poked the DRM people on IRC, so they should pick it up.
> 
> Stefan, can you test and add a T-B ?

Sorry, I am on vacation too, no access to actual hardware.

@Sanchayan, can you maybe check this patch on mainline?

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3] drm: mxsfb_crtc: Reset the eLCDIF controller
  2017-06-15 20:02   ` Sean Paul
@ 2017-06-16  6:10     ` Marek Vasut
  0 siblings, 0 replies; 17+ messages in thread
From: Marek Vasut @ 2017-06-16  6:10 UTC (permalink / raw)
  To: Sean Paul, Fabio Estevam; +Cc: stable, dri-devel, kernel

On 06/15/2017 10:02 PM, Sean Paul wrote:
> On Thu, Jun 15, 2017 at 01:53:15PM -0400, Sean Paul wrote:
>> On Fri, May 05, 2017 at 03:01:41PM -0300, Fabio Estevam wrote:
>>> According to the eLCDIF initialization steps listed in the MX6SX
>>> Reference Manual the eLCDIF block reset is mandatory. 
>>>
>>> Without performing the eLCDIF reset the display shows garbage content
>>> when the kernel boots.
>>>
>>> In earlier tests this issue has not been observed because the bootloader
>>> was previously showing a splash screen and the bootloader display driver
>>> does properly implement the eLCDIF reset.
>>>
>>> Add the eLCDIF reset to the driver, so that it can operate correctly
>>> independently of the bootloader.
>>>
>>> Tested on a imx6sx-sdb board.
>>>
>>> Cc: <stable@vger.kernel.org>
>>> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
>>
>> Per Marek's request, this has been applied to drm-misc-next
>>
> 
> Now applied to misc-fixes per Jani's request :)
> 

Excellent, thanks!

-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3] drm: mxsfb_crtc: Reset the eLCDIF controller
  2017-06-16  2:57                   ` Stefan Agner
  (?)
@ 2017-06-16  8:29                   ` Sanchayan Maity
  -1 siblings, 0 replies; 17+ messages in thread
From: Sanchayan Maity @ 2017-06-16  8:29 UTC (permalink / raw)
  To: Marek Vasut
  Cc: Stefan Agner, Fabio Estevam, Fabio Estevam, Sascha Hauer,
	DRI mailing list, stable

Hello Marek,

On 17-06-15 19:57:35, Stefan Agner wrote:
> On 2017-06-15 10:26, Marek Vasut wrote:
> > On 06/15/2017 05:12 PM, Fabio Estevam wrote:
> >> Hi Marek,
> >>
> >> On Mon, Jun 5, 2017 at 9:08 AM, Marek Vasut <marex@denx.de> wrote:
> >>
> >>> I'm currently on vacation, try one more time and if it doesn't work out
> >>> (which means this trivial list is not really working?), I'll send a PR
> >>> sometime mid-month.
> >>
> >> Tried your suggestion, but it did not work.
> >>
> >> Could you please consider sending Dave Airlie a pull request with this patch?
> > 
> > I poked the DRM people on IRC, so they should pick it up.
> > 
> > Stefan, can you test and add a T-B ?
> 
> Sorry, I am on vacation too, no access to actual hardware.
> 
> @Sanchayan, can you maybe check this patch on mainline?
>

Tested on Toradex Apalis iMX6Q module with edt,et070080dh6: EDT 7.0" LCD TFT.
Did not see any issues using this patch applied on top of latest mainline.

Tested-By: Sanchayan Maity <maitysanchayan@gmail.com>

Regards,
Sanchayan.

> --
> Stefan

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2017-06-16  8:29 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-05 18:01 [PATCH v3] drm: mxsfb_crtc: Reset the eLCDIF controller Fabio Estevam
2017-05-05 18:01 ` Fabio Estevam
2017-05-22 13:55 ` Fabio Estevam
2017-05-22 14:20   ` Marek Vasut
2017-05-22 18:52     ` Fabio Estevam
2017-05-22 20:33       ` Marek Vasut
2017-06-05 12:03         ` Fabio Estevam
2017-06-05 12:08           ` Marek Vasut
2017-06-15 15:12             ` Fabio Estevam
2017-06-15 15:12               ` Fabio Estevam
2017-06-15 17:26               ` Marek Vasut
2017-06-16  2:57                 ` Stefan Agner
2017-06-16  2:57                   ` Stefan Agner
2017-06-16  8:29                   ` Sanchayan Maity
2017-06-15 17:53 ` Sean Paul
2017-06-15 20:02   ` Sean Paul
2017-06-16  6:10     ` Marek Vasut

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.