diff mbox series

[v3,3/8] arm64: dts: ls1028a: add flextimer based pwm nodes

Message ID 20211214093240.23320-4-leoyang.li@nxp.com (mailing list archive)
State New, archived
Headers show
Series ls1028a device tree update | expand

Commit Message

Leo Li Dec. 14, 2021, 9:32 a.m. UTC
From: Biwen Li <biwen.li@nxp.com>

Add pwm nodes using flextimer controller.

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Signed-off-by: Li Yang <leoyang.li@nxp.com>
---
 .../arm64/boot/dts/freescale/fsl-ls1028a.dtsi | 95 +++++++++++++++++++
 1 file changed, 95 insertions(+)

Comments

Vladimir Oltean April 13, 2022, 4:33 p.m. UTC | #1
On Tue, Dec 14, 2021 at 03:32:35AM -0600, Li Yang wrote:
> From: Biwen Li <biwen.li@nxp.com>
>
> Add pwm nodes using flextimer controller.
>
> Signed-off-by: Biwen Li <biwen.li@nxp.com>
> Signed-off-by: Li Yang <leoyang.li@nxp.com>
> ---
>  .../arm64/boot/dts/freescale/fsl-ls1028a.dtsi | 95 +++++++++++++++++++
>  1 file changed, 95 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
> index f2564faf7067..5a7b26a1bad2 100644
> --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
> +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
> @@ -66,6 +66,13 @@ CPU_PW20: cpu-pw20 {
>  		};
>  	};
>
> +	rtc_clk: rtc-clk {
> +		compatible = "fixed-clock";
> +		#clock-cells = <0>;
> +		clock-frequency = <32768>;
> +		clock-output-names = "rtc_clk";
> +	};
> +
>  	sysclk: sysclk {
>  		compatible = "fixed-clock";
>  		#clock-cells = <0>;
> @@ -1186,6 +1193,94 @@ ierb@1f0800000 {
>  			reg = <0x01 0xf0800000 0x0 0x10000>;
>  		};
>
> +		pwm0: pwm@2800000 {
> +			compatible = "fsl,vf610-ftm-pwm";
> +			#pwm-cells = <3>;
> +			reg = <0x0 0x2800000 0x0 0x10000>;
> +			clock-names = "ftm_sys", "ftm_ext",
> +				      "ftm_fix", "ftm_cnt_clk_en";
> +			clocks = <&clockgen 4 1>, <&clockgen 4 1>,
> +				 <&rtc_clk>, <&clockgen 4 1>;
> +			status = "disabled";
> +		};
> +
> +		pwm1: pwm@2810000 {
> +			compatible = "fsl,vf610-ftm-pwm";
> +			#pwm-cells = <3>;
> +			reg = <0x0 0x2810000 0x0 0x10000>;
> +			clock-names = "ftm_sys", "ftm_ext",
> +				      "ftm_fix", "ftm_cnt_clk_en";
> +			clocks = <&clockgen 4 1>, <&clockgen 4 1>,
> +				 <&rtc_clk>, <&clockgen 4 1>;
> +			status = "disabled";
> +		};
> +
> +		pwm2: pwm@2820000 {
> +			compatible = "fsl,vf610-ftm-pwm";
> +			#pwm-cells = <3>;
> +			reg = <0x0 0x2820000 0x0 0x10000>;
> +			clock-names = "ftm_sys", "ftm_ext",
> +				      "ftm_fix", "ftm_cnt_clk_en";
> +			clocks = <&clockgen 4 1>, <&clockgen 4 1>,
> +				 <&rtc_clk>, <&clockgen 4 1>;
> +			status = "disabled";
> +		};
> +
> +		pwm3: pwm@2830000 {
> +			compatible = "fsl,vf610-ftm-pwm";
> +			#pwm-cells = <3>;
> +			reg = <0x0 0x2830000 0x0 0x10000>;
> +			clock-names = "ftm_sys", "ftm_ext",
> +				      "ftm_fix", "ftm_cnt_clk_en";
> +			clocks = <&clockgen 4 1>, <&clockgen 4 1>,
> +				 <&rtc_clk>, <&clockgen 4 1>;
> +			status = "disabled";
> +		};
> +
> +		pwm4: pwm@2840000 {
> +			compatible = "fsl,vf610-ftm-pwm";
> +			#pwm-cells = <3>;
> +			reg = <0x0 0x2840000 0x0 0x10000>;
> +			clock-names = "ftm_sys", "ftm_ext",
> +				      "ftm_fix", "ftm_cnt_clk_en";
> +			clocks = <&clockgen 4 1>, <&clockgen 4 1>,
> +				 <&rtc_clk>, <&clockgen 4 1>;
> +			status = "disabled";
> +		};
> +
> +		pwm5: pwm@2850000 {
> +			compatible = "fsl,vf610-ftm-pwm";
> +			#pwm-cells = <3>;
> +			reg = <0x0 0x2850000 0x0 0x10000>;
> +			clock-names = "ftm_sys", "ftm_ext",
> +				      "ftm_fix", "ftm_cnt_clk_en";
> +			clocks = <&clockgen 4 1>, <&clockgen 4 1>,
> +				 <&rtc_clk>, <&clockgen 4 1>;
> +			status = "disabled";
> +		};
> +
> +		pwm6: pwm@2860000 {
> +			compatible = "fsl,vf610-ftm-pwm";
> +			#pwm-cells = <3>;
> +			reg = <0x0 0x2860000 0x0 0x10000>;
> +			clock-names = "ftm_sys", "ftm_ext",
> +				      "ftm_fix", "ftm_cnt_clk_en";
> +			clocks = <&clockgen 4 1>, <&clockgen 4 1>,
> +				 <&rtc_clk>, <&clockgen 4 1>;
> +			status = "disabled";
> +		};
> +
> +		pwm7: pwm@2870000 {
> +			compatible = "fsl,vf610-ftm-pwm";
> +			#pwm-cells = <3>;
> +			reg = <0x0 0x2870000 0x0 0x10000>;
> +			clock-names = "ftm_sys", "ftm_ext",
> +				      "ftm_fix", "ftm_cnt_clk_en";
> +			clocks = <&clockgen 4 1>, <&clockgen 4 1>,
> +				 <&rtc_clk>, <&clockgen 4 1>;
> +			status = "disabled";
> +		};
> +
>  		rcpm: power-controller@1e34040 {
>  			compatible = "fsl,ls1028a-rcpm", "fsl,qoriq-rcpm-2.1+";
>  			reg = <0x0 0x1e34040 0x0 0x1c>;
> --
> 2.25.1
>

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)
Leo Li April 13, 2022, 6:07 p.m. UTC | #2
> -----Original Message-----
> From: Vladimir Oltean <olteanv@gmail.com>
> Sent: Wednesday, April 13, 2022 11:33 AM
> To: Leo Li <leoyang.li@nxp.com>
> Cc: Shawn Guo <shawnguo@kernel.org>; linux-arm-
> kernel@lists.infradead.org; linux-kernel@vger.kernel.org; Biwen Li
> <biwen.li@nxp.com>
> Subject: Re: [PATCH v3 3/8] arm64: dts: ls1028a: add flextimer based pwm
> nodes
> 
> On Tue, Dec 14, 2021 at 03:32:35AM -0600, Li Yang wrote:
> > From: Biwen Li <biwen.li@nxp.com>
> >
> > Add pwm nodes using flextimer controller.
> >
> > Signed-off-by: Biwen Li <biwen.li@nxp.com>
> > Signed-off-by: Li Yang <leoyang.li@nxp.com>
> > ---
> >  .../arm64/boot/dts/freescale/fsl-ls1028a.dtsi | 95 +++++++++++++++++++
> >  1 file changed, 95 insertions(+)
> >
> > diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
> b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
> > index f2564faf7067..5a7b26a1bad2 100644
> > --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
> > +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
> > @@ -66,6 +66,13 @@ CPU_PW20: cpu-pw20 {
> >  		};
> >  	};
> >
> > +	rtc_clk: rtc-clk {
> > +		compatible = "fixed-clock";
> > +		#clock-cells = <0>;
> > +		clock-frequency = <32768>;
> > +		clock-output-names = "rtc_clk";
> > +	};
> > +
> >  	sysclk: sysclk {
> >  		compatible = "fixed-clock";
> >  		#clock-cells = <0>;
> > @@ -1186,6 +1193,94 @@ ierb@1f0800000 {
> >  			reg = <0x01 0xf0800000 0x0 0x10000>;
> >  		};
> >
> > +		pwm0: pwm@2800000 {
> > +			compatible = "fsl,vf610-ftm-pwm";
> > +			#pwm-cells = <3>;
> > +			reg = <0x0 0x2800000 0x0 0x10000>;
> > +			clock-names = "ftm_sys", "ftm_ext",
> > +				      "ftm_fix", "ftm_cnt_clk_en";
> > +			clocks = <&clockgen 4 1>, <&clockgen 4 1>,
> > +				 <&rtc_clk>, <&clockgen 4 1>;
> > +			status = "disabled";
> > +		};
> > +
> > +		pwm1: pwm@2810000 {
> > +			compatible = "fsl,vf610-ftm-pwm";
> > +			#pwm-cells = <3>;
> > +			reg = <0x0 0x2810000 0x0 0x10000>;
> > +			clock-names = "ftm_sys", "ftm_ext",
> > +				      "ftm_fix", "ftm_cnt_clk_en";
> > +			clocks = <&clockgen 4 1>, <&clockgen 4 1>,
> > +				 <&rtc_clk>, <&clockgen 4 1>;
> > +			status = "disabled";
> > +		};
> > +
> > +		pwm2: pwm@2820000 {
> > +			compatible = "fsl,vf610-ftm-pwm";
> > +			#pwm-cells = <3>;
> > +			reg = <0x0 0x2820000 0x0 0x10000>;
> > +			clock-names = "ftm_sys", "ftm_ext",
> > +				      "ftm_fix", "ftm_cnt_clk_en";
> > +			clocks = <&clockgen 4 1>, <&clockgen 4 1>,
> > +				 <&rtc_clk>, <&clockgen 4 1>;
> > +			status = "disabled";
> > +		};
> > +
> > +		pwm3: pwm@2830000 {
> > +			compatible = "fsl,vf610-ftm-pwm";
> > +			#pwm-cells = <3>;
> > +			reg = <0x0 0x2830000 0x0 0x10000>;
> > +			clock-names = "ftm_sys", "ftm_ext",
> > +				      "ftm_fix", "ftm_cnt_clk_en";
> > +			clocks = <&clockgen 4 1>, <&clockgen 4 1>,
> > +				 <&rtc_clk>, <&clockgen 4 1>;
> > +			status = "disabled";
> > +		};
> > +
> > +		pwm4: pwm@2840000 {
> > +			compatible = "fsl,vf610-ftm-pwm";
> > +			#pwm-cells = <3>;
> > +			reg = <0x0 0x2840000 0x0 0x10000>;
> > +			clock-names = "ftm_sys", "ftm_ext",
> > +				      "ftm_fix", "ftm_cnt_clk_en";
> > +			clocks = <&clockgen 4 1>, <&clockgen 4 1>,
> > +				 <&rtc_clk>, <&clockgen 4 1>;
> > +			status = "disabled";
> > +		};
> > +
> > +		pwm5: pwm@2850000 {
> > +			compatible = "fsl,vf610-ftm-pwm";
> > +			#pwm-cells = <3>;
> > +			reg = <0x0 0x2850000 0x0 0x10000>;
> > +			clock-names = "ftm_sys", "ftm_ext",
> > +				      "ftm_fix", "ftm_cnt_clk_en";
> > +			clocks = <&clockgen 4 1>, <&clockgen 4 1>,
> > +				 <&rtc_clk>, <&clockgen 4 1>;
> > +			status = "disabled";
> > +		};
> > +
> > +		pwm6: pwm@2860000 {
> > +			compatible = "fsl,vf610-ftm-pwm";
> > +			#pwm-cells = <3>;
> > +			reg = <0x0 0x2860000 0x0 0x10000>;
> > +			clock-names = "ftm_sys", "ftm_ext",
> > +				      "ftm_fix", "ftm_cnt_clk_en";
> > +			clocks = <&clockgen 4 1>, <&clockgen 4 1>,
> > +				 <&rtc_clk>, <&clockgen 4 1>;
> > +			status = "disabled";
> > +		};
> > +
> > +		pwm7: pwm@2870000 {
> > +			compatible = "fsl,vf610-ftm-pwm";
> > +			#pwm-cells = <3>;
> > +			reg = <0x0 0x2870000 0x0 0x10000>;
> > +			clock-names = "ftm_sys", "ftm_ext",
> > +				      "ftm_fix", "ftm_cnt_clk_en";
> > +			clocks = <&clockgen 4 1>, <&clockgen 4 1>,
> > +				 <&rtc_clk>, <&clockgen 4 1>;
> > +			status = "disabled";
> > +		};
> > +
> >  		rcpm: power-controller@1e34040 {
> >  			compatible = "fsl,ls1028a-rcpm", "fsl,qoriq-rcpm-
> 2.1+";
> >  			reg = <0x0 0x1e34040 0x0 0x1c>;
> > --
> > 2.25.1
> >
> 
> 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.

Regards,
Leo
Vladimir Oltean April 13, 2022, 6:23 p.m. UTC | #3
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?
Leo Li April 13, 2022, 7:10 p.m. UTC | #4
> -----Original Message-----
> From: Vladimir Oltean <olteanv@gmail.com>
> Sent: Wednesday, April 13, 2022 1:23 PM
> To: Leo Li <leoyang.li@nxp.com>
> Cc: Shawn Guo <shawnguo@kernel.org>; linux-arm-
> kernel@lists.infradead.org; linux-kernel@vger.kernel.org; Biwen Li
> <biwen.li@nxp.com>
> Subject: Re: [PATCH v3 3/8] arm64: dts: ls1028a: add flextimer based pwm
> nodes
> 
> 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.

Regards,
Leo
Michael Walle July 28, 2022, 9:33 a.m. UTC | #5
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/

Anyway, I have a few questions about the device tree here:

> +	rtc_clk: rtc-clk {
> +		compatible = "fixed-clock";
> +		#clock-cells = <0>;
> +		clock-frequency = <32768>;
> +		clock-output-names = "rtc_clk";
> +	};
> +

Is that an internal clock? I've checked the RDB schematics and the
RTC clock output is not connected to anything. The RM of the LS1028A
mentions the fixed clock input of the flex timer, but it doesn't say
where it is connected to. It just says there is no "internally-generated
secure clock" support on any of the timer modules.

In ch19.3 it also says "For the chip-specific implementation details of
this module's instances, see the chip configuration information". But
I'm not sure where to find this.


> +		pwm0: pwm@2800000 {
> +			compatible = "fsl,vf610-ftm-pwm";
> +			#pwm-cells = <3>;
> +			reg = <0x0 0x2800000 0x0 0x10000>;
> +			clock-names = "ftm_sys", "ftm_ext",
> +				      "ftm_fix", "ftm_cnt_clk_en";
> +			clocks = <&clockgen 4 1>, <&clockgen 4 1>,
> +				 <&rtc_clk>, <&clockgen 4 1>;

ftm_ext seems to be the (optional) external clock, eg FTMn_EXTCLK. Why is
it connected to <&clockgen 4 1>? That doesn't make sense. The driver
itself, won't probe if the clock isn't there either and assumes that the
external clock is always there. That seems wrong, too.

Can you shed some light on this?

-michael
Michael Walle Aug. 16, 2022, 9:04 a.m. UTC | #6
Am 2022-07-28 11:33, schrieb Michael Walle:
> 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/
> 
> Anyway, I have a few questions about the device tree here:
> 
>> +	rtc_clk: rtc-clk {
>> +		compatible = "fixed-clock";
>> +		#clock-cells = <0>;
>> +		clock-frequency = <32768>;
>> +		clock-output-names = "rtc_clk";
>> +	};
>> +
> 
> Is that an internal clock? I've checked the RDB schematics and the
> RTC clock output is not connected to anything. The RM of the LS1028A
> mentions the fixed clock input of the flex timer, but it doesn't say
> where it is connected to. It just says there is no 
> "internally-generated
> secure clock" support on any of the timer modules.
> 
> In ch19.3 it also says "For the chip-specific implementation details of
> this module's instances, see the chip configuration information". But
> I'm not sure where to find this.
> 
> 
>> +		pwm0: pwm@2800000 {
>> +			compatible = "fsl,vf610-ftm-pwm";
>> +			#pwm-cells = <3>;
>> +			reg = <0x0 0x2800000 0x0 0x10000>;
>> +			clock-names = "ftm_sys", "ftm_ext",
>> +				      "ftm_fix", "ftm_cnt_clk_en";
>> +			clocks = <&clockgen 4 1>, <&clockgen 4 1>,
>> +				 <&rtc_clk>, <&clockgen 4 1>;
> 
> ftm_ext seems to be the (optional) external clock, eg FTMn_EXTCLK. Why 
> is
> it connected to <&clockgen 4 1>? That doesn't make sense. The driver
> itself, won't probe if the clock isn't there either and assumes that 
> the
> external clock is always there. That seems wrong, too.
> 
> Can you shed some light on this?

Ping.

-michael
Sean Anderson Aug. 17, 2022, 8:20 p.m. UTC | #7
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
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
index f2564faf7067..5a7b26a1bad2 100644
--- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
+++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
@@ -66,6 +66,13 @@  CPU_PW20: cpu-pw20 {
 		};
 	};
 
+	rtc_clk: rtc-clk {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <32768>;
+		clock-output-names = "rtc_clk";
+	};
+
 	sysclk: sysclk {
 		compatible = "fixed-clock";
 		#clock-cells = <0>;
@@ -1186,6 +1193,94 @@  ierb@1f0800000 {
 			reg = <0x01 0xf0800000 0x0 0x10000>;
 		};
 
+		pwm0: pwm@2800000 {
+			compatible = "fsl,vf610-ftm-pwm";
+			#pwm-cells = <3>;
+			reg = <0x0 0x2800000 0x0 0x10000>;
+			clock-names = "ftm_sys", "ftm_ext",
+				      "ftm_fix", "ftm_cnt_clk_en";
+			clocks = <&clockgen 4 1>, <&clockgen 4 1>,
+				 <&rtc_clk>, <&clockgen 4 1>;
+			status = "disabled";
+		};
+
+		pwm1: pwm@2810000 {
+			compatible = "fsl,vf610-ftm-pwm";
+			#pwm-cells = <3>;
+			reg = <0x0 0x2810000 0x0 0x10000>;
+			clock-names = "ftm_sys", "ftm_ext",
+				      "ftm_fix", "ftm_cnt_clk_en";
+			clocks = <&clockgen 4 1>, <&clockgen 4 1>,
+				 <&rtc_clk>, <&clockgen 4 1>;
+			status = "disabled";
+		};
+
+		pwm2: pwm@2820000 {
+			compatible = "fsl,vf610-ftm-pwm";
+			#pwm-cells = <3>;
+			reg = <0x0 0x2820000 0x0 0x10000>;
+			clock-names = "ftm_sys", "ftm_ext",
+				      "ftm_fix", "ftm_cnt_clk_en";
+			clocks = <&clockgen 4 1>, <&clockgen 4 1>,
+				 <&rtc_clk>, <&clockgen 4 1>;
+			status = "disabled";
+		};
+
+		pwm3: pwm@2830000 {
+			compatible = "fsl,vf610-ftm-pwm";
+			#pwm-cells = <3>;
+			reg = <0x0 0x2830000 0x0 0x10000>;
+			clock-names = "ftm_sys", "ftm_ext",
+				      "ftm_fix", "ftm_cnt_clk_en";
+			clocks = <&clockgen 4 1>, <&clockgen 4 1>,
+				 <&rtc_clk>, <&clockgen 4 1>;
+			status = "disabled";
+		};
+
+		pwm4: pwm@2840000 {
+			compatible = "fsl,vf610-ftm-pwm";
+			#pwm-cells = <3>;
+			reg = <0x0 0x2840000 0x0 0x10000>;
+			clock-names = "ftm_sys", "ftm_ext",
+				      "ftm_fix", "ftm_cnt_clk_en";
+			clocks = <&clockgen 4 1>, <&clockgen 4 1>,
+				 <&rtc_clk>, <&clockgen 4 1>;
+			status = "disabled";
+		};
+
+		pwm5: pwm@2850000 {
+			compatible = "fsl,vf610-ftm-pwm";
+			#pwm-cells = <3>;
+			reg = <0x0 0x2850000 0x0 0x10000>;
+			clock-names = "ftm_sys", "ftm_ext",
+				      "ftm_fix", "ftm_cnt_clk_en";
+			clocks = <&clockgen 4 1>, <&clockgen 4 1>,
+				 <&rtc_clk>, <&clockgen 4 1>;
+			status = "disabled";
+		};
+
+		pwm6: pwm@2860000 {
+			compatible = "fsl,vf610-ftm-pwm";
+			#pwm-cells = <3>;
+			reg = <0x0 0x2860000 0x0 0x10000>;
+			clock-names = "ftm_sys", "ftm_ext",
+				      "ftm_fix", "ftm_cnt_clk_en";
+			clocks = <&clockgen 4 1>, <&clockgen 4 1>,
+				 <&rtc_clk>, <&clockgen 4 1>;
+			status = "disabled";
+		};
+
+		pwm7: pwm@2870000 {
+			compatible = "fsl,vf610-ftm-pwm";
+			#pwm-cells = <3>;
+			reg = <0x0 0x2870000 0x0 0x10000>;
+			clock-names = "ftm_sys", "ftm_ext",
+				      "ftm_fix", "ftm_cnt_clk_en";
+			clocks = <&clockgen 4 1>, <&clockgen 4 1>,
+				 <&rtc_clk>, <&clockgen 4 1>;
+			status = "disabled";
+		};
+
 		rcpm: power-controller@1e34040 {
 			compatible = "fsl,ls1028a-rcpm", "fsl,qoriq-rcpm-2.1+";
 			reg = <0x0 0x1e34040 0x0 0x1c>;