2015-05-07 03:32:53

by Yangbo Lu

[permalink] [raw]
Subject: [PATCH v2] powerpc/dts: Add and fix 1588 timer node for eTSEC

Add 1588 timer node in files:
arch/powerpc/boot/dts/bsc9131rdb.dtsi
arch/powerpc/boot/dts/bsc9132qds.dtsi
arch/powerpc/boot/dts/p1010rdb.dtsi
arch/powerpc/boot/dts/p1020rdb-pd.dts
arch/powerpc/boot/dts/p1021rdb-pc.dtsi
arch/powerpc/boot/dts/p1022ds.dtsi
arch/powerpc/boot/dts/p1025twr.dtsi
Fix 1588 timer node in file:
arch/powerpc/boot/dts/p2020rdb-pc.dtsi

Signed-off-by: Yangbo Lu <[email protected]>
---
Changes for v2:
- Changed hex value to decimal value in dts
- Modified commit message
- Modified 1588 node in p2020rdb-pc.dtsi
---
arch/powerpc/boot/dts/bsc9131rdb.dtsi | 12 ++++++++++++
arch/powerpc/boot/dts/bsc9132qds.dtsi | 12 ++++++++++++
arch/powerpc/boot/dts/p1010rdb.dtsi | 12 ++++++++++++
arch/powerpc/boot/dts/p1020rdb-pd.dts | 12 ++++++++++++
arch/powerpc/boot/dts/p1021rdb-pc.dtsi | 12 ++++++++++++
arch/powerpc/boot/dts/p1022ds.dtsi | 12 ++++++++++++
arch/powerpc/boot/dts/p1025twr.dtsi | 12 ++++++++++++
arch/powerpc/boot/dts/p2020rdb-pc.dtsi | 12 ++++++------
8 files changed, 90 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/boot/dts/bsc9131rdb.dtsi b/arch/powerpc/boot/dts/bsc9131rdb.dtsi
index 45efcba..a6d533e 100644
--- a/arch/powerpc/boot/dts/bsc9131rdb.dtsi
+++ b/arch/powerpc/boot/dts/bsc9131rdb.dtsi
@@ -80,6 +80,18 @@
status = "disabled";
};

+ ptp_clock@b0e00 {
+ compatible = "fsl,etsec-ptp";
+ reg = <0xb0e00 0xb0>;
+ interrupts = <68 2 0 0 69 2 0 0>;
+ fsl,tclk-period = <5>;
+ fsl,tmr-prsc = <2>;
+ fsl,tmr-add = <3435973837>;
+ fsl,tmr-fiper1 = <999999995>;
+ fsl,tmr-fiper2 = <99990>;
+ fsl,max-adj = <249999999>;
+ };
+
enet0: ethernet@b0000 {
phy-handle = <&phy0>;
phy-connection-type = "rgmii-id";
diff --git a/arch/powerpc/boot/dts/bsc9132qds.dtsi b/arch/powerpc/boot/dts/bsc9132qds.dtsi
index af8e888..ef75804 100644
--- a/arch/powerpc/boot/dts/bsc9132qds.dtsi
+++ b/arch/powerpc/boot/dts/bsc9132qds.dtsi
@@ -87,6 +87,18 @@
};
};

+ ptp_clock@b0e00 {
+ compatible = "fsl,etsec-ptp";
+ reg = <0xb0e00 0xb0>;
+ interrupts = <68 2 0 0 69 2 0 0>;
+ fsl,tclk-period = <5>;
+ fsl,tmr-prsc = <2>;
+ fsl,tmr-add = <3435973837>;
+ fsl,tmr-fiper1 = <999999995>;
+ fsl,tmr-fiper2 = <99990>;
+ fsl,max-adj = <249999999>;
+ };
+
enet0: ethernet@b0000 {
phy-handle = <&phy0>;
tbi-handle = <&tbi0>;
diff --git a/arch/powerpc/boot/dts/p1010rdb.dtsi b/arch/powerpc/boot/dts/p1010rdb.dtsi
index ea534ef..1613678 100644
--- a/arch/powerpc/boot/dts/p1010rdb.dtsi
+++ b/arch/powerpc/boot/dts/p1010rdb.dtsi
@@ -186,6 +186,18 @@
};
};

