netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luwei Zhou <b45643@freescale.com>
To: <davem@davemloft.net>, <richardcochran@gmail.com>
Cc: <netdev@vger.kernel.org>, <shawn.guo@linaro.org>,
	<bhutchings@solarflare.com>, <R49496@freescale.com>,
	<b38611@freescale.com>, <b20596@freescale.com>,
	<stephen@networkplumber.org>
Subject: [PATCH v2 3/4] ptp: Add PTP_PF_PPS enumeration to ptp_pin_function.
Date: Sun, 28 Sep 2014 12:20:10 +0800	[thread overview]
Message-ID: <1411878011-21767-4-git-send-email-b45643@freescale.com> (raw)
In-Reply-To: <1411878011-21767-1-git-send-email-b45643@freescale.com>

PTP_PIN_SET/GETFUNC interface can be used to specify the channel index
when multi-channel timer is used to ouput PPS. Need to add PPS corresponding
pin function enumeration in the ptp.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
---
 drivers/ptp/ptp_chardev.c        | 8 ++++++++
 include/linux/ptp_clock_kernel.h | 2 ++
 include/uapi/linux/ptp_clock.h   | 1 +
 3 files changed, 11 insertions(+)

diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
index f8a7609..a746e5a 100644
--- a/drivers/ptp/ptp_chardev.c
+++ b/drivers/ptp/ptp_chardev.c
@@ -48,6 +48,10 @@ static int ptp_disable_pinfunc(struct ptp_clock_info *ops,
 		break;
 	case PTP_PF_PHYSYNC:
 		break;
+	case PTP_PF_PPS:
+		rq.type = PTP_CLK_REQ_PPS;
+		err = ops->enable(ops, &rq, 0);
+		break;
 	default:
 		return -EINVAL;
 	}
@@ -85,6 +89,10 @@ int ptp_set_pinfunc(struct ptp_clock *ptp, unsigned int pin,
 		if (chan >= info->n_per_out)
 			return -EINVAL;
 		break;
+	case PTP_PF_PPS:
+		if (chan >= info->n_pps_chan)
+			return -EINVAL;
+		break;
 	case PTP_PF_PHYSYNC:
 		if (chan != 0)
 			return -EINVAL;
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h
index 0d8ff3f..2a5ad1c 100644
--- a/include/linux/ptp_clock_kernel.h
+++ b/include/linux/ptp_clock_kernel.h
@@ -49,6 +49,7 @@ struct ptp_clock_request {
  * @n_alarm:   The number of programmable alarms.
  * @n_ext_ts:  The number of external time stamp channels.
  * @n_per_out: The number of programmable periodic signals.
+ * @n_pps_chan: The number of programmable channles for pps output.
  * @n_pins:    The number of programmable pins.
  * @pps:       Indicates whether the clock supports a PPS callback.
  * @pin_config: Array of length 'n_pins'. If the number of
@@ -99,6 +100,7 @@ struct ptp_clock_info {
 	int n_alarm;
 	int n_ext_ts;
 	int n_per_out;
+	int n_pps_chan;
 	int n_pins;
 	int pps;
 	struct ptp_pin_desc *pin_config;
diff --git a/include/uapi/linux/ptp_clock.h b/include/uapi/linux/ptp_clock.h
index f0b7bfe..57ba7e7 100644
--- a/include/uapi/linux/ptp_clock.h
+++ b/include/uapi/linux/ptp_clock.h
@@ -86,6 +86,7 @@ enum ptp_pin_function {
 	PTP_PF_EXTTS,
 	PTP_PF_PEROUT,
 	PTP_PF_PHYSYNC,
+	PTP_PF_PPS,
 };
 
 struct ptp_pin_desc {
-- 
1.9.1

  parent reply	other threads:[~2014-09-28  5:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-28  4:20 [PATCH v2 0/4] net: fec: ptp: Add FEC PPS ouput support Luwei Zhou
2014-09-28  4:20 ` [PATCH v2 1/4] net: fec: ptp: Use the 31-bit ptp timer Luwei Zhou
2014-09-28  4:20 ` [PATCH v2 2/4] net: fec: ptp: Use hardware algorithm to adjust PTP counter Luwei Zhou
2014-09-29  2:13   ` fugang.duan
2014-09-28  4:20 ` Luwei Zhou [this message]
2014-09-29  8:56   ` [PATCH v2 3/4] ptp: Add PTP_PF_PPS enumeration to ptp_pin_function Richard Cochran
2014-09-29  9:38     ` luwei.zhou
2014-09-29 13:25       ` Richard Cochran
2014-09-28  4:20 ` [PATCH v2 4/4] net: fec: ptp: Enalbe PPS ouput based on ptp clock Luwei Zhou

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=1411878011-21767-4-git-send-email-b45643@freescale.com \
    --to=b45643@freescale.com \
    --cc=R49496@freescale.com \
    --cc=b20596@freescale.com \
    --cc=b38611@freescale.com \
    --cc=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    --cc=shawn.guo@linaro.org \
    --cc=stephen@networkplumber.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 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).