All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sylwester Nawrocki <s.nawrocki@samsung.com>
To: Andi Shyti <andi.shyti@samsung.com>
Cc: Andi Shyti <andi@etezian.org>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	Jaehoon Chung <jh80.chung@samsung.com>,
	Tomasz Figa <tomasz.figa@gmail.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Kukjin Kim <kgene@kernel.org>,
	Krzysztof Kozlowski <k.kozlowski@samsung.com>,
	linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Andrzej Hajda <a.hajda@samsung.com>
Subject: Re: [PATCH v3 1/2] clk: exynos5433: do not use CLK_IGNORE_UNUSED for SPI clocks
Date: Wed, 06 Jul 2016 12:40:58 +0200	[thread overview]
Message-ID: <577CE03A.3090603@samsung.com> (raw)
In-Reply-To: <20160706045108.GD23620@samsunx.samsung>

On 07/06/2016 06:51 AM, Andi Shyti wrote:
> 
> I don't see anything wrong on the above. We could make it as:

> @@ -640,13 +639,7 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd)
>  
>         writel(val, regs + S3C64XX_SPI_MODE_CFG);
>  
> -       if (sdd->port_conf->clk_from_cmu) {
> -               /* Configure Clock */
> -               /* There is half-multiplier before the SPI */
> -               clk_set_rate(sdd->src_clk, sdd->cur_speed * 2);
> -               /* Enable Clock */
> -               clk_prepare_enable(sdd->src_clk);

clk_set_rate() call needs to stay, we can only remove clk_prepare_enable().

> -       } else {
> +       if (!sdd->port_conf->clk_from_cmu) {
>                 /* Configure Clock */
>                 val = readl(regs + S3C64XX_SPI_CLK_CFG);
>                 val &= ~S3C64XX_SPI_PSR_MASK;
> 
>> I meant we could amend which clocks are specified at the SPI bus device
>> DT nodes and change handling of clocks in the spi-s3c64xx driver to model
>> everything properly and get it all working.
> 
> I think that if the clock comes from the cmu it's not necessary
> to disable it. I would like to avoid adding DTS properties
> because we have the clock disabling inherited from old code which
> it might not be required at all (in our tests, indeed it works).

OK, anyway we already need to amend exynos5433.dtsi file to change
the "spi_busclk0" clock specifier.

I agree we can get rid of the clock gating in s3c64xx_spi_config() 
function, it should not do any harm and will help in getting rid 
of the bus access exceptions.

In general PCLK should be enough for accessing register of the controller,
one hypothesis is that automatic clock gating may be disabling PCLK
when it sees SCLK inactive.

I tested on exynos4412 trats2 board a large firmware file upload over 
SPI and didn't notice any bad side effects with above 
clk_disable_unprepare()/clk_prepare_enable() calls commented out.

WARNING: multiple messages have this Message-ID (diff)
From: s.nawrocki@samsung.com (Sylwester Nawrocki)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 1/2] clk: exynos5433: do not use CLK_IGNORE_UNUSED for SPI clocks
Date: Wed, 06 Jul 2016 12:40:58 +0200	[thread overview]
Message-ID: <577CE03A.3090603@samsung.com> (raw)
In-Reply-To: <20160706045108.GD23620@samsunx.samsung>

On 07/06/2016 06:51 AM, Andi Shyti wrote:
> 
> I don't see anything wrong on the above. We could make it as:

> @@ -640,13 +639,7 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd)
>  
>         writel(val, regs + S3C64XX_SPI_MODE_CFG);
>  
> -       if (sdd->port_conf->clk_from_cmu) {
> -               /* Configure Clock */
> -               /* There is half-multiplier before the SPI */
> -               clk_set_rate(sdd->src_clk, sdd->cur_speed * 2);
> -               /* Enable Clock */
> -               clk_prepare_enable(sdd->src_clk);

clk_set_rate() call needs to stay, we can only remove clk_prepare_enable().

> -       } else {
> +       if (!sdd->port_conf->clk_from_cmu) {
>                 /* Configure Clock */
>                 val = readl(regs + S3C64XX_SPI_CLK_CFG);
>                 val &= ~S3C64XX_SPI_PSR_MASK;
> 
>> I meant we could amend which clocks are specified at the SPI bus device
>> DT nodes and change handling of clocks in the spi-s3c64xx driver to model
>> everything properly and get it all working.
> 
> I think that if the clock comes from the cmu it's not necessary
> to disable it. I would like to avoid adding DTS properties
> because we have the clock disabling inherited from old code which
> it might not be required at all (in our tests, indeed it works).

OK, anyway we already need to amend exynos5433.dtsi file to change
the "spi_busclk0" clock specifier.

I agree we can get rid of the clock gating in s3c64xx_spi_config() 
function, it should not do any harm and will help in getting rid 
of the bus access exceptions.

In general PCLK should be enough for accessing register of the controller,
one hypothesis is that automatic clock gating may be disabling PCLK
when it sees SCLK inactive.

I tested on exynos4412 trats2 board a large firmware file upload over 
SPI and didn't notice any bad side effects with above 
clk_disable_unprepare()/clk_prepare_enable() calls commented out.

  reply	other threads:[~2016-07-06 10:41 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-30  7:15 [PATCH v3 0/2] mark spi clocks as critical and enable spi3 clocks Andi Shyti
2016-06-30  7:15 ` Andi Shyti
2016-06-30  7:15 ` Andi Shyti
2016-06-30  7:15 ` [PATCH v3 1/2] clk: exynos5433: do not use CLK_IGNORE_UNUSED for SPI clocks Andi Shyti
2016-06-30  7:15   ` Andi Shyti
2016-07-04  9:40   ` Sylwester Nawrocki
2016-07-04  9:40     ` Sylwester Nawrocki
2016-07-04 10:26     ` Andi Shyti
2016-07-04 10:26       ` Andi Shyti
2016-07-04 15:15       ` Sylwester Nawrocki
2016-07-04 15:15         ` Sylwester Nawrocki
2016-07-06  4:51         ` Andi Shyti
2016-07-06  4:51           ` Andi Shyti
2016-07-06 10:40           ` Sylwester Nawrocki [this message]
2016-07-06 10:40             ` Sylwester Nawrocki
2016-06-30  7:15 ` [PATCH v3 2/2] clk: exynos5433: enable sclk_ioclk for SPI3 Andi Shyti
2016-06-30  7:15   ` Andi Shyti
2016-06-30  7:15   ` Andi Shyti
2016-07-04  3:59 ` [PATCH v3 0/2] mark spi clocks as critical and enable spi3 clocks Tomasz Figa
2016-07-04  3:59   ` Tomasz Figa
2016-07-04  3:59   ` Tomasz Figa
2016-07-04  4:20   ` Andi Shyti
2016-07-04  4:20     ` Andi Shyti
2016-07-04  4:20     ` Andi Shyti
2016-07-04  4:55     ` Tomasz Figa
2016-07-04  4:55       ` Tomasz Figa
2016-07-04  4:55       ` Tomasz Figa

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=577CE03A.3090603@samsung.com \
    --to=s.nawrocki@samsung.com \
    --cc=a.hajda@samsung.com \
    --cc=andi.shyti@samsung.com \
    --cc=andi@etezian.org \
    --cc=cw00.choi@samsung.com \
    --cc=jh80.chung@samsung.com \
    --cc=k.kozlowski@samsung.com \
    --cc=kgene@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@codeaurora.org \
    --cc=tomasz.figa@gmail.com \
    /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.