cpts.h (e5451c8f8330e03ad3cfa16048b4daf961af434f) cpts.h (c8395d4e1d4ffbc9d8aa61f534c82e8deed72cfd)
1/*
2 * TI Common Platform Time Sync
3 *
4 * Copyright (C) 2012 Richard Cochran <richardcochran@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 97 unchanged lines hidden (view full) ---

106 u32 high;
107 u32 low;
108};
109
110struct cpts {
111 struct cpsw_cpts __iomem *reg;
112 int tx_enable;
113 int rx_enable;
1/*
2 * TI Common Platform Time Sync
3 *
4 * Copyright (C) 2012 Richard Cochran <richardcochran@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 97 unchanged lines hidden (view full) ---

106 u32 high;
107 u32 low;
108};
109
110struct cpts {
111 struct cpsw_cpts __iomem *reg;
112 int tx_enable;
113 int rx_enable;
114#ifdef CONFIG_TI_CPTS
114#if IS_ENABLED(CONFIG_TI_CPTS)
115 struct ptp_clock_info info;
116 struct ptp_clock *clock;
117 spinlock_t lock; /* protects time registers */
118 u32 cc_mult; /* for the nominal frequency */
119 struct cyclecounter cc;
120 struct timecounter tc;
121 struct delayed_work overflow_work;
122 int phc_index;
123 struct clk *refclk;
124 struct list_head events;
125 struct list_head pool;
126 struct cpts_event pool_data[CPTS_MAX_EVENTS];
127#endif
128};
129
115 struct ptp_clock_info info;
116 struct ptp_clock *clock;
117 spinlock_t lock; /* protects time registers */
118 u32 cc_mult; /* for the nominal frequency */
119 struct cyclecounter cc;
120 struct timecounter tc;
121 struct delayed_work overflow_work;
122 int phc_index;
123 struct clk *refclk;
124 struct list_head events;
125 struct list_head pool;
126 struct cpts_event pool_data[CPTS_MAX_EVENTS];
127#endif
128};
129
130#ifdef CONFIG_TI_CPTS
130#if IS_ENABLED(CONFIG_TI_CPTS)
131void cpts_rx_timestamp(struct cpts *cpts, struct sk_buff *skb);
132void cpts_tx_timestamp(struct cpts *cpts, struct sk_buff *skb);
131void cpts_rx_timestamp(struct cpts *cpts, struct sk_buff *skb);
132void cpts_tx_timestamp(struct cpts *cpts, struct sk_buff *skb);
133int cpts_register(struct device *dev, struct cpts *cpts, u32 mult, u32 shift);
134void cpts_unregister(struct cpts *cpts);
133#else
134static inline void cpts_rx_timestamp(struct cpts *cpts, struct sk_buff *skb)
135{
136}
137static inline void cpts_tx_timestamp(struct cpts *cpts, struct sk_buff *skb)
138{
139}
135#else
136static inline void cpts_rx_timestamp(struct cpts *cpts, struct sk_buff *skb)
137{
138}
139static inline void cpts_tx_timestamp(struct cpts *cpts, struct sk_buff *skb)
140{
141}
142
143static inline int
144cpts_register(struct device *dev, struct cpts *cpts, u32 mult, u32 shift)
145{
146 return 0;
147}
148
149static inline void cpts_unregister(struct cpts *cpts)
150{
151}
140#endif
141
152#endif
153
142int cpts_register(struct device *dev, struct cpts *cpts, u32 mult, u32 shift);
143void cpts_unregister(struct cpts *cpts);
144
145#endif
154
155#endif