All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Cercueil <paul@crapouillou.net>
To: Zhou Yanjie <zhouyanjie@wanyeetech.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	robh+dt@kernel.org, tglx@linutronix.de,
	dongsheng.qiu@ingenic.com, aric.pzqi@ingenic.com,
	rick.tyliu@ingenic.com, yanfei.li@ingenic.com,
	sernia.zhou@foxmail.com, zhenwenjin@gmail.com
Subject: Re: [PATCH v6 2/2] clocksource: Ingenic: Add support for the Ingenic X1000 OST.
Date: Sat, 18 Jul 2020 17:44:52 +0200	[thread overview]
Message-ID: <S29ODQ.X11A9NSVRIIJ@crapouillou.net> (raw)
In-Reply-To: <096c8788-3c50-3eae-1c8e-c0c7487b00af@wanyeetech.com>

Hi Zhou,

Le sam. 18 juil. 2020 à 21:42, Zhou Yanjie <zhouyanjie@wanyeetech.com> 
a écrit :
> Hello Paul and Daniel,
> 
> 在 2020/7/18 下午9:12, Paul Cercueil 写道:
>> Hi Daniel,
>> 
>> Le ven. 17 juil. 2020 à 10:02, Daniel Lezcano 
>> \x7f<daniel.lezcano@linaro.org> a écrit :
>>> On 17/07/2020 08:13, Zhou Yanjie wrote:
>>>>  Hi Daniel,
>>>> 
>>>>  在 2020/7/17 下午12:20, Daniel Lezcano 写道:
>>>>>  On 10/07/2020 19:02, 周琰杰 (Zhou Yanjie) wrote:
>>>>>>  X1000 and SoCs after X1000 (such as X1500 and X1830) had a 
>>>>>> separate
>>>>>>  OST, it no longer belongs to TCU. This driver will register 
>>>>>> both a
>>>>>>  clocksource and a sched_clock to the system.
>>>>>> 
>>>>>>  Tested-by: 周正 (Zhou Zheng) <sernia.zhou@foxmail.com>
>>>>>>  Co-developed-by: 漆鹏振 (Qi Pengzhen) <aric.pzqi@ingenic.com>
>>>>>>  Signed-off-by: 漆鹏振 (Qi Pengzhen) <aric.pzqi@ingenic.com>
>>>>>>  Signed-off-by: 周琰杰 (Zhou Yanjie) 
>>>>>> <zhouyanjie@wanyeetech.com>
>>>>>>  Reviewed-by: Paul Cercueil <paul@crapouillou.net>
>>>>>>  ---
>>>>>> 
>>>>>>  Notes:
>>>>>>       v1->v2:
>>>>>>       Fix compile warnings.
>>>>>>       Reported-by: kernel test robot <lkp@intel.com>
>>>>>>            v2->v3:
>>>>>>       No change.
>>>>>>            v3->v4:
>>>>>>       1.Rename "ost" to "sysost"
>>>>>>       1.Remove unrelated changes.
>>>>>>       2.Remove ost_clock_parent enum.
>>>>>>       3.Remove 
>>>>>> ost->percpu_timer_channel/ost->global_timer_channel.
>>>>>>       4.Set up independent .recalc_rate/.set_rate for 
>>>>>> percpu/global
>>>>>>  timer.
>>>>>>       5.No longer call functions in variable declarations.
>>>>>>            v4->v5:
>>>>>>       Use "of_io_request_and_map()" instead "of_iomap()".
>>>>>>       Suggested-by: Paul Cercueil <paul@crapouillou.net>
>>>>>>            v5->v6:
>>>>>>       No change.
>>>>>> 
>>>>>>    drivers/clocksource/Kconfig          |  11 +
>>>>>>    drivers/clocksource/Makefile         |   1 +
>>>>>>    drivers/clocksource/ingenic-sysost.c | 539
>>>>>>  +++++++++++++++++++++++++++++++++++
>>>>>>    3 files changed, 551 insertions(+)
>>>>>>    create mode 100644 drivers/clocksource/ingenic-sysost.c
>>>>>> 
>>>>>>  diff --git a/drivers/clocksource/Kconfig 
>>>>>> \x7f\x7f\x7f\x7f\x7fb/drivers/clocksource/Kconfig
>>>>>>  index 91418381fcd4..1bca8b8fb30f 100644
>>>>>>  --- a/drivers/clocksource/Kconfig
>>>>>>  +++ b/drivers/clocksource/Kconfig
>>>>>>  @@ -696,6 +696,17 @@ config INGENIC_TIMER
>>>>>>        help
>>>>>>          Support for the timer/counter unit of the Ingenic JZ 
>>>>>> SoCs.
>>>>>>    +config INGENIC_SYSOST
>>>>>>  +    bool "Clocksource/timer using the SYSOST in Ingenic X SoCs"
>>>>>  We usually use silent options and let the platform's Kconfig 
>>>>> \x7f\x7f\x7f\x7fenable it.
>>>>>  We show up the option only when COMPILE_TEST is enabled.
>>>>> 
>>>>>  Is there a reason to do it differently?
>>>> 
>>>> 
>>>>  Do you mean
>>>> 
>>>>  bool "Clocksource/timer using the SYSOST in Ingenic X SoCs"
>>>> 
>>>>  or
>>>> 
>>>>  default MACH_INGENIC ?
>>> 
>>> Both, no default here.
>>> 
>>> eg.
>>> 
>>> bool "Clocksource/timer using the SYSOST in Ingenic X SoCs" if 
>>> \x7f\x7fCOMPILE_TEST
>>> 
>>> and
>>> 
>>> in arch/mips/Kconfig in the config MACH_INGENIC section :
>>> 
>>> ...
>>> select INGENIC_SYSOST
>>> ...
>> 
>> Disagreed. That's not how we do things on MIPS. Selecting 
>> MACH_INGENIC \x7fmeans "this kernel will support Ingenic SoCs", but not 
>> that it will \x7fonly support these. Hence the depends on MIPS / 
>> default MACH_INGENIC.
>> 
>> As for the select INGENIC_SYSOST, this driver only applies to a few 
>> \x7fSoCs, I certainly don't want it to be force-enabled. I don't even 
>> wait \x7fit to be force-enabled on X1000, since it is optional there 
>> too.
>> 
>> Cheers,
>> -Paul
> 
> 
> If we still need to keep the "default MACH_INGENIC", then Daniel can 
> directly apply the v6 version.
> 
> If we need to use the silent options, maybe we can enable them 
> separately according to 
> MACH_JZ4740/MACH_JZ4770/MACH_JZ4780/MACH_X1000/MACH_X1830.
> 
> In fact, I think X1000 and X1830 need to enable this driver in most 
> cases, because the current test has found that use TCU to provide 
> clocksource and clockevent will cause data loss/error when 
> transmitting data through spi or ethernet. And these errors no longer 
> appear after using OST.