+ ptp_clock@b0e00 {
+ compatible = "fsl,etsec-ptp";
+ reg = <0xb0e00 0xb0>;
+ interrupts = <68 2 0 0 69 2 0 0>;
+ fsl,tclk-period = <10>;
+ fsl,tmr-prsc = <2>;
+ fsl,tmr-add = <2147483670>;
+ fsl,tmr-fiper1 = <999999990>;
+ fsl,tmr-fiper2 = <99990>;
+ fsl,max-adj = <199999999>;
+ };
+
enet0: ethernet@b0000 {
phy-handle = <&phy0>;
phy-connection-type = "rgmii-id";
diff --git a/arch/powerpc/boot/dts/p1020rdb-pd.dts b/arch/powerpc/boot/dts/p1020rdb-pd.dts
index 987017e..52e8fe8 100644
--- a/arch/powerpc/boot/dts/p1020rdb-pd.dts
+++ b/arch/powerpc/boot/dts/p1020rdb-pd.dts
@@ -225,6 +225,18 @@
};
};

+ ptp_clock@b0e00 {
+ compatible = "fsl,etsec-ptp";
+ reg = <0xb0e00 0xb0>;
+ interrupts = <68 2 0 0 69 2 0 0>;
+ fsl,tclk-period = <10>;
+ fsl,tmr-prsc = <2>;
+ fsl,tmr-add = <2147483670>;
+ fsl,tmr-fiper1 = <999999990>;
+ fsl,tmr-fiper2 = <99990>;
+ fsl,max-adj = <199999999>;
+ };
+
enet0: ethernet@b0000 {
fixed-link = <1 1 1000 0 0>;
phy-connection-type = "rgmii-id";
diff --git a/arch/powerpc/boot/dts/p1021rdb-pc.dtsi b/arch/powerpc/boot/dts/p1021rdb-pc.dtsi
index d6274c5..a29c84a 100644
--- a/arch/powerpc/boot/dts/p1021rdb-pc.dtsi
+++ b/arch/powerpc/boot/dts/p1021rdb-pc.dtsi
@@ -224,6 +224,18 @@
};
};

+ ptp_clock@b0e00 {
+ compatible = "fsl,etsec-ptp";
+ reg = <0xb0e00 0xb0>;
+ interrupts = <68 2 0 0 69 2 0 0>;
+ fsl,tclk-period = <10>;
+ fsl,tmr-prsc = <2>;
+ fsl,tmr-add = <2147483670>;
+ fsl,tmr-fiper1 = <999999990>;
+ fsl,tmr-fiper2 = <99990>;
+ fsl,max-adj = <199999999>;
+ };
+
enet0: ethernet@b0000 {
fixed-link = <1 1 1000 0 0>;
phy-connection-type = "rgmii-id";
diff --git a/arch/powerpc/boot/dts/p1022ds.dtsi b/arch/powerpc/boot/dts/p1022ds.dtsi
index 957e0dc..50f915f 100644
--- a/arch/powerpc/boot/dts/p1022ds.dtsi
+++ b/arch/powerpc/boot/dts/p1022ds.dtsi
@@ -215,6 +215,18 @@
};
};

+ ptp_clock@b0e00 {
+ compatible = "fsl,etsec-ptp";
+ reg = <0xb0e00 0xb0>;
+ interrupts = <68 2 0 0 69 2 0 0>;
+ fsl,tclk-period = <5>;
+ fsl,tmr-prsc = <2>;
+ fsl,tmr-add = <3223239997>;
+ fsl,tmr-fiper1 = <999999995>;
+ fsl,tmr-fiper2 = <99990>;
+ fsl,max-adj = <266499999>;
+ };
+
ethernet@b0000 {
phy-handle = <&phy0>;
phy-connection-type = "rgmii-id";
diff --git a/arch/powerpc/boot/dts/p1025twr.dtsi b/arch/powerpc/boot/dts/p1025twr.dtsi
index 8453501..52a6c7e 100644
--- a/arch/powerpc/boot/dts/p1025twr.dtsi
+++ b/arch/powerpc/boot/dts/p1025twr.dtsi
@@ -138,6 +138,18 @@
};
};

