All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Anderson <sean.anderson@seco.com>
To: Michael Walle <michael@walle.cc>, biwen.li@nxp.com
Cc: leoyang.li@nxp.com, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, olteanv@gmail.com,
	shawnguo@kernel.org
Subject: Re: [PATCH v3 3/8] arm64: dts: ls1028a: add flextimer based pwm nodes
Date: Wed, 17 Aug 2022 16:20:21 -0400	[thread overview]
Message-ID: <a575ac76-89f1-cf62-37a4-9f8190682910@seco.com> (raw)
In-Reply-To: <20220728093318.299798-1-michael@walle.cc>

Hi Michael,

On 7/28/22 5:33 AM, Michael Walle wrote:
> Hi,
> 
> sorry for digging up this old thread. But I've noticed some
> inconsistencies here while syncing the device tree with u-boot.
> 
>>> On Wed, Apr 13, 2022 at 06:07:20PM +0000, Leo Li wrote:
>>> > > arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi:1210.21-1219.5:
>>> > > Warning
>>> > > (unique_unit_address): /soc/pwm@2800000: duplicate unit-address
>>> > > (also used in node /soc/timer@2800000)
>>> > > arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi:1221.21-1230.5:
>>> > > Warning
>>> > > (unique_unit_address): /soc/pwm@2810000: duplicate unit-address
>>> > > (also used in node /soc/timer@2810000)
>>> >
>>> > Well, this is similar situation as pcie.  The flextimer controller can
>>> > be used as timer, PWM or alarm.  We have separate drivers and bindings
>>> > for these modes which resulted in different nodes for the same
>>> > controller.
>>>
>>> I think the mfd framework can address the situation where multiple drivers,
>>> with multiple functionalities, want access to the same memory region?
>>
>> I know mfd is used for device providing multiple functions at the same
>> time. I'm not sure if it can help dealing with the one function at a time
>> scenario.
> 
> Funnily enough, I had the same concern:
> https://lore.kernel.org/lkml/92eaa24876a823aa5833435f51095812@walle.cc/

