From: Krzysztof Halasa <khc@pm.waw.pl>
To: Richard Cochran <richardcochran@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org,
netdev@vger.kernel.org, Alan Cox <alan@lxorguk.ukuu.org.uk>,
Arnd Bergmann <arnd@arndb.de>, Christoph Lameter <cl@linux.com>,
David Miller <davem@davemloft.net>,
John Stultz <johnstul@us.ibm.com>,
Peter Zijlstra <peterz@infradead.org>,
Rodolfo Giometti <giometti@linux.it>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH V8 12/13] ptp: Added a clock driver for the IXP46x.
Date: Thu, 06 Jan 2011 22:01:59 +0100 [thread overview]
Message-ID: <m3ei8plpa0.fsf@intrepid.localdomain> (raw)
In-Reply-To: <8151196c018776704df34748f333bdb159497d0b.1293820862.git.richard.cochran@omicron.at> (Richard Cochran's message of "Fri, 31 Dec 2010 20:17:23 +0100")
Richard Cochran <richardcochran@gmail.com> writes:
> +struct ixp46x_channel_ctl {
> + u32 Ch_Control; /* 0x40 Time Synchronization Channel Control */
> + u32 Ch_Event; /* 0x44 Time Synchronization Channel Event */
> + u32 TxSnapLo; /* 0x48 Transmit Snapshot Low Register */
> + u32 TxSnapHi; /* 0x4C Transmit Snapshot High Register */
> + u32 RxSnapLo; /* 0x50 Receive Snapshot Low Register */
> + u32 RxSnapHi; /* 0x54 Receive Snapshot High Register */
> + u32 SrcUUIDLo; /* 0x58 Source UUID0 Low Register */
> + u32 SrcUUIDHi; /* 0x5C Sequence Identifier/Source UUID0 High */
I don't like these XxxYyyZzz either :-(
> +static void do_tx_timestamp(struct port *port, struct sk_buff *skb)
> +{
> +#ifdef __ARMEB__
> + struct skb_shared_hwtstamps shhwtstamps;
> + struct ixp46x_ts_regs *regs;
> + struct skb_shared_info *shtx;
> + u64 ns;
> + u32 ch, cnt, hi, lo, val;
> +
> + shtx = skb_shinfo(skb);
> + if (unlikely(shtx->tx_flags & SKBTX_HW_TSTAMP && port->hwts_tx_en))
> + shtx->tx_flags |= SKBTX_IN_PROGRESS;
> + else
> + return;
> +
> + ch = PORT2CHANNEL(port);
> +
> + regs = (struct ixp46x_ts_regs __iomem *) IXP4XX_TIMESYNC_BASE_VIRT;
> +
> + /*
> + * This really stinks, but we have to poll for the Tx time stamp.
> + * Usually, the time stamp is ready after 4 to 6 microseconds.
> + */
> + for (cnt = 0; cnt < 100; cnt++) {
> + val = __raw_readl(®s->channel[ch].Ch_Event);
> + if (val & TX_SNAPSHOT_LOCKED)
> + break;
> + udelay(1);
> + }
> + if (!(val & TX_SNAPSHOT_LOCKED)) {
> + shtx->tx_flags &= ~SKBTX_IN_PROGRESS;
> + return;
> + }
> +
> + lo = __raw_readl(®s->channel[ch].TxSnapLo);
> + hi = __raw_readl(®s->channel[ch].TxSnapHi);
> + ns = ((u64) hi) << 32;
> + ns |= lo;
> + ns <<= TICKS_NS_SHIFT;
> +
> + memset(&shhwtstamps, 0, sizeof(shhwtstamps));
> + shhwtstamps.hwtstamp = ns_to_ktime(ns);
> + skb_tstamp_tx(skb, &shhwtstamps);
> +
> + __raw_writel(TX_SNAPSHOT_LOCKED, ®s->channel[ch].Ch_Event);
> +#endif
> +}
And what if we're little-endian? Why does it depend on BE?
> @@ -1171,6 +1357,11 @@ static int __devinit eth_init_one(struct platform_device *pdev)
> char phy_id[MII_BUS_ID_SIZE + 3];
> int err;
>
> + if (ptp_filter_init(ptp_filter, ARRAY_SIZE(ptp_filter))) {
> + pr_err("ixp4xx_eth: bad ptp filter\n");
> + return -EINVAL;
> + }
> +
> if (!(dev = alloc_etherdev(sizeof(struct port))))
> return -ENOMEM;
Shouldn't it depend on CPU type?
BTW which CPU is required? IXP46x (455/460/465)? Does it work on 43x?
> + if (NO_IRQ == irq)
> + return NO_IRQ;
Don't like these either :-(
Not showstoppers but...
Also I don't like the ixp_read/ixp_write() trivial macros. Why not
simply call __raw_readl() and __raw_writel()?
--
Krzysztof Halasa
next prev parent reply other threads:[~2011-01-06 21:01 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-31 19:11 [PATCH V8 00/13] ptp: IEEE 1588 hardware clock support Richard Cochran
2010-12-31 19:13 ` [PATCH V8 03/13] posix clocks: introduce a syscall for clock tuning Richard Cochran
2010-12-31 19:14 ` [PATCH V8 05/13] posix_clocks: add clock_adjtime for blackfin Richard Cochran
2010-12-31 19:14 ` [PATCH V8 06/13] posix_clocks: add clock_adjtime for powerpc Richard Cochran
2010-12-31 19:14 ` [PATCH V8 07/13] posix_clocks: add clock_adjtime for x86 Richard Cochran
2010-12-31 19:16 ` [PATCH V8 10/13] ptp: Added a brand new class driver for ptp clocks Richard Cochran
[not found] ` <cover.1293820862.git.richard.cochran-3mrvs1K0uXizZXS1Dc/lvw@public.gmane.org>
2010-12-31 19:12 ` [PATCH V8 01/13] time: Introduce timekeeping_inject_offset John Stultz
[not found] ` <15a12892b0bfc17327d2b3a7695c81fbe6f34337.1293820862.git.richard.cochran-3mrvs1K0uXizZXS1Dc/lvw@public.gmane.org>
2011-01-06 22:00 ` Arnd Bergmann
2010-12-31 19:12 ` [PATCH V8 02/13] ntp: add ADJ_SETOFFSET mode bit Richard Cochran
[not found] ` <fe2bec763bec155381d62721aa9da84aeca2785c.1293820862.git.richard.cochran-3mrvs1K0uXizZXS1Dc/lvw@public.gmane.org>
2011-01-01 20:38 ` Kuwahara,T.
[not found] ` <AANLkTini2WdT-1v4k9V3JOZYDkA59P+SyscTe8-fK2Wk-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-01-08 17:50 ` Richard Cochran
[not found] ` <20110108175028.GA22308-7KxsofuKt4IfAd9E5cN8NEzG7cXyKsk/@public.gmane.org>
2011-01-09 21:07 ` Kuwahara,T.
[not found] ` <AANLkTikigXGSACF6R6kfNHyKZ7GFWrUrCMxygvL3fUC6-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-01-10 7:17 ` Richard Cochran
[not found] ` <20110110071759.GA4864-7KxsofuKt4IfAd9E5cN8NEzG7cXyKsk/@public.gmane.org>
2011-01-10 20:47 ` Kuwahara,T.
2011-01-10 21:11 ` john stultz
2011-01-11 11:09 ` Richard Cochran
2011-01-10 16:49 ` john stultz
2011-01-10 20:45 ` Kuwahara,T.
[not found] ` <AANLkTikdg4Pb5c4wcCU3d3Eku=mpiW_TEkBz0A2VPdVp-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-01-10 21:06 ` john stultz
2011-01-11 20:32 ` Kuwahara,T.
[not found] ` <AANLkTik+2udoJ6JyZMhkd1yhr2W9hSWO_vD_zdm+BoOG-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-01-11 20:55 ` john stultz
2011-01-12 20:39 ` Kuwahara,T.
[not found] ` <AANLkTikYuYwb4BLsU3BF_=d9fAdcfb0AC2itDBeyFsNq-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-01-12 20:55 ` john stultz
2011-01-10 7:22 ` Richard Cochran
2010-12-31 19:13 ` [PATCH V8 04/13] posix_clocks: add clock_adjtime for arm Richard Cochran
2010-12-31 19:15 ` [PATCH V8 08/13] posix clocks: cleanup the CLOCK_DISPTACH macro Richard Cochran
2011-01-03 9:29 ` Peter Zijlstra
2011-01-03 11:51 ` Richard Cochran
[not found] ` <503cd1fa268867573001cfc9bb5681ee3b5b32fa.1293820862.git.richard.cochran-3mrvs1K0uXizZXS1Dc/lvw@public.gmane.org>
2011-01-11 12:57 ` Thomas Gleixner
[not found] ` <alpine.LFD.2.00.1101111224280.12146-bi+AKbBUZKagILUCTcTcHdKyNwTtLsGr@public.gmane.org>
2011-01-12 7:37 ` Richard Cochran
[not found] ` <20110112073728.GA2935-7KxsofuKt4IfAd9E5cN8NEzG7cXyKsk/@public.gmane.org>
2011-01-12 11:16 ` Thomas Gleixner
2011-01-12 12:17 ` Richard Cochran
2011-01-13 4:30 ` Richard Cochran
[not found] ` <20110113043037.GA17726-7KxsofuKt4IfAd9E5cN8NEzG7cXyKsk/@public.gmane.org>
2011-01-13 11:25 ` Thomas Gleixner
2010-12-31 19:15 ` [PATCH V8 09/13] posix clocks: introduce dynamic clocks Richard Cochran
[not found] ` <c28004fc5d121c1dd5f842550663fc9d6f55a114.1293820862.git.richard.cochran-3mrvs1K0uXizZXS1Dc/lvw@public.gmane.org>
2011-01-06 19:56 ` Arnd Bergmann
2011-01-07 16:41 ` Richard Cochran
2010-12-31 19:16 ` [PATCH V8 11/13] ptp: Added a clock that uses the eTSEC found on the MPC85xx Richard Cochran
2010-12-31 19:17 ` [PATCH V8 12/13] ptp: Added a clock driver for the IXP46x Richard Cochran
2011-01-06 21:01 ` Krzysztof Halasa [this message]
[not found] ` <m3ei8plpa0.fsf-gTjgKJgtlHj77SC2UrCW1FMQynFLKtET@public.gmane.org>
2011-01-07 17:07 ` Richard Cochran
[not found] ` <20110107170752.GB8666-7KxsofuKt4IfAd9E5cN8NEzG7cXyKsk/@public.gmane.org>
2011-01-08 16:25 ` Krzysztof Halasa
2011-01-10 20:24 ` Krzysztof Halasa
2010-12-31 19:17 ` [PATCH V8 13/13] ptp: Added a clock driver for the National Semiconductor PHYTER 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=m3ei8plpa0.fsf@intrepid.localdomain \
--to=khc@pm.waw.pl \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=arnd@arndb.de \
--cc=cl@linux.com \
--cc=davem@davemloft.net \
--cc=giometti@linux.it \
--cc=johnstul@us.ibm.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=richardcochran@gmail.com \
--cc=tglx@linutronix.de \
/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).