From: Richard Cochran <richardcochran@gmail.com>
To: <netdev@vger.kernel.org>
Cc: linux-kernel@vger.kernel.org,
"Ben Hutchings" <bhutchings@solarflare.com>,
"Christian Riesch" <christian.riesch@omicron.at>,
"David Miller" <davem@davemloft.net>,
"Stefan Sørensen" <stefan.sorensen@spectralink.com>
Subject: [PATCH RFC net-next v1 6/9] dp83640: correct the periodic output frequency
Date: Sat, 8 Mar 2014 20:42:06 +0100 [thread overview]
Message-ID: <b04f6f7600709b522c32ed6e6edabd011373a4d0.1394307304.git.richardcochran@gmail.com> (raw)
In-Reply-To: <cover.1394307303.git.richardcochran@gmail.com>
The phyter driver incorrectly feeds the value of the period into what
is in fact a pulse width register, resulting in the actual period
being twice the dialed value. This patch fixes the issue and renames a
variable to make the code at bit more clear.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
drivers/net/phy/dp83640.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c
index d6c1061..9e26555 100644
--- a/drivers/net/phy/dp83640.c
+++ b/drivers/net/phy/dp83640.c
@@ -271,7 +271,7 @@ static void periodic_output(struct dp83640_clock *clock,
{
struct dp83640_private *dp83640 = clock->chosen;
struct phy_device *phydev = dp83640->phydev;
- u32 sec, nsec, period;
+ u32 sec, nsec, pwidth;
u16 gpio, ptp_trig, trigger, val;
gpio = on ? gpio_tab[PEROUT_GPIO] : 0;
@@ -296,8 +296,9 @@ static void periodic_output(struct dp83640_clock *clock,
sec = clkreq->perout.start.sec;
nsec = clkreq->perout.start.nsec;
- period = clkreq->perout.period.sec * 1000000000UL;
- period += clkreq->perout.period.nsec;
+ pwidth = clkreq->perout.period.sec * 1000000000UL;
+ pwidth += clkreq->perout.period.nsec;
+ pwidth /= 2;
mutex_lock(&clock->extreg_lock);
@@ -310,8 +311,8 @@ static void periodic_output(struct dp83640_clock *clock,
ext_write(0, phydev, PAGE4, PTP_TDR, nsec >> 16); /* ns[31:16] */
ext_write(0, phydev, PAGE4, PTP_TDR, sec & 0xffff); /* sec[15:0] */
ext_write(0, phydev, PAGE4, PTP_TDR, sec >> 16); /* sec[31:16] */
- ext_write(0, phydev, PAGE4, PTP_TDR, period & 0xffff); /* ns[15:0] */
- ext_write(0, phydev, PAGE4, PTP_TDR, period >> 16); /* ns[31:16] */
+ ext_write(0, phydev, PAGE4, PTP_TDR, pwidth & 0xffff); /* ns[15:0] */
+ ext_write(0, phydev, PAGE4, PTP_TDR, pwidth >> 16); /* ns[31:16] */
/*enable trigger*/
val &= ~TRIG_LOAD;
--
1.7.10.4
next prev parent reply other threads:[~2014-03-08 19:42 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-08 19:42 [PATCH RFC net-next v1 0/9] ptp: dynamic pin control Richard Cochran
2014-03-08 19:42 ` [PATCH RFC net-next v1 1/9] ptp: introduce programmable pins Richard Cochran
2014-03-10 12:53 ` Sørensen, Stefan
2014-03-10 13:32 ` Richard Cochran
2014-03-11 7:58 ` Christian Riesch
2014-03-11 10:08 ` Richard Cochran
2014-03-08 19:42 ` [PATCH RFC net-next v1 2/9] ptp: add the pin GET/SETFUNC ioctls to the testptp program Richard Cochran
2014-03-08 19:42 ` [PATCH RFC net-next v1 3/9] ptp: expose the programmable pins via sysfs Richard Cochran
2014-03-08 19:42 ` [PATCH RFC net-next v1 4/9] ptp: drivers: set the number of programmable pins Richard Cochran
2014-03-08 19:42 ` [PATCH RFC net-next v1 5/9] dp83640: trivial fixes Richard Cochran
2014-03-08 19:42 ` Richard Cochran [this message]
2014-03-08 19:42 ` [PATCH RFC net-next v1 7/9] dp83640: implement programmable pin functions Richard Cochran
2014-03-08 19:42 ` [PATCH RFC net-next v1 8/9] dp83640: let external input pins from the module parameters be defaults Richard Cochran
2014-03-08 19:42 ` [PATCH RFC net-next v1 9/9] dp83640: let the periodic pin from the module parameter be a default Richard Cochran
2014-03-10 12:52 ` [PATCH RFC net-next v1 0/9] ptp: dynamic pin control Sørensen, Stefan
2014-03-10 13:42 ` Richard Cochran
2014-03-12 6:58 ` Christian Riesch
2014-03-12 14:22 ` Richard Cochran
2014-03-10 14:05 ` Richard Cochran
2014-03-12 8:21 ` Christian Riesch
2014-03-12 14:46 ` Richard Cochran
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=b04f6f7600709b522c32ed6e6edabd011373a4d0.1394307304.git.richardcochran@gmail.com \
--to=richardcochran@gmail.com \
--cc=bhutchings@solarflare.com \
--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;
as well as URLs for NNTP newsgroup(s).