All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Rhyland Klein <rklein-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	Peter De Schrijver
	<pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	Mike Turquette
	<mturquette-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>,
	Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
	Stephen Boyd <sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	Alexandre Courbot
	<gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	linux-clk-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Andrew Bresticker
	<abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Subject: Re: [PATCH v5] clk: tegra: Initialize UTMIPLL when enabling PLLU
Date: Thu, 30 Jun 2016 17:43:02 +0200	[thread overview]
Message-ID: <20160630154302.GB4279@ulmo.ba.sec> (raw)
In-Reply-To: <fdd38adb-1a17-51fd-db62-be91102fdbd3-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 8263 bytes --]

On Thu, Jun 30, 2016 at 11:40:19AM -0400, Rhyland Klein wrote:
> On 6/30/2016 11:37 AM, Thierry Reding wrote:
> > * PGP Signed by an unknown key
> > 
> > On Thu, Jun 30, 2016 at 11:32:14AM -0400, Rhyland Klein wrote:
> >> On 6/17/2016 11:23 AM, Thierry Reding wrote:
> >>>> Old Signed by an unknown key
> >>>
> >>> On Fri, Jun 17, 2016 at 02:49:41PM +0100, Jon Hunter wrote:
> >>>> Hi Thierry,
> >>>>
> >>>> On 26/05/16 17:41, Rhyland Klein wrote:
> >>>>> From: Andrew Bresticker <abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> >>>>>
> >>>>> Move the UTMIPLL initialization code form clk-tegra<chip>.c files into
> >>>>> clk-pll.c. UTMIPLL was being configured and set in HW control right
> >>>>> after registration. However, when the clock init_table is processed and
> >>>>> child clks of PLLU are enabled, it will call in and enable PLLU as
> >>>>> well, and initiate SW enabling sequence even though PLLU is already in
> >>>>> HW control. This leads to getting UTMIPLL stuck with a SEQ_BUSY status.
> >>>>>
> >>>>> Doing the initialization once during pllu_enable means we configure it
> >>>>> properly into HW control.
> >>>>>
> >>>>> A side effect of the commonization/localization of the UTMIPLL init
> >>>>> code, is that it corrects some errors that were present for earlier
> >>>>> generations. For instance, in clk-tegra124.c, it used to have:
> >>>>>
> >>>>> define UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(x) (((x) & 0x1f) << 6)
> >>>>>
> >>>>> when the correct shift to use is present in the new version:
> >>>>>
> >>>>> define UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(x) (((x) & 0x1f) << 27)
> >>>>>
> >>>>> which matches the Tegra124 TRM register definition.
> >>>>>
> >>>>> Signed-off-by: Andrew Bresticker <abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> >>>>>
> >>>>> [rklein: Merged in some later fixes for potential deadlocks]
> >>>>>
> >>>>> Signed-off-by: Rhyland Klein <rklein-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> >>>>> ---
> >>>>> v5:
> >>>>>  - Initialized flags to 0 to avoid harmless spinlock warnings
> >>>>>
> >>>>> v4:
> >>>>>  - Re-added examples in patch description
> >>>>>
> >>>>> v3:
> >>>>>  - Flushed out description to describe this patch.
> >>>>>
> >>>>>  drivers/clk/tegra/clk-pll.c      | 484 +++++++++++++++++++++++++++++++++++++++
> >>>>>  drivers/clk/tegra/clk-tegra114.c | 155 +------------
> >>>>>  drivers/clk/tegra/clk-tegra124.c | 156 +------------
> >>>>>  drivers/clk/tegra/clk-tegra210.c | 182 +--------------
> >>>>>  drivers/clk/tegra/clk-tegra30.c  | 113 +--------
> >>>>>  drivers/clk/tegra/clk.h          |  17 ++
> >>>>>  6 files changed, 510 insertions(+), 597 deletions(-)
> >>>>>
> >>>>> diff --git a/drivers/clk/tegra/clk-pll.c b/drivers/clk/tegra/clk-pll.c
> >>>>> index 4e194ecc8d5e..31e20110fae4 100644
> >>>>> --- a/drivers/clk/tegra/clk-pll.c
> >>>>> +++ b/drivers/clk/tegra/clk-pll.c
> >>>>
> >>>> ...
> >>>>
> >>>>> +static int clk_pllu_tegra210_enable(struct clk_hw *hw)
> >>>>> +{
> >>>>> +	struct tegra_clk_pll *pll = to_clk_pll(hw);
> >>>>> +	struct clk_hw *pll_ref = clk_hw_get_parent(hw);
> >>>>> +	struct clk_hw *osc = clk_hw_get_parent(pll_ref);
> >>>>> +	unsigned long flags = 0, input_rate;
> >>>>> +	unsigned int i;
> >>>>> +	int ret = 0;
> >>>>> +	u32 val;
> >>>>> +
> >>>>> +	if (!osc) {
> >>>>> +		pr_err("%s: failed to get OSC clock\n", __func__);
> >>>>> +		return -EINVAL;
> >>>>> +	}
> >>>>> +	input_rate = clk_hw_get_rate(osc);
> >>>>> +
> >>>>> +	if (pll->lock)
> >>>>> +		spin_lock_irqsave(pll->lock, flags);
> >>>>> +
> >>>>> +	_clk_pll_enable(hw);
> >>>>> +	ret = clk_pll_wait_for_lock(pll);
> >>>>> +	if (ret < 0)
> >>>>> +		goto out;
> >>>>> +
> >>>>> +	for (i = 0; i < ARRAY_SIZE(utmi_parameters); i++) {
> >>>>> +		if (input_rate == utmi_parameters[i].osc_frequency)
> >>>>> +			break;
> >>>>> +	}
> >>>>> +
> >>>>> +	if (i == ARRAY_SIZE(utmi_parameters)) {
> >>>>> +		pr_err("%s: Unexpected input rate %lu\n", __func__, input_rate);
> >>>>> +		ret = -EINVAL;
> >>>>> +		goto out;
> >>>>> +	}
> >>>>> +
> >>>>> +	val = pll_readl_base(pll);
> >>>>> +	val &= ~PLLU_BASE_OVERRIDE;
> >>>>> +	pll_writel_base(val, pll);
> >>>>> +
> >>>>> +	/* Put PLLU under HW control */
> >>>>> +	val = readl_relaxed(pll->clk_base + PLLU_HW_PWRDN_CFG0);
> >>>>> +	val |= PLLU_HW_PWRDN_CFG0_IDDQ_PD_INCLUDE |
> >>>>> +	       PLLU_HW_PWRDN_CFG0_USE_SWITCH_DETECT |
> >>>>> +	       PLLU_HW_PWRDN_CFG0_USE_LOCKDET;
> >>>>> +	val &= ~(PLLU_HW_PWRDN_CFG0_CLK_ENABLE_SWCTL |
> >>>>> +		  PLLU_HW_PWRDN_CFG0_CLK_SWITCH_SWCTL);
> >>>>> +	writel_relaxed(val, pll->clk_base + PLLU_HW_PWRDN_CFG0);
> >>>>> +
> >>>>> +	val = readl_relaxed(pll->clk_base + XUSB_PLL_CFG0);
> >>>>> +	val &= ~XUSB_PLL_CFG0_PLLU_LOCK_DLY;
> >>>>> +	writel_relaxed(val, pll->clk_base + XUSB_PLL_CFG0);
> >>>>> +	udelay(1);
> >>>>> +
> >>>>> +	val = readl_relaxed(pll->clk_base + PLLU_HW_PWRDN_CFG0);
> >>>>> +	val |= PLLU_HW_PWRDN_CFG0_SEQ_ENABLE;
> >>>>> +	writel_relaxed(val, pll->clk_base + PLLU_HW_PWRDN_CFG0);
> >>>>> +	udelay(1);
> >>>>> +
> >>>>> +	/* Disable PLLU clock branch to UTMIPLL since it uses OSC */
> >>>>> +	val = pll_readl_base(pll);
> >>>>> +	val &= ~PLLU_BASE_CLKENABLE_USB;
> >>>>> +	pll_writel_base(val, pll);
> >>>>> +
> >>>>> +	val = readl_relaxed(pll->clk_base + UTMIPLL_HW_PWRDN_CFG0);
> >>>>> +	if (val & UTMIPLL_HW_PWRDN_CFG0_SEQ_ENABLE) {
> >>>>> +		pr_debug("UTMIPLL already enabled\n");
> >>>>> +		goto out;
> >>>>> +	}
> >>>>> +	val &= ~UTMIPLL_HW_PWRDN_CFG0_IDDQ_OVERRIDE;
> >>>>> +	writel_relaxed(val, pll->clk_base + UTMIPLL_HW_PWRDN_CFG0);
> >>>>> +
> >>>>> +	/* Program UTMIP PLL stable and active counts */
> >>>>> +	val = readl_relaxed(pll->clk_base + UTMIP_PLL_CFG2);
> >>>>> +	val &= ~UTMIP_PLL_CFG2_STABLE_COUNT(~0);
> >>>>> +	val |= UTMIP_PLL_CFG2_STABLE_COUNT(utmi_parameters[i].stable_count);
> >>>>> +	val &= ~UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(~0);
> >>>>> +	val |= UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(
> >>>>> +			utmi_parameters[i].active_delay_count);
> >>>>> +	val |= UTMIP_PLL_CFG2_PHY_XTAL_CLOCKEN;
> >>>>> +	writel_relaxed(val, pll->clk_base + UTMIP_PLL_CFG2);
> >>>>> +
> >>>>> +	/* Program UTMIP PLL delay and oscillator frequency counts */
> >>>>> +	val = readl_relaxed(pll->clk_base + UTMIP_PLL_CFG1);
> >>>>> +	val &= ~UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(~0);
> >>>>> +	val |= UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(
> >>>>> +		utmi_parameters[i].enable_delay_count);
> >>>>> +	val &= ~UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(~0);
> >>>>> +	val |= UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(
> >>>>> +		utmi_parameters[i].xtal_freq_count);
> >>>>> +	writel_relaxed(val, pll->clk_base + UTMIP_PLL_CFG1);
> >>>>> +
> >>>>> +	/* Remove power downs from UTMIP PLL control bits */
> >>>>> +	val = readl_relaxed(pll->clk_base + UTMIP_PLL_CFG1);
> >>>>> +	val &= ~UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN;
> >>>>> +	val |= UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERUP;
> >>>>> +	writel_relaxed(val, pll->clk_base + UTMIP_PLL_CFG1);
> >>>>> +	udelay(100);
> >>>>
> >>>> In next-20160617 I see that this udelay is now a usleep_range(100, 200)
> >>>> and this is causing the following splat when the clock is enabled. I
> >>>> don't think that we can use usleep here ...
> >>>
> >>> Okay, I'll back out the patch. I'd really prefer to avoid busy-looping
> >>> for 100 microseconds here, so can we please find another way to do this?
> >>>
> >>
> >> It looks like we should be able to use a short udelay of 1-2us. I
> >> believe the original code had udelay(1) and I know Jon and I tested
> >> udelay(2) and it was ok.
> > 
> > What original code? The downstream driver? If so I'd be leaning towards
> > simply adopting that. Everything else in this functions seems to want to
> > wait for 1 us, seems natural for this to do as well.
> 
> Sorry I wasn't clear. The code in the clk-tegraXX specific drivers was
> using udelay(1) as you pointed out, thats what I meant.

On further looking at the downstream code, the write before the udelay()
above should probably also use the non-relaxed version because the code
in our downstream kernel uses a dsb() after the write (which makes it
equivalent to a plain writel()).

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@gmail.com>
To: Rhyland Klein <rklein@nvidia.com>
Cc: Jon Hunter <jonathanh@nvidia.com>,
	Peter De Schrijver <pdeschrijver@nvidia.com>,
	Mike Turquette <mturquette@baylibre.com>,
	Stephen Warren <swarren@wwwdotorg.org>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Alexandre Courbot <gnurou@gmail.com>,
	linux-clk@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Andrew Bresticker <abrestic@chromium.org>
Subject: Re: [PATCH v5] clk: tegra: Initialize UTMIPLL when enabling PLLU
Date: Thu, 30 Jun 2016 17:43:02 +0200	[thread overview]
Message-ID: <20160630154302.GB4279@ulmo.ba.sec> (raw)
In-Reply-To: <fdd38adb-1a17-51fd-db62-be91102fdbd3@nvidia.com>

[-- Attachment #1: Type: text/plain, Size: 8180 bytes --]

On Thu, Jun 30, 2016 at 11:40:19AM -0400, Rhyland Klein wrote:
> On 6/30/2016 11:37 AM, Thierry Reding wrote:
> > * PGP Signed by an unknown key
> > 
> > On Thu, Jun 30, 2016 at 11:32:14AM -0400, Rhyland Klein wrote:
> >> On 6/17/2016 11:23 AM, Thierry Reding wrote:
> >>>> Old Signed by an unknown key
> >>>
> >>> On Fri, Jun 17, 2016 at 02:49:41PM +0100, Jon Hunter wrote:
> >>>> Hi Thierry,
> >>>>
> >>>> On 26/05/16 17:41, Rhyland Klein wrote:
> >>>>> From: Andrew Bresticker <abrestic@chromium.org>
> >>>>>
> >>>>> Move the UTMIPLL initialization code form clk-tegra<chip>.c files into
> >>>>> clk-pll.c. UTMIPLL was being configured and set in HW control right
> >>>>> after registration. However, when the clock init_table is processed and
> >>>>> child clks of PLLU are enabled, it will call in and enable PLLU as
> >>>>> well, and initiate SW enabling sequence even though PLLU is already in
> >>>>> HW control. This leads to getting UTMIPLL stuck with a SEQ_BUSY status.
> >>>>>
> >>>>> Doing the initialization once during pllu_enable means we configure it
> >>>>> properly into HW control.
> >>>>>
> >>>>> A side effect of the commonization/localization of the UTMIPLL init
> >>>>> code, is that it corrects some errors that were present for earlier
> >>>>> generations. For instance, in clk-tegra124.c, it used to have:
> >>>>>
> >>>>> define UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(x) (((x) & 0x1f) << 6)
> >>>>>
> >>>>> when the correct shift to use is present in the new version:
> >>>>>
> >>>>> define UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(x) (((x) & 0x1f) << 27)
> >>>>>
> >>>>> which matches the Tegra124 TRM register definition.
> >>>>>
> >>>>> Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
> >>>>>
> >>>>> [rklein: Merged in some later fixes for potential deadlocks]
> >>>>>
> >>>>> Signed-off-by: Rhyland Klein <rklein@nvidia.com>
> >>>>> ---
> >>>>> v5:
> >>>>>  - Initialized flags to 0 to avoid harmless spinlock warnings
> >>>>>
> >>>>> v4:
> >>>>>  - Re-added examples in patch description
> >>>>>
> >>>>> v3:
> >>>>>  - Flushed out description to describe this patch.
> >>>>>
> >>>>>  drivers/clk/tegra/clk-pll.c      | 484 +++++++++++++++++++++++++++++++++++++++
> >>>>>  drivers/clk/tegra/clk-tegra114.c | 155 +------------
> >>>>>  drivers/clk/tegra/clk-tegra124.c | 156 +------------
> >>>>>  drivers/clk/tegra/clk-tegra210.c | 182 +--------------
> >>>>>  drivers/clk/tegra/clk-tegra30.c  | 113 +--------
> >>>>>  drivers/clk/tegra/clk.h          |  17 ++
> >>>>>  6 files changed, 510 insertions(+), 597 deletions(-)
> >>>>>
> >>>>> diff --git a/drivers/clk/tegra/clk-pll.c b/drivers/clk/tegra/clk-pll.c
> >>>>> index 4e194ecc8d5e..31e20110fae4 100644
> >>>>> --- a/drivers/clk/tegra/clk-pll.c
> >>>>> +++ b/drivers/clk/tegra/clk-pll.c
> >>>>
> >>>> ...
> >>>>
> >>>>> +static int clk_pllu_tegra210_enable(struct clk_hw *hw)
> >>>>> +{
> >>>>> +	struct tegra_clk_pll *pll = to_clk_pll(hw);
> >>>>> +	struct clk_hw *pll_ref = clk_hw_get_parent(hw);
> >>>>> +	struct clk_hw *osc = clk_hw_get_parent(pll_ref);
> >>>>> +	unsigned long flags = 0, input_rate;
> >>>>> +	unsigned int i;
> >>>>> +	int ret = 0;
> >>>>> +	u32 val;
> >>>>> +
> >>>>> +	if (!osc) {
> >>>>> +		pr_err("%s: failed to get OSC clock\n", __func__);
> >>>>> +		return -EINVAL;
> >>>>> +	}
> >>>>> +	input_rate = clk_hw_get_rate(osc);
> >>>>> +
> >>>>> +	if (pll->lock)
> >>>>> +		spin_lock_irqsave(pll->lock, flags);
> >>>>> +
> >>>>> +	_clk_pll_enable(hw);
> >>>>> +	ret = clk_pll_wait_for_lock(pll);
> >>>>> +	if (ret < 0)
> >>>>> +		goto out;
> >>>>> +
> >>>>> +	for (i = 0; i < ARRAY_SIZE(utmi_parameters); i++) {
> >>>>> +		if (input_rate == utmi_parameters[i].osc_frequency)
> >>>>> +			break;
> >>>>> +	}
> >>>>> +
> >>>>> +	if (i == ARRAY_SIZE(utmi_parameters)) {
> >>>>> +		pr_err("%s: Unexpected input rate %lu\n", __func__, input_rate);
> >>>>> +		ret = -EINVAL;
> >>>>> +		goto out;
> >>>>> +	}
> >>>>> +
> >>>>> +	val = pll_readl_base(pll);
> >>>>> +	val &= ~PLLU_BASE_OVERRIDE;
> >>>>> +	pll_writel_base(val, pll);
> >>>>> +
> >>>>> +	/* Put PLLU under HW control */
> >>>>> +	val = readl_relaxed(pll->clk_base + PLLU_HW_PWRDN_CFG0);
> >>>>> +	val |= PLLU_HW_PWRDN_CFG0_IDDQ_PD_INCLUDE |
> >>>>> +	       PLLU_HW_PWRDN_CFG0_USE_SWITCH_DETECT |
> >>>>> +	       PLLU_HW_PWRDN_CFG0_USE_LOCKDET;
> >>>>> +	val &= ~(PLLU_HW_PWRDN_CFG0_CLK_ENABLE_SWCTL |
> >>>>> +		  PLLU_HW_PWRDN_CFG0_CLK_SWITCH_SWCTL);
> >>>>> +	writel_relaxed(val, pll->clk_base + PLLU_HW_PWRDN_CFG0);
> >>>>> +
> >>>>> +	val = readl_relaxed(pll->clk_base + XUSB_PLL_CFG0);
> >>>>> +	val &= ~XUSB_PLL_CFG0_PLLU_LOCK_DLY;
> >>>>> +	writel_relaxed(val, pll->clk_base + XUSB_PLL_CFG0);
> >>>>> +	udelay(1);
> >>>>> +
> >>>>> +	val = readl_relaxed(pll->clk_base + PLLU_HW_PWRDN_CFG0);
> >>>>> +	val |= PLLU_HW_PWRDN_CFG0_SEQ_ENABLE;
> >>>>> +	writel_relaxed(val, pll->clk_base + PLLU_HW_PWRDN_CFG0);
> >>>>> +	udelay(1);
> >>>>> +
> >>>>> +	/* Disable PLLU clock branch to UTMIPLL since it uses OSC */
> >>>>> +	val = pll_readl_base(pll);
> >>>>> +	val &= ~PLLU_BASE_CLKENABLE_USB;
> >>>>> +	pll_writel_base(val, pll);
> >>>>> +
> >>>>> +	val = readl_relaxed(pll->clk_base + UTMIPLL_HW_PWRDN_CFG0);
> >>>>> +	if (val & UTMIPLL_HW_PWRDN_CFG0_SEQ_ENABLE) {
> >>>>> +		pr_debug("UTMIPLL already enabled\n");
> >>>>> +		goto out;
> >>>>> +	}
> >>>>> +	val &= ~UTMIPLL_HW_PWRDN_CFG0_IDDQ_OVERRIDE;
> >>>>> +	writel_relaxed(val, pll->clk_base + UTMIPLL_HW_PWRDN_CFG0);
> >>>>> +
> >>>>> +	/* Program UTMIP PLL stable and active counts */
> >>>>> +	val = readl_relaxed(pll->clk_base + UTMIP_PLL_CFG2);
> >>>>> +	val &= ~UTMIP_PLL_CFG2_STABLE_COUNT(~0);
> >>>>> +	val |= UTMIP_PLL_CFG2_STABLE_COUNT(utmi_parameters[i].stable_count);
> >>>>> +	val &= ~UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(~0);
> >>>>> +	val |= UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(
> >>>>> +			utmi_parameters[i].active_delay_count);
> >>>>> +	val |= UTMIP_PLL_CFG2_PHY_XTAL_CLOCKEN;
> >>>>> +	writel_relaxed(val, pll->clk_base + UTMIP_PLL_CFG2);
> >>>>> +
> >>>>> +	/* Program UTMIP PLL delay and oscillator frequency counts */
> >>>>> +	val = readl_relaxed(pll->clk_base + UTMIP_PLL_CFG1);
> >>>>> +	val &= ~UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(~0);
> >>>>> +	val |= UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(
> >>>>> +		utmi_parameters[i].enable_delay_count);
> >>>>> +	val &= ~UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(~0);
> >>>>> +	val |= UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(
> >>>>> +		utmi_parameters[i].xtal_freq_count);
> >>>>> +	writel_relaxed(val, pll->clk_base + UTMIP_PLL_CFG1);
> >>>>> +
> >>>>> +	/* Remove power downs from UTMIP PLL control bits */
> >>>>> +	val = readl_relaxed(pll->clk_base + UTMIP_PLL_CFG1);
> >>>>> +	val &= ~UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN;
> >>>>> +	val |= UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERUP;
> >>>>> +	writel_relaxed(val, pll->clk_base + UTMIP_PLL_CFG1);
> >>>>> +	udelay(100);
> >>>>
> >>>> In next-20160617 I see that this udelay is now a usleep_range(100, 200)
> >>>> and this is causing the following splat when the clock is enabled. I
> >>>> don't think that we can use usleep here ...
> >>>
> >>> Okay, I'll back out the patch. I'd really prefer to avoid busy-looping
> >>> for 100 microseconds here, so can we please find another way to do this?
> >>>
> >>
> >> It looks like we should be able to use a short udelay of 1-2us. I
> >> believe the original code had udelay(1) and I know Jon and I tested
> >> udelay(2) and it was ok.
> > 
> > What original code? The downstream driver? If so I'd be leaning towards
> > simply adopting that. Everything else in this functions seems to want to
> > wait for 1 us, seems natural for this to do as well.
> 
> Sorry I wasn't clear. The code in the clk-tegraXX specific drivers was
> using udelay(1) as you pointed out, thats what I meant.

On further looking at the downstream code, the write before the udelay()
above should probably also use the non-relaxed version because the code
in our downstream kernel uses a dsb() after the write (which makes it
equivalent to a plain writel()).

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2016-06-30 15:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-26 16:41 [PATCH v5] clk: tegra: Initialize UTMIPLL when enabling PLLU Rhyland Klein
2016-05-26 16:41 ` Rhyland Klein
2016-06-14 11:33 ` Thierry Reding
     [not found] ` <1464280891-23036-1-git-send-email-rklein-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-06-17 13:49   ` Jon Hunter
2016-06-17 13:49     ` Jon Hunter
2016-06-17 15:23     ` Thierry Reding
2016-06-20 17:24       ` Rhyland Klein
2016-06-20 17:24         ` Rhyland Klein
2016-06-27 18:11       ` Rhyland Klein
2016-06-27 18:11         ` Rhyland Klein
2016-06-28 16:30         ` Jon Hunter
2016-06-30 15:32       ` Rhyland Klein
2016-06-30 15:32         ` Rhyland Klein
2016-06-30 15:37         ` Thierry Reding
2016-06-30 15:40           ` Rhyland Klein
2016-06-30 15:40             ` Rhyland Klein
     [not found]             ` <fdd38adb-1a17-51fd-db62-be91102fdbd3-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-06-30 15:43               ` Thierry Reding [this message]
2016-06-30 15:43                 ` Thierry Reding

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=20160630154302.GB4279@ulmo.ba.sec \
    --to=thierry.reding-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=linux-clk-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mturquette-rdvid1DuHRBWk0Htik3J/w@public.gmane.org \
    --cc=pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=rklein-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.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.