aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/freescale/fec.h
diff options
context:
space:
mode:
authorFrank Li <Frank.Li@freescale.com>2012-10-30 14:25:31 -0400
committerDavid S. Miller <davem@davemloft.net>2012-11-01 12:28:44 -0400
commit6605b730c061f67c44113391e5af5125d0672e99 (patch)
treef590a2528231b7ca20a9ca32457eb0128e1e107c /drivers/net/ethernet/freescale/fec.h
parentd6e0d9fcbb01edc7a342b15f077a217d46f3b608 (diff)
FEC: Add time stamping code and a PTP hardware clock
This patch adds a driver for the FEC(MX6) that offers time stamping and a PTP haderware clock. Because FEC\ENET(MX6) hardware frequency adjustment is complex, we have implemented this in software by changing the multiplication factor of the timecounter. Signed-off-by: Frank Li <Frank.Li@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/freescale/fec.h')
-rw-r--r--drivers/net/ethernet/freescale/fec.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
index e803812975df..c5a3bc1475c7 100644
--- a/drivers/net/ethernet/freescale/fec.h
+++ b/drivers/net/ethernet/freescale/fec.h
@@ -13,6 +13,12 @@
13#define FEC_H 13#define FEC_H
14/****************************************************************************/ 14/****************************************************************************/
15 15
16#ifdef CONFIG_FEC_PTP
17#include <linux/clocksource.h>
18#include <linux/net_tstamp.h>
19#include <linux/ptp_clock_kernel.h>
20#endif
21
16#if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \ 22#if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
17 defined(CONFIG_M520x) || defined(CONFIG_M532x) || \ 23 defined(CONFIG_M520x) || defined(CONFIG_M532x) || \
18 defined(CONFIG_ARCH_MXC) || defined(CONFIG_SOC_IMX28) 24 defined(CONFIG_ARCH_MXC) || defined(CONFIG_SOC_IMX28)
@@ -88,6 +94,13 @@ struct bufdesc {
88 unsigned short cbd_datlen; /* Data length */ 94 unsigned short cbd_datlen; /* Data length */
89 unsigned short cbd_sc; /* Control and status info */ 95 unsigned short cbd_sc; /* Control and status info */
90 unsigned long cbd_bufaddr; /* Buffer address */ 96 unsigned long cbd_bufaddr; /* Buffer address */
97#ifdef CONFIG_FEC_PTP
98 unsigned long cbd_esc;
99 unsigned long cbd_prot;
100 unsigned long cbd_bdu;
101 unsigned long ts;
102 unsigned short res0[4];
103#endif
91}; 104};
92#else 105#else
93struct bufdesc { 106struct bufdesc {
@@ -190,6 +203,9 @@ struct fec_enet_private {
190 203
191 struct clk *clk_ipg; 204 struct clk *clk_ipg;
192 struct clk *clk_ahb; 205 struct clk *clk_ahb;
206#ifdef CONFIG_FEC_PTP
207 struct clk *clk_ptp;
208#endif
193 209
194 /* The saved address of a sent-in-place packet/buffer, for skfree(). */ 210 /* The saved address of a sent-in-place packet/buffer, for skfree(). */
195 unsigned char *tx_bounce[TX_RING_SIZE]; 211 unsigned char *tx_bounce[TX_RING_SIZE];
@@ -227,7 +243,29 @@ struct fec_enet_private {
227 int full_duplex; 243 int full_duplex;
228 struct completion mdio_done; 244 struct completion mdio_done;
229 int irq[FEC_IRQ_NUM]; 245 int irq[FEC_IRQ_NUM];
246
247#ifdef CONFIG_FEC_PTP
248 struct ptp_clock *ptp_clock;
249 struct ptp_clock_info ptp_caps;
250 unsigned long last_overflow_check;
251 spinlock_t tmreg_lock;
252 struct cyclecounter cc;
253 struct timecounter tc;
254 int rx_hwtstamp_filter;
255 u32 base_incval;
256 u32 cycle_speed;
257 int hwts_rx_en;
258 int hwts_tx_en;
259 struct timer_list time_keep;
260#endif
261
230}; 262};
231 263
264#ifdef CONFIG_FEC_PTP
265void fec_ptp_init(struct net_device *ndev, struct platform_device *pdev);
266void fec_ptp_start_cyclecounter(struct net_device *ndev);
267int fec_ptp_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd);
268#endif
269
232/****************************************************************************/ 270/****************************************************************************/
233#endif /* FEC_H */ 271#endif /* FEC_H */