linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Joseph Lo <josephl@nvidia.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Thomas Gleixner <tglx@linutronix.de>
Cc: linux-tegra@vger.kernel.org, Thierry Reding <treding@nvidia.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH V6 2/7] clocksource: tegra: add Tegra210 timer support
Date: Tue, 19 Feb 2019 10:33:03 +0100	[thread overview]
Message-ID: <0690a2a2-06e6-62ee-0a5d-dda008fb7fef@linaro.org> (raw)
In-Reply-To: <a9b6e870-258d-492f-1f1d-5d6ceea24795@nvidia.com>

On 19/02/2019 10:00, Joseph Lo wrote:
> On 2/18/19 5:39 PM, Daniel Lezcano wrote:
>> On 18/02/2019 10:01, Joseph Lo wrote:
>>> On 2/15/19 11:14 PM, Daniel Lezcano wrote:
>>>> On 01/02/2019 17:16, Joseph Lo wrote:
>>>>> Add support for the Tegra210 timer that runs at oscillator clock
>>>>> (TMR10-TMR13). We need these timers to work as clock event device
>>>>> and to
>>>>> replace the ARMv8 architected timer due to it can't survive across the
>>>>> power cycle of the CPU core or CPUPORESET signal. So it can't be a
>>>>> wake-up
>>>>> source when CPU suspends in power down state.
>>>>>
>>>>> Also convert the original driver to use timer-of API.
>>>>>
>>>>> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
>>>>> Cc: Thomas Gleixner <tglx@linutronix.de>
>>>>> Cc: linux-kernel@vger.kernel.org
>>>>> Signed-off-by: Joseph Lo <josephl@nvidia.com>
>>>>> Acked-by: Thierry Reding <treding@nvidia.com>
>>>>> Acked-by: Jon Hunter <jonathanh@nvidia.com>
>>>>> ---
>>>>> v6:
>>>>>    * refine the timer defines
>>>>>    * add ack tag from Jon.
>>>>> v5:
>>>>>    * add ack tag from Thierry
>>>>> v4:
>>>>>    * merge timer-tegra210.c in previous version into timer-tegra20.c
>>>>> v3:
>>>>>    * use timer-of API
>>>>> v2:
>>>>>    * add error clean-up code
>>>>> ---
> [snip]
>>>>> +    for_each_possible_cpu(cpu) {
>>>>> +        struct timer_of *cpu_to;
>>>>> +
>>>>> +        cpu_to = per_cpu_ptr(&tegra_to, cpu);
>>>>> +        cpu_to->of_base.base = timer_reg_base +
>>>>> TIMER_BASE_FOR_CPU(cpu);
>>>>> +        cpu_to->of_clk.rate = timer_of_rate(to);
>>>>> +        cpu_to->clkevt.cpumask = cpumask_of(cpu);
>>>>> +
>>>>> +        cpu_to->clkevt.irq =
>>>>> +            irq_of_parse_and_map(np, IRQ_IDX_FOR_CPU(cpu));
>>>>> +        if (!cpu_to->clkevt.irq) {
>>>>> +            pr_err("%s: can't map IRQ for CPU%d\n",
>>>>> +                   __func__, cpu);
>>>>> +            ret = -EINVAL;
>>>>> +            goto out;
>>>>> +        }
>>>>> +
>>>>> +        irq_set_status_flags(cpu_to->clkevt.irq, IRQ_NOAUTOEN);
>>>>> +        ret = request_irq(cpu_to->clkevt.irq, tegra_timer_isr,
>>>>> +                  IRQF_TIMER | IRQF_NOBALANCING,
>>>>> +                  cpu_to->clkevt.name, &cpu_to->clkevt);
>>>>> +        if (ret) {
>>>>> +            pr_err("%s: cannot setup irq %d for CPU%d\n",
>>>>> +                __func__, cpu_to->clkevt.irq, cpu);
>>>>> +            ret = -EINVAL;
>>>>> +            goto out_irq;
>>>>> +        }
>>>>> +    }
>>>>
>>>> You should configure the timer in the tegra_timer_setup() function
>>>> instead of using this cpu loop.
>>>>
>>>
>>> I think I still need to leave 'irq_of_parse_and_map' and 'request_irq'
>>> here. Is that ok?
>>
>> Perhaps you can store the np pointer in the private data structure of
>> timer-of and let the timer_of API to retrieve the irq in the cpuhp
>> callbacks.
>>
>> irq_of_parse_and_map will be called by timer-of.
>>
>> I'm not sure irq_set_status_flags really operates on the irq because it
>> is called after request_irq.
>>
> 
> I did some experiments today. The 'irq_of_parse_and_map', 'request_irq'
> and 'setup_irq' are not able to run in the atomic section that
> tegra_timer_setup would be triggered in.

Oh ... right

> So I think I still need to leave the IRQ configuration code here in the
> loop. Should I move others to 'tegra_timer_setup' or just keep as the
> same in this patch?

For the moment, I suggest you keep it as it was initially.

A side note, not related to this comment but about the DYNIRQ flag.
Actually it is not needed because the timers are per-cpu.

Thanks

  -- Daniel


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-02-19  9:33 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-01 16:16 [PATCH V6 0/7] Add CPUidle support for Tegra210 Joseph Lo
2019-02-01 16:16 ` [PATCH V6 1/7] dt-bindings: timer: add Tegra210 timer Joseph Lo
2019-02-01 16:16 ` [PATCH V6 2/7] clocksource: tegra: add Tegra210 timer support Joseph Lo
2019-02-01 16:31   ` Jon Hunter
2019-02-08 13:23   ` Joseph Lo
2019-02-13  8:55     ` Daniel Lezcano
2019-02-13  9:08       ` Joseph Lo
2019-02-15 15:14   ` Daniel Lezcano
2019-02-18  9:01     ` Joseph Lo
2019-02-18  9:39       ` Daniel Lezcano
2019-02-19  9:00         ` Joseph Lo
2019-02-19  9:33           ` Daniel Lezcano [this message]
2019-02-01 16:16 ` [PATCH V6 3/7] soc/tegra: default select TEGRA_TIMER for Tegra210 Joseph Lo
2019-02-01 16:16 ` [PATCH V6 4/7] arm64: dts: tegra210: fix timer node Joseph Lo
2019-02-01 16:16 ` [PATCH V6 5/7] arm64: dts: tegra210: add CPU idle states properties Joseph Lo
2019-02-15 15:47   ` Daniel Lezcano
2019-02-18  9:21     ` Joseph Lo
2019-02-01 16:16 ` [PATCH V6 6/7] arm64: dts: tegra210-p2180: Enable CPU idle support Joseph Lo
2019-02-01 16:16 ` [PATCH V6 7/7] arm64: dts: tegra210-smaug: " Joseph Lo

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=0690a2a2-06e6-62ee-0a5d-dda008fb7fef@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=jonathanh@nvidia.com \
    --cc=josephl@nvidia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=thierry.reding@gmail.com \
    --cc=treding@nvidia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).