linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Michal Simek <michal.simek@xilinx.com>
To: Sean Anderson <sean.anderson@seco.com>,
	Michal Simek <michal.simek@xilinx.com>,
	Rob Herring <robh@kernel.org>
Cc: Linux PWM List <linux-pwm@vger.kernel.org>,
	<devicetree@vger.kernel.org>,
	 Alvaro Gamez <alvaro.gamez@hazent.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v3 1/2] dt-bindings: pwm: Add Xilinx AXI Timer
Date: Mon, 17 May 2021 10:28:15 +0200	[thread overview]
Message-ID: <141399b7-db9c-45e1-f743-9e3bc5e6f9fd@xilinx.com> (raw)
In-Reply-To: <87b31b06-9b81-5743-e3a8-50c255c0a83c@seco.com>



On 5/14/21 7:13 PM, Sean Anderson wrote:
> 
> 
> On 5/14/21 4:50 AM, Michal Simek wrote:
>>
>>
>> On 5/13/21 10:43 PM, Rob Herring wrote:
>>> On Thu, May 13, 2021 at 10:28 AM Sean Anderson
> <sean.anderson@seco.com> wrote:
>>>>
>>>>
>>>>
>>>> On 5/13/21 10:33 AM, Sean Anderson wrote:
>>>>   >
>>>>   >
>>>>   > On 5/12/21 10:16 PM, Rob Herring wrote:
>>>>   >  > On Tue, May 11, 2021 at 03:12:37PM -0400, Sean Anderson wrote:
>>>>   >  >> This adds a binding for the Xilinx LogiCORE IP AXI Timer.
> This device is
>>>>   >  >> a "soft" block, so it has many parameters which would not be
>>>>   >  >> configurable in most hardware. This binding is usually
> automatically
>>>>   >  >> generated by Xilinx's tools, so the names and values of some
> properties
>>>>   >  >> must be kept as they are. Replacement properties have been
> provided for
>>>>   >  >> new device trees.
>>>>   >  >
>>>>   >  > Because you have some tool generating properties is not a
> reason we have
>>>>   >  > to accept them upstream.
>>>>   >
>>>>   > These properties are already in
> arch/microblaze/boot/dts/system.dts and
>>>>   > in the devicetree supplied to Linux by qemu. Removing these
> properties
>>>>   > will break existing setups, which I would like to avoid.
>>>
>>> Already in use in upstream dts files is different than just
>>> 'automatically generated' by vendor tools.
>>>
>>>>   >
>>>>   >  > 'deprecated' is for what *we* have deprecated.
>>>>   >
>>>>   > Ok. I will remove that then.
>>>>   >
>>>>   >  >
>>>>   >  > In this case, I don't really see the point in defining new
> properties
>>>>   >  > just to have bool.
>>>>   >
>>>>   > I don't either, but it was requested, by Michal...
>>>>
>>>> Err, your comment on the original bindings was
>>>>
>>>>   > Can't all these be boolean?
>>>
>>> With no other context, yes that's what I would ask. Now you've given
>>> me some context, between using the existing ones and 2 sets of
>>> properties to maintain, I choose the former.
>>>
>>>> And Michal commented
>>>>
>>>>   > I think in this case you should described what it is used by
> current
>>>>   > driver in Microblaze and these options are required. The rest
> are by
>>>>   > design optional.
>>>>   > If you want to change them to different value then current binding
>>>>   > should be deprecated and have any transition time with code
> alignment.
>>>>
>>>> So that is what I tried to accomplish with this revision. I also tried
>>>> allowing something like
>>>>
>>>>          xlnx,one-timer-only = <0>; /* two timers */
>>>>          xlnx,one-timer-only = <1>; /* one timer  */
>>>>          xlnx,one-timer-only; /* one timer */
>>>>          /* property absent means two timers */
>>>>
>>>> but I was unable to figure out how to express this with json-schema. I
>>>> don't think it's the best design either...
>>>
>>> json-schema would certainly let you, but generally we don't want
>>> properties to have more than 1 type.
>>
>> One thing is what it is in system.dts file which was committed in 2009
>> and there are just small alignments there. But none is really using it.
>> Maybe I should just delete it.
>> And this version was generated by Xilinx ancient tools at that time. All
>> parameters there are fully describing HW and they are not changing. Only
>> new one can be added.
>>
>>  From the current microblaze code you can see which properties are really
>> used.
>>
>> reg
>> interrupts
>> xlnx,one-timer-only
>> clocks
>> clock-frequency
> 
> There is also an implicit dependency on xlnx,count-width. Several times
> the existing driver assumes the counter width is 32, but this should
> instead be discovered from the devicetree.

