From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: Liu Ying <Ying.Liu@freescale.com>, linux-fbdev@vger.kernel.org
Cc: Peter Chen <peter.chen@freescale.com>,
Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
Fabio Estevam <fabio.estevam@freescale.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2] video: mxsfb: Make sure axi clock is enabled when accessing registers
Date: Tue, 10 Mar 2015 12:02:37 +0000 [thread overview]
Message-ID: <54FEDD5D.4000104@ti.com> (raw)
In-Reply-To: <1425452771-19313-1-git-send-email-Ying.Liu@freescale.com>
[-- Attachment #1: Type: text/plain, Size: 4555 bytes --]
On 04/03/15 09:06, Liu Ying wrote:
> The LCDIF engines embedded in i.MX6sl and i.MX6sx SoCs need the axi clock
> as the engine's system clock. The clock should be enabled when accessing
> LCDIF registers, otherwise the kernel would hang up. We should also keep
> the clock being enabled when the engine is being active to scan out frames
The text above is a bit confusing. Maybe just "... also keep the clock
enabled when..."
> from memory. This patch makes sure the axi clock is enabled when accessing
> registers so that the kernel hang up issue can be fixed.
>
> Reported-by: Peter Chen <peter.chen@freescale.com>
> Tested-by: Peter Chen <peter.chen@freescale.com>
> Cc: <stable@vger.kernel.org> # 3.19+
> Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
> ---
> v1->v2:
> * Add 'Tested-by: Peter Chen <peter.chen@freescale.com>' tag.
> * Add 'Cc: <stable@vger.kernel.org> # 3.19+' tag.
>
> drivers/video/fbdev/mxsfb.c | 70 ++++++++++++++++++++++++++++++++++++---------
> 1 file changed, 56 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/video/fbdev/mxsfb.c b/drivers/video/fbdev/mxsfb.c
> index f8ac4a4..a8cf3b2 100644
> --- a/drivers/video/fbdev/mxsfb.c
> +++ b/drivers/video/fbdev/mxsfb.c
> @@ -316,6 +316,18 @@ static int mxsfb_check_var(struct fb_var_screeninfo *var,
> return 0;
> }
>
> +static inline void mxsfb_enable_axi_clk(struct mxsfb_info *host)
> +{
> + if (host->clk_axi)
> + clk_prepare_enable(host->clk_axi);
> +}
> +
> +static inline void mxsfb_disable_axi_clk(struct mxsfb_info *host)
> +{
> + if (host->clk_axi)
> + clk_disable_unprepare(host->clk_axi);
> +}
> +
> static void mxsfb_enable_controller(struct fb_info *fb_info)
> {
> struct mxsfb_info *host = to_imxfb_host(fb_info);
> @@ -333,14 +345,13 @@ static void mxsfb_enable_controller(struct fb_info *fb_info)
> }
> }
>
> - if (host->clk_axi)
> - clk_prepare_enable(host->clk_axi);
> -
> if (host->clk_disp_axi)
> clk_prepare_enable(host->clk_disp_axi);
> clk_prepare_enable(host->clk);
> clk_set_rate(host->clk, PICOS2KHZ(fb_info->var.pixclock) * 1000U);
>
> + mxsfb_enable_axi_clk(host);
> +
Is there some reason to move the clk enable to a different place here?
> /* if it was disabled, re-enable the mode again */
> writel(CTRL_DOTCLK_MODE, host->base + LCDC_CTRL + REG_SET);
>
> @@ -380,11 +391,11 @@ static void mxsfb_disable_controller(struct fb_info *fb_info)
> reg = readl(host->base + LCDC_VDCTRL4);
> writel(reg & ~VDCTRL4_SYNC_SIGNALS_ON, host->base + LCDC_VDCTRL4);
>
> + mxsfb_disable_axi_clk(host);
> +
> clk_disable_unprepare(host->clk);
> if (host->clk_disp_axi)
> clk_disable_unprepare(host->clk_disp_axi);
> - if (host->clk_axi)
> - clk_disable_unprepare(host->clk_axi);
And same here for disable.
> host->enabled = 0;
>
> @@ -421,6 +432,8 @@ static int mxsfb_set_par(struct fb_info *fb_info)
> mxsfb_disable_controller(fb_info);
> }
>
> + mxsfb_enable_axi_clk(host);
> +
> /* clear the FIFOs */
> writel(CTRL1_FIFO_CLEAR, host->base + LCDC_CTRL1 + REG_SET);
>
> @@ -438,6 +451,7 @@ static int mxsfb_set_par(struct fb_info *fb_info)
> ctrl |= CTRL_SET_WORD_LENGTH(3);
> switch (host->ld_intf_width) {
> case STMLCDIF_8BIT:
> + mxsfb_disable_axi_clk(host);
> dev_err(&host->pdev->dev,
> "Unsupported LCD bus width mapping\n");
> return -EINVAL;
> @@ -451,6 +465,7 @@ static int mxsfb_set_par(struct fb_info *fb_info)
> writel(CTRL1_SET_BYTE_PACKAGING(0x7), host->base + LCDC_CTRL1);
> break;
> default:
> + mxsfb_disable_axi_clk(host);
> dev_err(&host->pdev->dev, "Unhandled color depth of %u\n",
> fb_info->var.bits_per_pixel);
> return -EINVAL;
> @@ -504,6 +519,8 @@ static int mxsfb_set_par(struct fb_info *fb_info)
> fb_info->fix.line_length * fb_info->var.yoffset,
> host->base + host->devdata->next_buf);
>
> + mxsfb_disable_axi_clk(host);
> +
> if (reenable)
> mxsfb_enable_controller(fb_info);
>
> @@ -582,10 +599,16 @@ static int mxsfb_pan_display(struct fb_var_screeninfo *var,
>
> offset = fb_info->fix.line_length * var->yoffset;
>
> + if (!host->enabled)
> + mxsfb_enable_axi_clk(host);
> +
> /* update on next VSYNC */
> writel(fb_info->fix.smem_start + offset,
> host->base + host->devdata->next_buf);
>
> + if (!host->enabled)
> + mxsfb_disable_axi_clk(host);
> +
Why do you check for host->enabled here, but not elsewhere?
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: Liu Ying <Ying.Liu@freescale.com>, <linux-fbdev@vger.kernel.org>
Cc: Peter Chen <peter.chen@freescale.com>,
Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
Fabio Estevam <fabio.estevam@freescale.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
<linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>
Subject: Re: [PATCH v2] video: mxsfb: Make sure axi clock is enabled when accessing registers
Date: Tue, 10 Mar 2015 14:02:37 +0200 [thread overview]
Message-ID: <54FEDD5D.4000104@ti.com> (raw)
In-Reply-To: <1425452771-19313-1-git-send-email-Ying.Liu@freescale.com>
[-- Attachment #1: Type: text/plain, Size: 4555 bytes --]
On 04/03/15 09:06, Liu Ying wrote:
> The LCDIF engines embedded in i.MX6sl and i.MX6sx SoCs need the axi clock
> as the engine's system clock. The clock should be enabled when accessing
> LCDIF registers, otherwise the kernel would hang up. We should also keep
> the clock being enabled when the engine is being active to scan out frames
The text above is a bit confusing. Maybe just "... also keep the clock
enabled when..."
> from memory. This patch makes sure the axi clock is enabled when accessing
> registers so that the kernel hang up issue can be fixed.
>
> Reported-by: Peter Chen <peter.chen@freescale.com>
> Tested-by: Peter Chen <peter.chen@freescale.com>
> Cc: <stable@vger.kernel.org> # 3.19+
> Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
> ---
> v1->v2:
> * Add 'Tested-by: Peter Chen <peter.chen@freescale.com>' tag.
> * Add 'Cc: <stable@vger.kernel.org> # 3.19+' tag.
>
> drivers/video/fbdev/mxsfb.c | 70 ++++++++++++++++++++++++++++++++++++---------
> 1 file changed, 56 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/video/fbdev/mxsfb.c b/drivers/video/fbdev/mxsfb.c
> index f8ac4a4..a8cf3b2 100644
> --- a/drivers/video/fbdev/mxsfb.c
> +++ b/drivers/video/fbdev/mxsfb.c
> @@ -316,6 +316,18 @@ static int mxsfb_check_var(struct fb_var_screeninfo *var,
> return 0;
> }
>
> +static inline void mxsfb_enable_axi_clk(struct mxsfb_info *host)
> +{
> + if (host->clk_axi)
> + clk_prepare_enable(host->clk_axi);
> +}
> +
> +static inline void mxsfb_disable_axi_clk(struct mxsfb_info *host)
> +{
> + if (host->clk_axi)
> + clk_disable_unprepare(host->clk_axi);
> +}
> +
> static void mxsfb_enable_controller(struct fb_info *fb_info)
> {
> struct mxsfb_info *host = to_imxfb_host(fb_info);
> @@ -333,14 +345,13 @@ static void mxsfb_enable_controller(struct fb_info *fb_info)
> }
> }
>
> - if (host->clk_axi)
> - clk_prepare_enable(host->clk_axi);
> -
> if (host->clk_disp_axi)
> clk_prepare_enable(host->clk_disp_axi);
> clk_prepare_enable(host->clk);
> clk_set_rate(host->clk, PICOS2KHZ(fb_info->var.pixclock) * 1000U);
>
> + mxsfb_enable_axi_clk(host);
> +
Is there some reason to move the clk enable to a different place here?
> /* if it was disabled, re-enable the mode again */
> writel(CTRL_DOTCLK_MODE, host->base + LCDC_CTRL + REG_SET);
>
> @@ -380,11 +391,11 @@ static void mxsfb_disable_controller(struct fb_info *fb_info)
> reg = readl(host->base + LCDC_VDCTRL4);
> writel(reg & ~VDCTRL4_SYNC_SIGNALS_ON, host->base + LCDC_VDCTRL4);
>
> + mxsfb_disable_axi_clk(host);
> +
> clk_disable_unprepare(host->clk);
> if (host->clk_disp_axi)
> clk_disable_unprepare(host->clk_disp_axi);
> - if (host->clk_axi)
> - clk_disable_unprepare(host->clk_axi);
And same here for disable.
> host->enabled = 0;
>
> @@ -421,6 +432,8 @@ static int mxsfb_set_par(struct fb_info *fb_info)
> mxsfb_disable_controller(fb_info);
> }
>
> + mxsfb_enable_axi_clk(host);
> +
> /* clear the FIFOs */
> writel(CTRL1_FIFO_CLEAR, host->base + LCDC_CTRL1 + REG_SET);
>
> @@ -438,6 +451,7 @@ static int mxsfb_set_par(struct fb_info *fb_info)
> ctrl |= CTRL_SET_WORD_LENGTH(3);
> switch (host->ld_intf_width) {
> case STMLCDIF_8BIT:
> + mxsfb_disable_axi_clk(host);
> dev_err(&host->pdev->dev,
> "Unsupported LCD bus width mapping\n");
> return -EINVAL;
> @@ -451,6 +465,7 @@ static int mxsfb_set_par(struct fb_info *fb_info)
> writel(CTRL1_SET_BYTE_PACKAGING(0x7), host->base + LCDC_CTRL1);
> break;
> default:
> + mxsfb_disable_axi_clk(host);
> dev_err(&host->pdev->dev, "Unhandled color depth of %u\n",
> fb_info->var.bits_per_pixel);
> return -EINVAL;
> @@ -504,6 +519,8 @@ static int mxsfb_set_par(struct fb_info *fb_info)
> fb_info->fix.line_length * fb_info->var.yoffset,
> host->base + host->devdata->next_buf);
>
> + mxsfb_disable_axi_clk(host);
> +
> if (reenable)
> mxsfb_enable_controller(fb_info);
>
> @@ -582,10 +599,16 @@ static int mxsfb_pan_display(struct fb_var_screeninfo *var,
>
> offset = fb_info->fix.line_length * var->yoffset;
>
> + if (!host->enabled)
> + mxsfb_enable_axi_clk(host);
> +
> /* update on next VSYNC */
> writel(fb_info->fix.smem_start + offset,
> host->base + host->devdata->next_buf);
>
> + if (!host->enabled)
> + mxsfb_disable_axi_clk(host);
> +
Why do you check for host->enabled here, but not elsewhere?
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-03-10 12:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-04 7:06 [PATCH v2] video: mxsfb: Make sure axi clock is enabled when accessing registers Liu Ying
2015-03-04 7:06 ` Liu Ying
2015-03-10 12:02 ` Tomi Valkeinen [this message]
2015-03-10 12:02 ` Tomi Valkeinen
2015-03-11 2:58 ` Liu Ying
2015-03-11 3:03 ` Liu Ying
2015-03-20 11:26 ` Tomi Valkeinen
2015-03-20 11:26 ` Tomi Valkeinen
2015-04-03 3:39 ` Liu Ying
2015-04-03 3:39 ` Liu Ying
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=54FEDD5D.4000104@ti.com \
--to=tomi.valkeinen@ti.com \
--cc=Ying.Liu@freescale.com \
--cc=fabio.estevam@freescale.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peter.chen@freescale.com \
--cc=plagnioj@jcrosoft.com \
--cc=stable@vger.kernel.org \
/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.