From: Richard Cochran <richardcochran@gmail.com>
To: <netdev@vger.kernel.org>
Cc: linux-kernel@vger.kernel.org,
"Ben Hutchings" <ben@decadent.org.uk>,
"Christian Riesch" <christian.riesch@omicron.at>,
"David Miller" <davem@davemloft.net>,
"Stefan Sørensen" <stefan.sorensen@spectralink.com>
Subject: [PATCH net-next v3 9/9] dp83640: let the periodic pin from the module parameter be a default.
Date: Thu, 20 Mar 2014 22:22:00 +0100 [thread overview]
Message-ID: <b2f3bfdd760e42b09b83756f2d7f32194d054174.1395350114.git.richardcochran@gmail.com> (raw)
In-Reply-To: <cover.1395350105.git.richardcochran@gmail.com>
This patch changes the driver use the new pin configuration method when
programming the periodic output signal.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
drivers/net/phy/dp83640.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c
index 93db564..352c5e4 100644
--- a/drivers/net/phy/dp83640.c
+++ b/drivers/net/phy/dp83640.c
@@ -298,15 +298,22 @@ static u64 phy2txts(struct phy_txts *p)
return ns;
}
-static void periodic_output(struct dp83640_clock *clock,
- struct ptp_clock_request *clkreq, bool on)
+static int periodic_output(struct dp83640_clock *clock,
+ struct ptp_clock_request *clkreq, bool on)
{
struct dp83640_private *dp83640 = clock->chosen;
struct phy_device *phydev = dp83640->phydev;
u32 sec, nsec, pwidth;
u16 gpio, ptp_trig, trigger, val;
- gpio = on ? gpio_tab[PEROUT_GPIO] : 0;
+ if (on) {
+ gpio = 1 + ptp_find_pin(clock->ptp_clock, PTP_PF_PEROUT, 0);
+ if (gpio < 1)
+ return -EINVAL;
+ } else {
+ gpio = 0;
+ }
+
trigger = PER_TRIGGER;
ptp_trig = TRIG_WR |
@@ -323,7 +330,7 @@ static void periodic_output(struct dp83640_clock *clock,
ext_write(0, phydev, PAGE5, PTP_TRIG, ptp_trig);
ext_write(0, phydev, PAGE4, PTP_CTL, val);
mutex_unlock(&clock->extreg_lock);
- return;
+ return 0;
}
sec = clkreq->perout.start.sec;
@@ -352,6 +359,7 @@ static void periodic_output(struct dp83640_clock *clock,
ext_write(0, phydev, PAGE4, PTP_CTL, val);
mutex_unlock(&clock->extreg_lock);
+ return 0;
}
/* ptp clock methods */
@@ -484,8 +492,7 @@ static int ptp_dp83640_enable(struct ptp_clock_info *ptp,
case PTP_CLK_REQ_PEROUT:
if (rq->perout.index != 0)
return -EINVAL;
- periodic_output(clock, rq, on);
- return 0;
+ return periodic_output(clock, rq, on);
default:
break;
--
1.7.10.4
next prev parent reply other threads:[~2014-03-20 21:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-20 21:21 [PATCH net-next v3 0/9] ptp: dynamic pin control Richard Cochran
2014-03-20 21:21 ` [PATCH net-next v3 1/9] ptp: introduce programmable pins Richard Cochran
2014-03-20 21:21 ` [PATCH net-next v3 2/9] ptp: add the pin GET/SETFUNC ioctls to the testptp program Richard Cochran
2014-03-20 21:21 ` [PATCH net-next v3 3/9] ptp: expose the programmable pins via sysfs Richard Cochran
2014-03-20 21:21 ` [PATCH net-next v3 4/9] ptp: drivers: set the number of programmable pins Richard Cochran
2014-03-21 8:02 ` Jeff Kirsher
2014-03-20 21:21 ` [PATCH net-next v3 5/9] dp83640: trivial fixes Richard Cochran
2014-03-20 21:21 ` [PATCH net-next v3 6/9] dp83640: correct the periodic output frequency Richard Cochran
2014-03-20 21:21 ` [PATCH net-next v3 7/9] dp83640: implement programmable pin functions Richard Cochran
2014-03-20 21:21 ` [PATCH net-next v3 8/9] dp83640: let external input pins from the module parameters be defaults Richard Cochran
2014-03-20 21:22 ` Richard Cochran [this message]
2014-03-21 18:22 ` [PATCH net-next v3 0/9] ptp: dynamic pin control David Miller
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=b2f3bfdd760e42b09b83756f2d7f32194d054174.1395350114.git.richardcochran@gmail.com \
--to=richardcochran@gmail.com \
--cc=ben@decadent.org.uk \
--cc=christian.riesch@omicron.at \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stefan.sorensen@spectralink.com \
/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
all inboxes | Powered by JetHome®