For me it is important what it is used now. Which is not
xlnx,count-width. That's why if you want to add it you can as optional
property.

> 
>> It means from my point of view these should be listed in the binding.
>> clock-frequency is optional by code when clock is defined.
>>
>> All other properties listed in system.dts are from my perspective
>> optional and that's how it should be.
> 
> Here is the situation as I understand it
> 
> * This device has existed for around 15 years (since 2006)
> * Because it is a soft device, there are several configurable parameters
> * Although all of these parameters must be known for a complete
>   implementation of this device, some are unnecessary if onlu reduced
>   functionality is needed.
> * A de facto devicetree binding for this device has existed for at least
>   12 years (since 2009), but likely for as long as the device itself has
>   existed. This binding has not changed substantially during this time.

note: IP itself is even much older.

> * This binding is present in devicetrees from the Linux kernel, from
>   qemu, in other existing systems, and in devicetrees generated by
>   Xilinx's toolset.

Only from Linux. Qemu is trying to reuse the same properties but it can
also add own one. They are trying to be aligned as much as possible but
there are a lot of cases where Qemu requires much more information. (I
am not saying in this timer case but in general).


> * Because the existing driver for this device does not implement all
>   functionality for this device, not all properties in the devicetree
>   binding are used. In fact, there is (as noted above) one property
>   which should be in use but is not because the current driver
>   (implicitly) does not support some hardware configurations.
> * To support additional functionality, it is necessary to
>   use hardware parameters which were not previously necessary.
> 
> Based on the above, we can classify the properties of this binding into
> several categories.
> 
> * Those which are currently read by the driver.
>   * compatible
>   * reg
>   * clocks
>   * clock-frequency
>   * interrupts
>   * xlnx,one-timer-only
> 
> * Those which reflect hardware parameters which are currently explicitly
>   or implicitly relied upon by the driver.
>   * reg
>   * clocks
>   * clock-frequency
>   * interrupts
>   * xlnx,counter-width
>   * xlnx,one-timer-only
> 
> * Those which are currently present in device trees.
>   * compatible
>   * reg
>   * interrupts
>   * clocks
>   * clock-frequency
>   * xlnx,count-width
>   * xlnx,one-timer-only
>   * xlnx,trig0-assert
>   * xlnx,trig1-assert
>   * xlnx,gen0-assert
>   * xlnx,gen1-assert
> 
> When choosing what properties to use, we must consider what the impact
> of our changes will be on not just the kernel but also on existing users
> of this binding:

I don't think that this is valid. Rob is asking for adding #pwm-cells
which is purely Linux binding. We also don't know what properties are
used by others projects not just Linux or Qemu. Also required properties
in Linux doesn't need to be required in U-Boot for example even we are
trying to aligned all of them. Another case are others RTOSes, etc.