+ ptp_clock@b0e00 {
+ compatible = "fsl,etsec-ptp";
+ reg = <0xb0e00 0xb0>;
+ interrupts = <68 2 0 0 69 2 0 0>;
+ fsl,tclk-period = <10>;
+ fsl,tmr-prsc = <2>;
+ fsl,tmr-add = <3221225505>;
+ fsl,tmr-fiper1 = <999999990>;
+ fsl,tmr-fiper2 = <99990>;
+ fsl,max-adj = <133333332>;
+ };
+
enet0: ethernet@b0000 {
phy-handle = <&phy0>;
phy-connection-type = "rgmii-id";
diff --git a/arch/powerpc/boot/dts/p2020rdb-pc.dtsi b/arch/powerpc/boot/dts/p2020rdb-pc.dtsi
index c21d1c7..363172d 100644
--- a/arch/powerpc/boot/dts/p2020rdb-pc.dtsi
+++ b/arch/powerpc/boot/dts/p2020rdb-pc.dtsi
@@ -215,12 +215,12 @@
};

ptp_clock@24e00 {
- fsl,tclk-period = <5>;
- fsl,tmr-prsc = <200>;
- fsl,tmr-add = <0xCCCCCCCD>;
- fsl,tmr-fiper1 = <0x3B9AC9FB>;
- fsl,tmr-fiper2 = <0x0001869B>;
- fsl,max-adj = <249999999>;
+ fsl,tclk-period = <5>;
+ fsl,tmr-prsc = <2>;
+ fsl,tmr-add = <2863311531>;
+ fsl,tmr-fiper1 = <999999995>;
+ fsl,tmr-fiper2 = <99990>;
+ fsl,max-adj = <299999999>;
};

enet0: ethernet@24000 {
--
2.1.0.27.g96db324


2015-07-16 20:53:59

by Scott Wood

[permalink] [raw]
Subject: Re: [PATCH v2] powerpc/dts: Add and fix 1588 timer node for eTSEC

On Wed, 2015-07-15 at 21:37 -0500, Lu Yangbo-B47093 wrote:
> Any comments?
> Thanks.

Sorry, I must have missed this on my last time through the patch queue. I
see you've decimalized the fiper and max-adj properties, which is good... but
does it really make sense for tmr-add? I'm not familiar with what this value
represents, but the numbers look more natural as hex (e.g. 0xaaaaaaab versus
2863311531).

> > diff --git a/arch/powerpc/boot/dts/p2020rdb-pc.dtsi
> > b/arch/powerpc/boot/dts/p2020rdb-pc.dtsi
> > index c21d1c7..363172d 100644
> > --- a/arch/powerpc/boot/dts/p2020rdb-pc.dtsi
> > +++ b/arch/powerpc/boot/dts/p2020rdb-pc.dtsi
> > @@ -215,12 +215,12 @@
> > };
> >
> > ptp_clock@24e00{
> > - fsl,tclk-period = <5>;
> > - fsl,tmr-prsc = <200>;
> > - fsl,tmr-add = <0xCCCCCCCD>;
> > - fsl,tmr-fiper1 = <0x3B9AC9FB>;
> > - fsl,tmr-fiper2 = <0x0001869B>;
> > - fsl,max-adj = <249999999>;
> > + fsl,tclk-period = <5>;
> > + fsl,tmr-prsc = <2>;
> > + fsl,tmr-add = <2863311531>;
> > + fsl,tmr-fiper1 = <999999995>;
> > + fsl,tmr-fiper2 = <99990>;
> > + fsl,max-adj = <299999999>;
> > };