(a bit late, but I didn't see this the first time around)

One alternate approach is to do something like commit bc1ce713a084 ("pwm:
Add support for Xilinx AXI Timer"). Both arch/microblaze/kernel/timer.c
and drivers/pwm/pwm-xilinx.c are drivers for the same device (and have
e.g. the same compatible string). They determine whether to bind based
on whether #pwm-cells is present or not. This avoids having two nodes
with the same address, since one node can be used, with an overlay (or
an included) used to specify the function. It would be better to defer
this to when userspace can have a say, but timers are probed very early
on, so we can't do that.

For the pcie device, perhaps you could use #address-cells?

--Sean

WARNING: multiple messages have this Message-ID (diff)
From: Sean Anderson <sean.anderson@seco.com>
To: Michael Walle <michael@walle.cc>, biwen.li@nxp.com
Cc: leoyang.li@nxp.com, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, olteanv@gmail.com,
	shawnguo@kernel.org
Subject: Re: [PATCH v3 3/8] arm64: dts: ls1028a: add flextimer based pwm nodes
Date: Wed, 17 Aug 2022 16:20:21 -0400	[thread overview]
Message-ID: <a575ac76-89f1-cf62-37a4-9f8190682910@seco.com> (raw)
In-Reply-To: <20220728093318.299798-1-michael@walle.cc>

Hi Michael,

On 7/28/22 5:33 AM, Michael Walle wrote:
> Hi,
> 
> sorry for digging up this old thread. But I've noticed some
> inconsistencies here while syncing the device tree with u-boot.
> 
>>> On Wed, Apr 13, 2022 at 06:07:20PM +0000, Leo Li wrote:
>>> > > arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi:1210.21-1219.5:
>>> > > Warning
>>> > > (unique_unit_address): /soc/pwm@2800000: duplicate unit-address
>>> > > (also used in node /soc/timer@2800000)
>>> > > arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi:1221.21-1230.5:
>>> > > Warning
>>> > > (unique_unit_address): /soc/pwm@2810000: duplicate unit-address
>>> > > (also used in node /soc/timer@2810000)
>>> >
>>> > Well, this is similar situation as pcie.  The flextimer controller can
>>> > be used as timer, PWM or alarm.  We have separate drivers and bindings
>>> > for these modes which resulted in different nodes for the same
>>> > controller.
>>>
>>> I think the mfd framework can address the situation where multiple drivers,
>>> with multiple functionalities, want access to the same memory region?
>>
>> I know mfd is used for device providing multiple functions at the same
>> time. I'm not sure if it can help dealing with the one function at a time
>> scenario.
> 
> Funnily enough, I had the same concern:
> https://lore.kernel.org/lkml/92eaa24876a823aa5833435f51095812@walle.cc/

(a bit late, but I didn't see this the first time around)

One alternate approach is to do something like commit bc1ce713a084 ("pwm:
Add support for Xilinx AXI Timer"). Both arch/microblaze/kernel/timer.c
and drivers/pwm/pwm-xilinx.c are drivers for the same device (and have
e.g. the same compatible string). They determine whether to bind based
on whether #pwm-cells is present or not. This avoids having two nodes
with the same address, since one node can be used, with an overlay (or
an included) used to specify the function. It would be better to defer
this to when userspace can have a say, but timers are probed very early
on, so we can't do that.

For the pcie device, perhaps you could use #address-cells?

--Sean

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

  parent reply	other threads:[~2022-08-17 20:20 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-14  9:32 [PATCH v3 0/8] ls1028a device tree update Li Yang
2021-12-14  9:32 ` Li Yang
2021-12-14  9:32 ` [PATCH v3 1/8] arm64: dts: ls1028a: Add PCIe EP nodes Li Yang
2021-12-14  9:32   ` Li Yang
2022-04-13 16:32   ` Vladimir Oltean
2022-04-13 16:32     ` Vladimir Oltean
2022-04-13 18:03     ` Leo Li
2022-04-13 18:03       ` Leo Li
2022-04-13 18:22       ` Vladimir Oltean
2022-04-13 18:22         ` Vladimir Oltean
2022-04-13 18:38         ` Leo Li
2022-04-13 18:38           ` Leo Li
2021-12-14  9:32 ` [PATCH v3 2/8] arm64: dts: ls1028a: add ftm_alarm1 node to be used as wakeup source Li Yang
2021-12-14  9:32   ` Li Yang
2021-12-14  9:32 ` [PATCH v3 3/8] arm64: dts: ls1028a: add flextimer based pwm nodes Li Yang
2021-12-14  9:32   ` Li Yang
2022-04-13 16:33   ` Vladimir Oltean
2022-04-13 16:33     ` Vladimir Oltean
2022-04-13 18:07     ` Leo Li
2022-04-13 18:07       ` Leo Li
2022-04-13 18:23       ` Vladimir Oltean
2022-04-13 18:23         ` Vladimir Oltean
2022-04-13 19:10         ` Leo Li
2022-04-13 19:10           ` Leo Li
2022-07-28  9:33           ` Michael Walle
2022-07-28  9:33             ` Michael Walle
2022-08-16  9:04             ` Michael Walle
2022-08-16  9:04               ` Michael Walle
2022-08-17 20:20             ` Sean Anderson [this message]
2022-08-17 20:20               ` Sean Anderson
2021-12-14  9:32 ` [PATCH v3 4/8] arm64: dts: ls1028a-rdb: reorder nodes to be alphabetic Li Yang
2021-12-14  9:32   ` Li Yang
2021-12-16 10:01   ` Shawn Guo
2021-12-16 10:01     ` Shawn Guo
2021-12-14  9:32 ` [PATCH v3 5/8] arm64: dts: ls1028a-rdb: enable pwm0 Li Yang
2021-12-14  9:32   ` Li Yang
2021-12-14  9:32 ` [PATCH v3 6/8] arm64: dts: ls1028a-qds: move rtc node to the correct i2c bus Li Yang
2021-12-14  9:32   ` Li Yang
2021-12-14  9:32 ` [PATCH v3 7/8] arm64: dts: ls1028a-qds: enable lpuart1 Li Yang
2021-12-14  9:32   ` Li Yang
2021-12-14  9:32 ` [PATCH v3 8/8] arm64: dts: ls1028a-qds: add overlays for various serdes protocols Li Yang
2021-12-14  9:32   ` Li Yang
2022-01-26  8:33   ` Shawn Guo
2022-01-26  8:33     ` Shawn Guo
2022-01-26  8:55     ` Leo Li
2022-01-26  8:55       ` Leo Li

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=a575ac76-89f1-cf62-37a4-9f8190682910@seco.com \
    --to=sean.anderson@seco.com \
    --cc=biwen.li@nxp.com \
    --cc=leoyang.li@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael@walle.cc \
    --cc=olteanv@gmail.com \
    --cc=shawnguo@kernel.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.