> * To use properties currently present in device trees, we just need to
>   modify the kernel driver.
> * To add additional properties (such as e.g. '#pwm-cells'), we must
>   modify the kernel driver. In addition, users who would like to use
>   these new properties must add them to their device trees. This may be
>   done in a mechanical way using e.g. overlays.
> * To deprecate existing properties and introduce new properties to
>   expose the same underlying hardware parameters, we must modify the
>   kernel driver. However, this has a large impact on existing users.
>   They must modify their tools to generate this information in a
>   different format. When this information is generated by upstream tools
>   this may require updating a core part of their build system. For many
>   projects, this may happen very infrequently because of the risk that
>   such an upgrade will break things. Even if you suggest that Xilinx can
>   easily modify its tools to generate any sort of output, the time for
>   this upgrade to be deployed/adopted may be significantly longer.

From Xilinx perspective it would be ideal to use only properties which
fully describe HW in the form how they are generated today. They are
stable for a lot of years and as I said only new one are added.
But this alignment wasn't accepted long time ago and we have been asked
to start to align these properties with similar HW done by others.
And truth is that in a lot of cases there is clear 1:1 mapping and
generic properties can be simply use. This mapping ends in Xilinx device
tree generator.
Back to your point. Required properties are required by Linux driver
only. This driver is around for quite a long time where certain policies
haven't been setup/used/enforced (Microblaze is 2nd architecture which
started to use device tree).
We should create DT binding doc at that time but in 2009 it wasn't
standard practice. In 2007 Grant was adding support for Xilinx PPC
platform also without any DT binding document too.

That's why we need to review current unwritten DT binding based on code
requirements and look at it how to fix it (if needed) and then add PWM
support on the top of it.
If something needs to be deprecated, let's deprecate it and have
transition time for a year or so to adapt to it.

Rob knows much better than I how this should be handled.

Based on your list:
  * compatible
  * reg
  * clocks
  * clock-frequency
  * interrupts
  * xlnx,one-timer-only

all of these are required property in new DT binding.

xlnx,counter-width is optional if you want to use.
#pwm-cells is optional for enabling PWM support (I would expect that
when this property is present this timer don't need be used as
clocksource/clockevent by Microblaze)
etc

And for properties which are generated out of Xilinx tools I would allow
in DT binding to add others optional properties that DT won't error out
if they are seen.

Thanks,
Michal

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

  reply	other threads:[~2021-05-17  8:35 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-11 19:12 [PATCH v3 1/2] dt-bindings: pwm: Add Xilinx AXI Timer Sean Anderson
2021-05-11 19:12 ` [PATCH v3 2/2] clocksource: Add support for " Sean Anderson
2021-05-11 19:19   ` Sean Anderson
2021-05-12  8:31   ` kernel test robot
2021-05-14  8:59   ` Michal Simek
2021-05-14 14:40     ` Sean Anderson
2021-05-17  7:54       ` Michal Simek
2021-05-17 22:15         ` Sean Anderson
2021-05-19  7:24           ` Michal Simek
2021-05-20 20:13             ` Sean Anderson
2021-05-24  7:00               ` Michal Simek
2021-05-24 18:34                 ` Sean Anderson
2021-05-25  6:11                 ` Uwe Kleine-König
2021-05-25 14:30                   ` Sean Anderson
2021-06-16 12:12                   ` Michal Simek
2021-06-18 21:24                     ` Sean Anderson
2021-06-24 16:25                       ` Michal Simek
2021-05-12 18:35 ` [PATCH v3 1/2] dt-bindings: pwm: Add " Rob Herring
2021-05-13  2:16 ` Rob Herring
2021-05-13 14:33   ` Sean Anderson
2021-05-13 15:28     ` Sean Anderson
2021-05-13 20:43       ` Rob Herring
2021-05-13 21:01         ` Sean Anderson
2021-05-14  8:50         ` Michal Simek
2021-05-14 17:13           ` Sean Anderson
2021-05-17  8:28             ` Michal Simek [this message]
2021-05-17 14:40               ` Sean Anderson
2021-05-17 14:49                 ` Michal Simek

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=141399b7-db9c-45e1-f743-9e3bc5e6f9fd@xilinx.com \
    --to=michal.simek@xilinx.com \
    --cc=alvaro.gamez@hazent.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sean.anderson@seco.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).