This is likely because the clock is too fast, try to reduce it by a 
factor 2 or 4, it should behave better.

If it turns out OST is really needed, then it should be selected from 
MACH_X1000/X1830, not MACH_INGENIC.

Cheers,
-Paul

> Thanks and best regards!
> 
> 
>> 
>>> 
>>>>  This driver has some origins from "INGENIC_TIMER" driver and
>>>>  "INGENIC_OST" driver.
>>>>  Early Ingenic processors used TCU (timer/counter unit, has 6 or 8
>>>>  generic timer channels) to provide clocksource and clockevent 
>>>> (both \x7f\x7f\x7fwith
>>>>  only 16bit precision). This part of the processor can only use
>>>>  "INGENIC_TIMER" driver.
>>>> 
>>>>  Later processors provide an independent 32bit or 64bit timer 
>>>> channel
>>>>  (still under TCU, known as ost channel, this channel can not 
>>>> generate
>>>>  interrupt) to provid higher precision clocksource. The 
>>>> "INGENIC_OST"
>>>>  driver is for this channel. These processors can use 
>>>> "INGENIC_TIMER"
>>>>  driver, but using "INGENIC_OST" driver to provide higher precision
>>>>  clocksource would be a better choice (clockevent still needs to be
>>>>  provided by generic timer channel of TCU, and still 16bit 
>>>> precision).
>>>> 
>>>>  And the recent processors provide a SYSOST components, it is 
>>>> \x7f\x7f\x7findependent
>>>>  from TCU, including a 64bit timer channel for clocksource and a 
>>>> 32bit
>>>>  timer channel for clockevent. Although these processors can also 
>>>> use
>>>>  "INGENIC_TIMER" driver, but the better choice is completely 
>>>> \x7f\x7f\x7findependent
>>>>  use of "INGENIC_SYSOST" driver to provide higher precision 
>>>> clocksource
>>>>  and clockevent.
>>> 
>>> Ok, the rating should do the job then.
>>> 
>>> Thanks for the explanation.
>>> 
>>>>  You may have already noticed that this independent SYSOST 
>>>> component is
>>>>  like an upgraded and streamlined TCU, which only retains one 
>>>> generic
>>>>  timer channel that can generate interrupts, upgrade it from 16bit 
>>>> to
>>>>  32bit, and then retain the 64bit ost channel. so the driver code 
>>>> and
>>>>  Kconfig code of this patch is largely referenced
>>>>  "INGENIC_TIMER" driver and "INGENIC_OST" driver.
>>>> 
>>>>  Thanks and best regards!
>>>> 
>>>>>>  +    default MACH_INGENIC
>>>>>>  +    depends on MIPS || COMPILE_TEST
>>>>>>  +    depends on COMMON_CLK
>>>>>>  +    select MFD_SYSCON
>>>>>>  +    select TIMER_OF
>>>>>>  +    select IRQ_DOMAIN
>>>>>>  +    help
>>>>>>  +      Support for the SYSOST of the Ingenic X Series SoCs.
>>>>>>  +
>>>>>  [ ... ]
>>>>> 
>>>>> 
>>> 
>>> 
>>> --
>>> <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
>> 



  reply	other threads:[~2020-07-18 15:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-10 17:02 [PATCH v6 0/2] Add support for the OST in Ingenic X1000 周琰杰 (Zhou Yanjie)
2020-07-10 17:02 ` [PATCH v6 1/2] dt-bindings: timer: Add Ingenic X1000 OST bindings 周琰杰 (Zhou Yanjie)
2020-07-13 15:52   ` Rob Herring
2020-07-10 17:02 ` [PATCH v6 2/2] clocksource: Ingenic: Add support for the Ingenic X1000 OST 周琰杰 (Zhou Yanjie)
2020-07-17  4:20   ` Daniel Lezcano
2020-07-17  6:13     ` Zhou Yanjie
2020-07-17  8:02       ` Daniel Lezcano
2020-07-17 14:40         ` Zhou Yanjie
2020-07-18 13:12         ` Paul Cercueil
2020-07-18 13:42           ` Zhou Yanjie
2020-07-18 15:44             ` Paul Cercueil [this message]
2020-07-18 15:55               ` Zhou Yanjie
2020-07-18 16:11                 ` Paul Cercueil
2020-07-18 16:18                   ` Zhou Yanjie

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=S29ODQ.X11A9NSVRIIJ@crapouillou.net \
    --to=paul@crapouillou.net \
    --cc=aric.pzqi@ingenic.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dongsheng.qiu@ingenic.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rick.tyliu@ingenic.com \
    --cc=robh+dt@kernel.org \
    --cc=sernia.zhou@foxmail.com \
    --cc=tglx@linutronix.de \
    --cc=yanfei.li@ingenic.com \
    --cc=zhenwenjin@gmail.com \
    --cc=zhouyanjie@wanyeetech.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.