From: Michal Simek <michal.simek@xilinx.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Sean Anderson" <sean.anderson@seco.com>,
"Rob Herring" <robh@kernel.org>
Cc: Michal Simek <michal.simek@xilinx.com>,
<linux-pwm@vger.kernel.org>, <devicetree@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
Lee Jones <lee.jones@linaro.org>,
Thierry Reding <thierry.reding@gmail.com>
Subject: Re: [PATCH 2/2] pwm: Add support for Xilinx AXI Timer
Date: Wed, 5 May 2021 08:31:01 +0200 [thread overview]
Message-ID: <5e67c893-6261-bdfd-a51f-2c17f671294b@xilinx.com> (raw)
In-Reply-To: <20210504161334.tzylwyiz4k2tcztq@pengutronix.de>
Hi,
On 5/4/21 6:13 PM, Uwe Kleine-König wrote:
> Hello Sean,
>
> [Adding Rob to the list of recipents, as he for sure has a valuable
> opinion on this matter.]
>
> On Tue, May 04, 2021 at 11:57:20AM -0400, Sean Anderson wrote:
>> On 5/4/21 8:32 AM, Michal Simek wrote:
>>> On 5/4/21 10:51 AM, Uwe Kleine-König wrote:
>>>> On Mon, May 03, 2021 at 05:44:13PM -0400, Sean Anderson wrote:
>>>>> This adds PWM support for Xilinx LogiCORE IP AXI soft timers commonly
>>>>> found on Xilinx FPGAs. There is another driver for this device located
>>>>> at arch/microblaze/kernel/timer.c, but it is only used for timekeeping.
>>>>> This driver was written with reference to Xilinx DS764 for v1.03.a [1].
>>>>>
>>>>> [1] https://www.xilinx.com/support/documentation/ip_documentation/axi_timer/v1_03_a/axi_timer_ds764.pdf
>>>>>
>>>>> Signed-off-by: Sean Anderson <sean.anderson@seco.com>
>>>>> ---
>>>>>
>>>>> arch/arm64/configs/defconfig | 1 +
>>>>> drivers/pwm/Kconfig | 11 ++
>>>>> drivers/pwm/Makefile | 1 +
>>>>> drivers/pwm/pwm-xilinx.c | 322 +++++++++++++++++++++++++++++++++++
>>>>> 4 files changed, 335 insertions(+)
>>>>> create mode 100644 drivers/pwm/pwm-xilinx.c
>>>>>
>>>>> diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
>>>>> index 08c6f769df9a..81794209f287 100644
>>>>> --- a/arch/arm64/configs/defconfig
>>>>> +++ b/arch/arm64/configs/defconfig
>>>>> @@ -1083,6 +1083,7 @@ CONFIG_PWM_SAMSUNG=y
>>>>> CONFIG_PWM_SL28CPLD=m
>>>>> CONFIG_PWM_SUN4I=m
>>>>> CONFIG_PWM_TEGRA=m
>>>>> +CONFIG_PWM_XILINX=m
>>>>> CONFIG_SL28CPLD_INTC=y
>>>>> CONFIG_QCOM_PDC=y
>>>>> CONFIG_RESET_IMX7=y
>>>>
>>>> I think this should go into a separate patch once this driver is
>>>> accepted. This can then go via the ARM people.
>>>>
>>>>> diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
>>>>> index d3371ac7b871..01e62928f4bf 100644
>>>>> --- a/drivers/pwm/Kconfig
>>>>> +++ b/drivers/pwm/Kconfig
>>>>> @@ -628,4 +628,15 @@ config PWM_VT8500
>>>>> To compile this driver as a module, choose M here: the module
>>>>> will be called pwm-vt8500.
>>>>>
>>>>> +config PWM_XILINX
>>>>> + tristate "Xilinx AXI Timer PWM support"
>>>>> + depends on !MICROBLAZE
>>>>
>>>> I don't understand this dependency.
>>>
>>> The dependency is clear here because microblaze has already driver for
>>> this timer here arch/microblaze/kernel/timer.c.
>
> Then at least add a comment.
I don't think that comment will really solve this. We should never
duplicate driver for the same IP to two locations.
Maybe this should be MFD driver.
>
>>> And that's exactly pointing to the way how this should be done.
>>> IP itself is single or dual timer and in case of dual timer you can
>>> select if there is pwm output and use it for PWM generation.
>>>
>>> It means it is timer with PMW together.
>>> I didn't have a time but Uwe likely knows this better how to design it.
>>>
>>> I see that gpio-mvebu driver instantiate pwm driver. Maybe that's the
>>> way to go.
>>
>> I think drivers/clocksource/samsung_pwm_timer.c and
>> drivers/pwm/pwm-samsung.c provide another example for how to go about
>> this.
>
> I recently had a similar problem (with code that isn't (yet) in
> mainline), where a timer can be used as a counter. I chose to change the
> compatible. Transferred to this example this would mean to use e.g.
>
> static const struct of_device_id xilinx_pwm_of_match[] = {
> { .compatible = "xlnx,xps-timer-pwm-1.00.a" },
> ...
> };
>
> and if you want to use the hardware as a PWM, you overwrite the
> compatible in your machine.dts.
It is HW selection inside that IP. It means you will get dt properly
when PWM output is selected. I understand that this shortcut can work
but I don't think it is proper design.
> Not sure however that this is nice enough to be accepted by the dt
> people?!
up to Rob.
Thanks,
Michal
next prev parent reply other threads:[~2021-05-05 6:31 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-03 21:44 [PATCH 1/2] dt-bindings: pwm: Add Xilinx AXI Timer Sean Anderson
2021-05-03 21:44 ` [PATCH 2/2] pwm: Add support for " Sean Anderson
2021-05-04 2:24 ` kernel test robot
2021-05-04 9:03 ` Alvaro Gamez
2021-05-04 17:16 ` Sean Anderson
2021-05-04 5:21 ` Alvaro G. M.
2021-05-04 8:51 ` Uwe Kleine-König
2021-05-04 12:32 ` Michal Simek
2021-05-04 15:57 ` Sean Anderson
2021-05-04 16:13 ` Uwe Kleine-König
2021-05-05 6:31 ` Michal Simek [this message]
2021-05-04 14:46 ` Sean Anderson
2021-05-04 15:03 ` Sean Anderson
2021-05-04 17:15 ` Uwe Kleine-König
2021-05-04 18:01 ` Sean Anderson
2021-05-04 0:21 ` [PATCH 1/2] dt-bindings: pwm: Add " Rob Herring
2021-05-04 14:51 ` Sean Anderson
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=5e67c893-6261-bdfd-a51f-2c17f671294b@xilinx.com \
--to=michal.simek@xilinx.com \
--cc=devicetree@vger.kernel.org \
--cc=lee.jones@linaro.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 \
--cc=thierry.reding@gmail.com \
--cc=u.kleine-koenig@pengutronix.de \
/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).