* [v2, 0/3] Add PTP support for ls1021a platform
@ 2016-02-24  9:26 Yangbo Lu
  2016-02-24  9:26 ` [v2, 1/3] ARM: dts: ls1021a: add 1588 timer node Yangbo Lu
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Yangbo Lu @ 2016-02-24  9:26 UTC (permalink / raw)
  To: netdev
  Cc: Rob Herring, Andy Fleming, Kumar Gala, Claudiu Manoil,
	Richard Cochran, Yangbo Lu
This patchset is to enable ptp support for ls1021a platform. The endianness
issue in gianfar driver and gianfar ptp driver must be fixed, and a 1588
timer node must be added into dts.
Changes for v2:
	- Modified commit message
	- Added more reviewers
Yangbo Lu (3):
  ARM: dts: ls1021a: add 1588 timer node
  gianfar_ptp: replace get_of_u32 with of_property_read_u32
  gianfar: fix endianness for hardware timestamp
 arch/arm/boot/dts/ls1021a.dtsi               | 12 ++++++++++++
 drivers/net/ethernet/freescale/gianfar.c     |  4 ++--
 drivers/net/ethernet/freescale/gianfar_ptp.c | 27 +++++++--------------------
 3 files changed, 21 insertions(+), 22 deletions(-)
-- 
2.1.0.27.g96db324
^ permalink raw reply	[flat|nested] 5+ messages in thread
* [v2, 1/3] ARM: dts: ls1021a: add 1588 timer node
  2016-02-24  9:26 [v2, 0/3] Add PTP support for ls1021a platform Yangbo Lu
@ 2016-02-24  9:26 ` Yangbo Lu
  2016-02-24  9:26 ` [v2, 2/3] gianfar_ptp: replace get_of_u32 with of_property_read_u32 Yangbo Lu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Yangbo Lu @ 2016-02-24  9:26 UTC (permalink / raw)
  To: netdev
  Cc: Rob Herring, Andy Fleming, Kumar Gala, Claudiu Manoil,
	Richard Cochran, Yangbo Lu
Add the 1588 timer node for ls1021a platform to
support gianfar ptp driver.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
Changes for v2:
	- Modified commit message
---
 arch/arm/boot/dts/ls1021a.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff --git a/arch/arm/boot/dts/ls1021a.dtsi b/arch/arm/boot/dts/ls1021a.dtsi
index 2c84ca2..ecf12dc 100644
--- a/arch/arm/boot/dts/ls1021a.dtsi
+++ b/arch/arm/boot/dts/ls1021a.dtsi
@@ -457,6 +457,18 @@
 			reg = <0x0 0x2d24000 0x0 0x4000>;
 		};
 
+		ptp_clock@2d10e00 {
+			compatible = "fsl,etsec-ptp";
+			reg = <0x0 0x2d10e00 0x0 0xb0>;
+			interrupts = <GIC_SPI 173 IRQ_TYPE_LEVEL_HIGH>;
+			fsl,tclk-period = <5>;
+			fsl,tmr-prsc    = <2>;
+			fsl,tmr-add     = <0xaaaaaaab>;
+			fsl,tmr-fiper1  = <999999990>;
+			fsl,tmr-fiper2  = <99990>;
+			fsl,max-adj     = <499999999>;
+		};
+
 		enet0: ethernet@2d10000 {
 			compatible = "fsl,etsec2";
 			device_type = "network";
-- 
2.1.0.27.g96db324
^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [v2, 2/3] gianfar_ptp: replace get_of_u32 with of_property_read_u32
  2016-02-24  9:26 [v2, 0/3] Add PTP support for ls1021a platform Yangbo Lu
  2016-02-24  9:26 ` [v2, 1/3] ARM: dts: ls1021a: add 1588 timer node Yangbo Lu
