Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jonathan Lemon <jonathan.lemon@gmail.com>
To: davem@davemloft.net, kuba@kernel.org, richardcochran@gmail.com
Cc: netdev@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH net-next 2/6] ptp: ocp: Add the mapping for the external PPS registers.
Date: Thu,  5 Aug 2021 12:52:44 -0700	[thread overview]
Message-ID: <20210805195248.35665-3-jonathan.lemon@gmail.com> (raw)
In-Reply-To: <20210805195248.35665-1-jonathan.lemon@gmail.com>

There are two PPS blocks: one handles the external PPS signal output,
with the other handling the PPS signal input to the internal clock.
Add controls for the external PPS block.

Rename the fields so they match their function.

Add cable_delay to the register definitions.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
---
 drivers/ptp/ptp_ocp.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
index 261713c6e9a7..8804e79477cd 100644
--- a/drivers/ptp/ptp_ocp.c
+++ b/drivers/ptp/ptp_ocp.c
@@ -113,6 +113,8 @@ struct ts_reg {
 struct pps_reg {
 	u32	ctrl;
 	u32	status;
+	u32	__pad0[6];
+	u32	cable_delay;
 };
 
 #define PPS_STATUS_FILTER_ERR	BIT(0)
@@ -149,7 +151,8 @@ struct ptp_ocp {
 	spinlock_t		lock;
 	struct ocp_reg __iomem	*reg;
 	struct tod_reg __iomem	*tod;
-	struct pps_reg __iomem	*pps_monitor;
+	struct pps_reg __iomem	*pps_to_ext;
+	struct pps_reg __iomem	*pps_to_clk;
 	struct ptp_ocp_ext_src	*pps;
 	struct ptp_ocp_ext_src	*ts0;
 	struct ptp_ocp_ext_src	*ts1;
@@ -251,7 +254,11 @@ static struct ocp_resource ocp_fb_resource[] = {
 		},
 	},
 	{
-		OCP_MEM_RESOURCE(pps_monitor),
+		OCP_MEM_RESOURCE(pps_to_ext),
+		.offset = 0x01030000, .size = 0x10000,
+	},
+	{
+		OCP_MEM_RESOURCE(pps_to_clk),
 		.offset = 0x01040000, .size = 0x10000,
 	},
 	{
@@ -537,10 +544,10 @@ ptp_ocp_watchdog(struct timer_list *t)
 	unsigned long flags;
 	u32 status;
 
-	status = ioread32(&bp->pps_monitor->status);
+	status = ioread32(&bp->pps_to_clk->status);
 
 	if (status & PPS_STATUS_SUPERV_ERR) {
-		iowrite32(status, &bp->pps_monitor->status);
+		iowrite32(status, &bp->pps_to_clk->status);
 		if (!bp->gps_lost) {
 			spin_lock_irqsave(&bp->lock, flags);
 			__ptp_ocp_clear_drift_locked(bp);
-- 
2.31.1


  parent reply	other threads:[~2021-08-05 19:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-05 19:52 [PATCH net-next 0/6] ptp: ocp: assorted fixes Jonathan Lemon
2021-08-05 19:52 ` [PATCH net-next 1/6] ptp: ocp: Fix the error handling path for the class device Jonathan Lemon
2021-08-05 19:52 ` Jonathan Lemon [this message]
2021-08-05 19:52 ` [PATCH net-next 3/6] ptp: ocp: Remove devlink health and unused parameters Jonathan Lemon
2021-08-05 19:52 ` [PATCH net-next 4/6] ptp: ocp: Use 'gnss' naming instead of 'gps' Jonathan Lemon
2021-08-05 19:52 ` [PATCH net-next 5/6] ptp: ocp: Rename version string shown by devlink Jonathan Lemon
2021-08-05 19:52 ` [PATCH net-next 6/6] ptp: ocp: Remove pending_image indicator from devlink Jonathan Lemon
2021-08-06 10:00 ` [PATCH net-next 0/6] ptp: ocp: assorted fixes patchwork-bot+netdevbpf

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=20210805195248.35665-3-jonathan.lemon@gmail.com \
    --to=jonathan.lemon@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kernel-team@fb.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    --subject='Re: [PATCH net-next 2/6] ptp: ocp: Add the mapping for the external PPS registers.' \
    /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

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).