And here, you're changing the value of fsl,tmr-add and fsl,max-adj. Why?

-Scott

2015-07-24 15:07:53

by Scott Wood

[permalink] [raw]
Subject: Re: [PATCH v2] powerpc/dts: Add and fix 1588 timer node for eTSEC

On Mon, 2015-07-20 at 01:33 -0500, Lu Yangbo-B47093 wrote:
> > On Wed, 2015-07-15 at 21:37 -0500, Lu Yangbo-B47093 wrote:
> > > Any comments?
> > > Thanks.
> >
> > Sorry, I must have missed this on my last time through the patch queue.
> > I see you've decimalized the fiper and max-adj properties, which is
> > good... but does it really make sense for tmr-add? I'm not familiar with
> > what this value represents, but the numbers look more natural as hex (e.g.
> > 0xaaaaaaab versus 2863311531).
>
> Yes, the fiper value would be writed into fiper registers. And max-adj
> value would be used in ptp driver in driver/ptp/.
> But you insisted that values should be in decimalism in the v1 patch... :)
>
> See the history :)

I didn't insist on decimals for *everything*, just where it makes sense, and
that "it goes in a register" doesn't *automatically* mean that it doesn't
make sense.

################# history ##################
> > > + ptp_clock@b0e00{
> > > + compatible = "fsl,etsec-ptp";
> > > + reg = <0xb0e00 0xb0>;
> > > + interrupts = <68 2 0 0 69 2 0 0>;
> > > + fsl,tclk-period = <5>;
> > > + fsl,tmr-prsc = <2>;
> > > + fsl,tmr-add = <0xcccccccd>;
> > > + fsl,tmr-fiper1 = <0x3b9ac9fb>;
> > > + fsl,tmr-fiper2 = <0x00018696>;
> > > + fsl,max-adj = <249999999>;
> >
> > Please don't use hex for numbers that make more sense as decimal.
> > [Lu Yangbo-B47093] The hex value is register value, I think it's better
> > to use hex.
>
> Whether it goes into a register doesn't matter. Hex values are useful for
> values which are subdivided into various bitfields, or whose hex
> representation is simpler than decimal. I'm not familiar with the details
> of this hardware, but I doubt the former is the case for 0x3b9ac9fb ==
> 9999999995 or 0x18696 == 99990.
>
> -Scott
> ######################################
>
>
> >
> > > > diff --git a/arch/powerpc/boot/dts/p2020rdb-pc.dtsi
> > > > b/arch/powerpc/boot/dts/p2020rdb-pc.dtsi
> > > > index c21d1c7..363172d 100644
> > > > --- a/arch/powerpc/boot/dts/p2020rdb-pc.dtsi
> > > > +++ b/arch/powerpc/boot/dts/p2020rdb-pc.dtsi
> > > > @@ -215,12 +215,12 @@
> > > > };
> > > >
> > > > ptp_clock@24e00{
> > > > - fsl,tclk-period = <5>;
> > > > - fsl,tmr-prsc = <200>;
> > > > - fsl,tmr-add = <0xCCCCCCCD>;
> > > > - fsl,tmr-fiper1 = <0x3B9AC9FB>;
> > > > - fsl,tmr-fiper2 = <0x0001869B>;
> > > > - fsl,max-adj = <249999999>;
> > > > + fsl,tclk-period = <5>;
> > > > + fsl,tmr-prsc = <2>;
> > > > + fsl,tmr-add = <2863311531>;
> > > > + fsl,tmr-fiper1 = <999999995>;
> > > > + fsl,tmr-fiper2 = <99990>;
> > > > + fsl,max-adj = <299999999>;
> > > > };
> >
> > And here, you're changing the value of fsl,tmr-add and fsl,max-adj. Why?
>
> The old values maybe not calculated base on the default eTSEC system clock
> value.
> 1588 timer couldn’t be adjusted correctly by old values.

Explain in the changelog what was wrong with the old values (don't just say
"Fix 1588 timer node in file").

-Scott