@ 2016-02-24  9:26 ` Yangbo Lu
  2016-02-24  9:26 ` [v2, 3/3] gianfar: fix endianness for hardware timestamp Yangbo Lu
  2016-02-25 21:22 ` [v2, 0/3] Add PTP support for ls1021a platform David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Yangbo Lu @ 2016-02-24  9:26 UTC (permalink / raw)
  To: netdev
  Cc: Rob Herring, Andy Fleming, Kumar Gala, Claudiu Manoil,
	Richard Cochran, Yangbo Lu
Replace get_of_u32 with standard helper function of_property_read_u32
since the latter can process cpu endianness.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
Changes for v2:
	- Modified commit message
	- Replaced get_of_u32 with of_property_read_u32
---
 drivers/net/ethernet/freescale/gianfar_ptp.c | 33 +++++++++++-----------------
 1 file changed, 13 insertions(+), 20 deletions(-)
diff --git a/drivers/net/ethernet/freescale/gianfar_ptp.c b/drivers/net/ethernet/freescale/gianfar_ptp.c
index b40fba9..5779881 100644
--- a/drivers/net/ethernet/freescale/gianfar_ptp.c
+++ b/drivers/net/ethernet/freescale/gianfar_ptp.c
@@ -422,19 +422,6 @@ static struct ptp_clock_info ptp_gianfar_caps = {
 	.enable		= ptp_gianfar_enable,
 };
 
-/* OF device tree */
-
-static int get_of_u32(struct device_node *node, char *str, u32 *val)
-{
-	int plen;
-	const u32 *prop = of_get_property(node, str, &plen);
-
-	if (!prop || plen != sizeof(*prop))
-		return -1;
-	*val = *prop;
-	return 0;
-}
-
 static int gianfar_ptp_probe(struct platform_device *dev)
 {
 	struct device_node *node = dev->dev.of_node;
@@ -452,15 +439,21 @@ static int gianfar_ptp_probe(struct platform_device *dev)
 
 	etsects->caps = ptp_gianfar_caps;
 
-	if (get_of_u32(node, "fsl,cksel", &etsects->cksel))
+	if (of_property_read_u32(node, "fsl,cksel", &etsects->cksel))
 		etsects->cksel = DEFAULT_CKSEL;
 
-	if (get_of_u32(node, "fsl,tclk-period", &etsects->tclk_period) ||
-	    get_of_u32(node, "fsl,tmr-prsc", &etsects->tmr_prsc) ||
-	    get_of_u32(node, "fsl,tmr-add", &etsects->tmr_add) ||
-	    get_of_u32(node, "fsl,tmr-fiper1", &etsects->tmr_fiper1) ||
-	    get_of_u32(node, "fsl,tmr-fiper2", &etsects->tmr_fiper2) ||
-	    get_of_u32(node, "fsl,max-adj", &etsects->caps.max_adj)) {
+	if (of_property_read_u32(node,
+				 "fsl,tclk-period", &etsects->tclk_period) ||
+	    of_property_read_u32(node,
+				 "fsl,tmr-prsc", &etsects->tmr_prsc) ||
+	    of_property_read_u32(node,
+				 "fsl,tmr-add", &etsects->tmr_add) ||
+	    of_property_read_u32(node,
+				 "fsl,tmr-fiper1", &etsects->tmr_fiper1) ||
+	    of_property_read_u32(node,
+				 "fsl,tmr-fiper2", &etsects->tmr_fiper2) ||
+	    of_property_read_u32(node,
+				 "fsl,max-adj", &etsects->caps.max_adj)) {
 		pr_err("device tree node missing required elements\n");
 		goto no_node;
 	}
-- 
2.1.0.27.g96db324
^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [v2, 3/3] gianfar: fix endianness for hardware timestamp
  2016-02-24  9:26 [v2, 0/3] Add PTP support for ls1021a platform Yangbo Lu
  2016-02-24  9:26 ` [v2, 1/3] ARM: dts: ls1021a: add 1588 timer node Yangbo Lu
  2016-02-24  9:26 ` [v2, 2/3] gianfar_ptp: replace get_of_u32 with of_property_read_u32 Yangbo Lu
@ 2016-02-24  9:26 ` Yangbo Lu
  2016-02-25 21:22 ` [v2, 0/3] Add PTP support for ls1021a platform David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Yangbo Lu @ 2016-02-24  9:26 UTC (permalink / raw)
  To: netdev
  Cc: Rob Herring, Andy Fleming, Kumar Gala, Claudiu Manoil,
	Richard Cochran, Yangbo Lu
Fix endianness for the 64-bit hardware timestamp value with
be64_to_cpu to support both PowerPC platforms and ARM platforms.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
Changes for v2:
	- Modified commit message
	- Handled endianness like ns_to_ktime(be64_to_cpu(*ns))
---
 drivers/net/ethernet/freescale/gianfar.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 2aa7b40..676656c 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -2710,7 +2710,7 @@ static void gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue)
 					  ~0x7UL);
 
 			memset(&shhwtstamps, 0, sizeof(shhwtstamps));
-			shhwtstamps.hwtstamp = ns_to_ktime(*ns);
+			shhwtstamps.hwtstamp = ns_to_ktime(be64_to_cpu(*ns));
 			skb_pull(skb, GMAC_FCB_LEN + GMAC_TXPAL_LEN);
 			skb_tstamp_tx(skb, &shhwtstamps);
 			gfar_clear_txbd_status(bdp);
@@ -3039,7 +3039,7 @@ static void gfar_process_frame(struct net_device *ndev, struct sk_buff *skb)
 		u64 *ns = (u64 *) skb->data;
 
 		memset(shhwtstamps, 0, sizeof(*shhwtstamps));
-		shhwtstamps->hwtstamp = ns_to_ktime(*ns);
+		shhwtstamps->hwtstamp = ns_to_ktime(be64_to_cpu(*ns));
 	}
 
 	if (priv->padding)
-- 
2.1.0.27.g96db324
^ permalink raw reply related	[flat|nested] 5+ messages in thread
* Re: [v2, 0/3] Add PTP support for ls1021a platform
  2016-02-24  9:26 [v2, 0/3] Add PTP support for ls1021a platform Yangbo Lu
                   ` (2 preceding siblings ...)
  2016-02-24  9:26 ` [v2, 3/3] gianfar: fix endianness for hardware timestamp Yangbo Lu
@ 2016-02-25 21:22 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2016-02-25 21:22 UTC (permalink / raw)
  To: yangbo.lu
  Cc: netdev, robh+dt, afleming, galak, claudiu.manoil, richardcochran
From: Yangbo Lu <yangbo.lu@nxp.com>
Date: Wed, 24 Feb 2016 17:26:53 +0800
> This patchset is to enable ptp support for ls1021a platform. The endianness
> issue in gianfar driver and gianfar ptp driver must be fixed, and a 1588
> timer node must be added into dts.
> 
> Changes for v2:
> 	- Modified commit message
> 	- Added more reviewers
Series applied to net-next, thanks.
^ permalink raw reply	[flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-02-25 21:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-24  9:26 [v2, 0/3] Add PTP support for ls1021a platform Yangbo Lu
2016-02-24  9:26 ` [v2, 1/3] ARM: dts: ls1021a: add 1588 timer node Yangbo Lu
2016-02-24  9:26 ` [v2, 2/3] gianfar_ptp: replace get_of_u32 with of_property_read_u32 Yangbo Lu
2016-02-24  9:26 ` [v2, 3/3] gianfar: fix endianness for hardware timestamp Yangbo Lu
2016-02-25 21:22 ` [v2, 0/3] Add PTP support for ls1021a platform David Miller
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).