1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0-only
2*4882a593Smuzhiyun /* drivers/atm/idt77105.c - IDT77105 (PHY) driver */
3*4882a593Smuzhiyun
4*4882a593Smuzhiyun /* Written 1999 by Greg Banks, NEC Australia <gnb@linuxfan.com>. Based on suni.c */
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun
7*4882a593Smuzhiyun #include <linux/module.h>
8*4882a593Smuzhiyun #include <linux/kernel.h>
9*4882a593Smuzhiyun #include <linux/mm.h>
10*4882a593Smuzhiyun #include <linux/errno.h>
11*4882a593Smuzhiyun #include <linux/atmdev.h>
12*4882a593Smuzhiyun #include <linux/sonet.h>
13*4882a593Smuzhiyun #include <linux/delay.h>
14*4882a593Smuzhiyun #include <linux/timer.h>
15*4882a593Smuzhiyun #include <linux/init.h>
16*4882a593Smuzhiyun #include <linux/capability.h>
17*4882a593Smuzhiyun #include <linux/atm_idt77105.h>
18*4882a593Smuzhiyun #include <linux/spinlock.h>
19*4882a593Smuzhiyun #include <linux/slab.h>
20*4882a593Smuzhiyun #include <asm/param.h>
21*4882a593Smuzhiyun #include <linux/uaccess.h>
22*4882a593Smuzhiyun
23*4882a593Smuzhiyun #include "idt77105.h"
24*4882a593Smuzhiyun
25*4882a593Smuzhiyun #undef GENERAL_DEBUG
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun #ifdef GENERAL_DEBUG
28*4882a593Smuzhiyun #define DPRINTK(format,args...) printk(KERN_DEBUG format,##args)
29*4882a593Smuzhiyun #else
30*4882a593Smuzhiyun #define DPRINTK(format,args...)
31*4882a593Smuzhiyun #endif
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun struct idt77105_priv {
35*4882a593Smuzhiyun struct idt77105_stats stats; /* link diagnostics */
36*4882a593Smuzhiyun struct atm_dev *dev; /* device back-pointer */
37*4882a593Smuzhiyun struct idt77105_priv *next;
38*4882a593Smuzhiyun int loop_mode;
39*4882a593Smuzhiyun unsigned char old_mcr; /* storage of MCR reg while signal lost */
40*4882a593Smuzhiyun };
41*4882a593Smuzhiyun
42*4882a593Smuzhiyun static DEFINE_SPINLOCK(idt77105_priv_lock);
43*4882a593Smuzhiyun
44*4882a593Smuzhiyun #define PRIV(dev) ((struct idt77105_priv *) dev->phy_data)
45*4882a593Smuzhiyun
46*4882a593Smuzhiyun #define PUT(val,reg) dev->ops->phy_put(dev,val,IDT77105_##reg)
47*4882a593Smuzhiyun #define GET(reg) dev->ops->phy_get(dev,IDT77105_##reg)
48*4882a593Smuzhiyun
49*4882a593Smuzhiyun static void idt77105_stats_timer_func(struct timer_list *);
50*4882a593Smuzhiyun static void idt77105_restart_timer_func(struct timer_list *);
51*4882a593Smuzhiyun
52*4882a593Smuzhiyun
53*4882a593Smuzhiyun static DEFINE_TIMER(stats_timer, idt77105_stats_timer_func);
54*4882a593Smuzhiyun static DEFINE_TIMER(restart_timer, idt77105_restart_timer_func);
55*4882a593Smuzhiyun static int start_timer = 1;
56*4882a593Smuzhiyun static struct idt77105_priv *idt77105_all = NULL;
57*4882a593Smuzhiyun
58*4882a593Smuzhiyun /*
59*4882a593Smuzhiyun * Retrieve the value of one of the IDT77105's counters.
60*4882a593Smuzhiyun * `counter' is one of the IDT77105_CTRSEL_* constants.
61*4882a593Smuzhiyun */
get_counter(struct atm_dev * dev,int counter)62*4882a593Smuzhiyun static u16 get_counter(struct atm_dev *dev, int counter)
63*4882a593Smuzhiyun {
64*4882a593Smuzhiyun u16 val;
65*4882a593Smuzhiyun
66*4882a593Smuzhiyun /* write the counter bit into PHY register 6 */
67*4882a593Smuzhiyun PUT(counter, CTRSEL);
68*4882a593Smuzhiyun /* read the low 8 bits from register 4 */
69*4882a593Smuzhiyun val = GET(CTRLO);
70*4882a593Smuzhiyun /* read the high 8 bits from register 5 */
71*4882a593Smuzhiyun val |= GET(CTRHI)<<8;
72*4882a593Smuzhiyun
73*4882a593Smuzhiyun return val;
74*4882a593Smuzhiyun }
75*4882a593Smuzhiyun
76*4882a593Smuzhiyun /*
77*4882a593Smuzhiyun * Timer function called every second to gather statistics
78*4882a593Smuzhiyun * from the 77105. This is done because the h/w registers
79*4882a593Smuzhiyun * will overflow if not read at least once per second. The
80*4882a593Smuzhiyun * kernel's stats are much higher precision. Also, having
81*4882a593Smuzhiyun * a separate copy of the stats allows implementation of
82*4882a593Smuzhiyun * an ioctl which gathers the stats *without* zero'ing them.
83*4882a593Smuzhiyun */
idt77105_stats_timer_func(struct timer_list * unused)84*4882a593Smuzhiyun static void idt77105_stats_timer_func(struct timer_list *unused)
85*4882a593Smuzhiyun {
86*4882a593Smuzhiyun struct idt77105_priv *walk;
87*4882a593Smuzhiyun struct atm_dev *dev;
88*4882a593Smuzhiyun struct idt77105_stats *stats;
89*4882a593Smuzhiyun
90*4882a593Smuzhiyun DPRINTK("IDT77105 gathering statistics\n");
91*4882a593Smuzhiyun for (walk = idt77105_all; walk; walk = walk->next) {
92*4882a593Smuzhiyun dev = walk->dev;
93*4882a593Smuzhiyun
94*4882a593Smuzhiyun stats = &walk->stats;
95*4882a593Smuzhiyun stats->symbol_errors += get_counter(dev, IDT77105_CTRSEL_SEC);
96*4882a593Smuzhiyun stats->tx_cells += get_counter(dev, IDT77105_CTRSEL_TCC);
97*4882a593Smuzhiyun stats->rx_cells += get_counter(dev, IDT77105_CTRSEL_RCC);
98*4882a593Smuzhiyun stats->rx_hec_errors += get_counter(dev, IDT77105_CTRSEL_RHEC);
99*4882a593Smuzhiyun }
100*4882a593Smuzhiyun if (!start_timer) mod_timer(&stats_timer,jiffies+IDT77105_STATS_TIMER_PERIOD);
101*4882a593Smuzhiyun }
102*4882a593Smuzhiyun
103*4882a593Smuzhiyun
104*4882a593Smuzhiyun /*
105*4882a593Smuzhiyun * A separate timer func which handles restarting PHY chips which
106*4882a593Smuzhiyun * have had the cable re-inserted after being pulled out. This is
107*4882a593Smuzhiyun * done by polling the Good Signal Bit in the Interrupt Status
108*4882a593Smuzhiyun * register every 5 seconds. The other technique (checking Good
109*4882a593Smuzhiyun * Signal Bit in the interrupt handler) cannot be used because PHY
110*4882a593Smuzhiyun * interrupts need to be disabled when the cable is pulled out
111*4882a593Smuzhiyun * to avoid lots of spurious cell error interrupts.
112*4882a593Smuzhiyun */
idt77105_restart_timer_func(struct timer_list * unused)113*4882a593Smuzhiyun static void idt77105_restart_timer_func(struct timer_list *unused)
114*4882a593Smuzhiyun {
115*4882a593Smuzhiyun struct idt77105_priv *walk;
116*4882a593Smuzhiyun struct atm_dev *dev;
117*4882a593Smuzhiyun unsigned char istat;
118*4882a593Smuzhiyun
119*4882a593Smuzhiyun DPRINTK("IDT77105 checking for cable re-insertion\n");
120*4882a593Smuzhiyun for (walk = idt77105_all; walk; walk = walk->next) {
121*4882a593Smuzhiyun dev = walk->dev;
122*4882a593Smuzhiyun
123*4882a593Smuzhiyun if (dev->signal != ATM_PHY_SIG_LOST)
124*4882a593Smuzhiyun continue;
125*4882a593Smuzhiyun
126*4882a593Smuzhiyun istat = GET(ISTAT); /* side effect: clears all interrupt status bits */
127*4882a593Smuzhiyun if (istat & IDT77105_ISTAT_GOODSIG) {
128*4882a593Smuzhiyun /* Found signal again */
129*4882a593Smuzhiyun atm_dev_signal_change(dev, ATM_PHY_SIG_FOUND);
130*4882a593Smuzhiyun printk(KERN_NOTICE "%s(itf %d): signal detected again\n",
131*4882a593Smuzhiyun dev->type,dev->number);
132*4882a593Smuzhiyun /* flush the receive FIFO */
133*4882a593Smuzhiyun PUT( GET(DIAG) | IDT77105_DIAG_RFLUSH, DIAG);
134*4882a593Smuzhiyun /* re-enable interrupts */
135*4882a593Smuzhiyun PUT( walk->old_mcr ,MCR);
136*4882a593Smuzhiyun }
137*4882a593Smuzhiyun }
138*4882a593Smuzhiyun if (!start_timer) mod_timer(&restart_timer,jiffies+IDT77105_RESTART_TIMER_PERIOD);
139*4882a593Smuzhiyun }
140*4882a593Smuzhiyun
141*4882a593Smuzhiyun
fetch_stats(struct atm_dev * dev,struct idt77105_stats __user * arg,int zero)142*4882a593Smuzhiyun static int fetch_stats(struct atm_dev *dev,struct idt77105_stats __user *arg,int zero)
143*4882a593Smuzhiyun {
144*4882a593Smuzhiyun unsigned long flags;
145*4882a593Smuzhiyun struct idt77105_stats stats;
146*4882a593Smuzhiyun
147*4882a593Smuzhiyun spin_lock_irqsave(&idt77105_priv_lock, flags);
148*4882a593Smuzhiyun memcpy(&stats, &PRIV(dev)->stats, sizeof(struct idt77105_stats));
149*4882a593Smuzhiyun if (zero)
150*4882a593Smuzhiyun memset(&PRIV(dev)->stats, 0, sizeof(struct idt77105_stats));
151*4882a593Smuzhiyun spin_unlock_irqrestore(&idt77105_priv_lock, flags);
152*4882a593Smuzhiyun if (arg == NULL)
153*4882a593Smuzhiyun return 0;
154*4882a593Smuzhiyun return copy_to_user(arg, &stats,
155*4882a593Smuzhiyun sizeof(struct idt77105_stats)) ? -EFAULT : 0;
156*4882a593Smuzhiyun }
157*4882a593Smuzhiyun
158*4882a593Smuzhiyun
set_loopback(struct atm_dev * dev,int mode)159*4882a593Smuzhiyun static int set_loopback(struct atm_dev *dev,int mode)
160*4882a593Smuzhiyun {
161*4882a593Smuzhiyun int diag;
162*4882a593Smuzhiyun
163*4882a593Smuzhiyun diag = GET(DIAG) & ~IDT77105_DIAG_LCMASK;
164*4882a593Smuzhiyun switch (mode) {
165*4882a593Smuzhiyun case ATM_LM_NONE:
166*4882a593Smuzhiyun break;
167*4882a593Smuzhiyun case ATM_LM_LOC_ATM:
168*4882a593Smuzhiyun diag |= IDT77105_DIAG_LC_PHY_LOOPBACK;
169*4882a593Smuzhiyun break;
170*4882a593Smuzhiyun case ATM_LM_RMT_ATM:
171*4882a593Smuzhiyun diag |= IDT77105_DIAG_LC_LINE_LOOPBACK;
172*4882a593Smuzhiyun break;
173*4882a593Smuzhiyun default:
174*4882a593Smuzhiyun return -EINVAL;
175*4882a593Smuzhiyun }
176*4882a593Smuzhiyun PUT(diag,DIAG);
177*4882a593Smuzhiyun printk(KERN_NOTICE "%s(%d) Loopback mode is: %s\n", dev->type,
178*4882a593Smuzhiyun dev->number,
179*4882a593Smuzhiyun (mode == ATM_LM_NONE ? "NONE" :
180*4882a593Smuzhiyun (mode == ATM_LM_LOC_ATM ? "DIAG (local)" :
181*4882a593Smuzhiyun (mode == IDT77105_DIAG_LC_LINE_LOOPBACK ? "LOOP (remote)" :
182*4882a593Smuzhiyun "unknown")))
183*4882a593Smuzhiyun );
184*4882a593Smuzhiyun PRIV(dev)->loop_mode = mode;
185*4882a593Smuzhiyun return 0;
186*4882a593Smuzhiyun }
187*4882a593Smuzhiyun
188*4882a593Smuzhiyun
idt77105_ioctl(struct atm_dev * dev,unsigned int cmd,void __user * arg)189*4882a593Smuzhiyun static int idt77105_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg)
190*4882a593Smuzhiyun {
191*4882a593Smuzhiyun printk(KERN_NOTICE "%s(%d) idt77105_ioctl() called\n",dev->type,dev->number);
192*4882a593Smuzhiyun switch (cmd) {
193*4882a593Smuzhiyun case IDT77105_GETSTATZ:
194*4882a593Smuzhiyun if (!capable(CAP_NET_ADMIN)) return -EPERM;
195*4882a593Smuzhiyun fallthrough;
196*4882a593Smuzhiyun case IDT77105_GETSTAT:
197*4882a593Smuzhiyun return fetch_stats(dev, arg, cmd == IDT77105_GETSTATZ);
198*4882a593Smuzhiyun case ATM_SETLOOP:
199*4882a593Smuzhiyun return set_loopback(dev,(int)(unsigned long) arg);
200*4882a593Smuzhiyun case ATM_GETLOOP:
201*4882a593Smuzhiyun return put_user(PRIV(dev)->loop_mode,(int __user *)arg) ?
202*4882a593Smuzhiyun -EFAULT : 0;
203*4882a593Smuzhiyun case ATM_QUERYLOOP:
204*4882a593Smuzhiyun return put_user(ATM_LM_LOC_ATM | ATM_LM_RMT_ATM,
205*4882a593Smuzhiyun (int __user *) arg) ? -EFAULT : 0;
206*4882a593Smuzhiyun default:
207*4882a593Smuzhiyun return -ENOIOCTLCMD;
208*4882a593Smuzhiyun }
209*4882a593Smuzhiyun }
210*4882a593Smuzhiyun
211*4882a593Smuzhiyun
212*4882a593Smuzhiyun
idt77105_int(struct atm_dev * dev)213*4882a593Smuzhiyun static void idt77105_int(struct atm_dev *dev)
214*4882a593Smuzhiyun {
215*4882a593Smuzhiyun unsigned char istat;
216*4882a593Smuzhiyun
217*4882a593Smuzhiyun istat = GET(ISTAT); /* side effect: clears all interrupt status bits */
218*4882a593Smuzhiyun
219*4882a593Smuzhiyun DPRINTK("IDT77105 generated an interrupt, istat=%02x\n", (unsigned)istat);
220*4882a593Smuzhiyun
221*4882a593Smuzhiyun if (istat & IDT77105_ISTAT_RSCC) {
222*4882a593Smuzhiyun /* Rx Signal Condition Change - line went up or down */
223*4882a593Smuzhiyun if (istat & IDT77105_ISTAT_GOODSIG) { /* signal detected again */
224*4882a593Smuzhiyun /* This should not happen (restart timer does it) but JIC */
225*4882a593Smuzhiyun atm_dev_signal_change(dev, ATM_PHY_SIG_FOUND);
226*4882a593Smuzhiyun } else { /* signal lost */
227*4882a593Smuzhiyun /*
228*4882a593Smuzhiyun * Disable interrupts and stop all transmission and
229*4882a593Smuzhiyun * reception - the restart timer will restore these.
230*4882a593Smuzhiyun */
231*4882a593Smuzhiyun PRIV(dev)->old_mcr = GET(MCR);
232*4882a593Smuzhiyun PUT(
233*4882a593Smuzhiyun (PRIV(dev)->old_mcr|
234*4882a593Smuzhiyun IDT77105_MCR_DREC|
235*4882a593Smuzhiyun IDT77105_MCR_DRIC|
236*4882a593Smuzhiyun IDT77105_MCR_HALTTX
237*4882a593Smuzhiyun ) & ~IDT77105_MCR_EIP, MCR);
238*4882a593Smuzhiyun atm_dev_signal_change(dev, ATM_PHY_SIG_LOST);
239*4882a593Smuzhiyun printk(KERN_NOTICE "%s(itf %d): signal lost\n",
240*4882a593Smuzhiyun dev->type,dev->number);
241*4882a593Smuzhiyun }
242*4882a593Smuzhiyun }
243*4882a593Smuzhiyun
244*4882a593Smuzhiyun if (istat & IDT77105_ISTAT_RFO) {
245*4882a593Smuzhiyun /* Rx FIFO Overrun -- perform a FIFO flush */
246*4882a593Smuzhiyun PUT( GET(DIAG) | IDT77105_DIAG_RFLUSH, DIAG);
247*4882a593Smuzhiyun printk(KERN_NOTICE "%s(itf %d): receive FIFO overrun\n",
248*4882a593Smuzhiyun dev->type,dev->number);
249*4882a593Smuzhiyun }
250*4882a593Smuzhiyun #ifdef GENERAL_DEBUG
251*4882a593Smuzhiyun if (istat & (IDT77105_ISTAT_HECERR | IDT77105_ISTAT_SCR |
252*4882a593Smuzhiyun IDT77105_ISTAT_RSE)) {
253*4882a593Smuzhiyun /* normally don't care - just report in stats */
254*4882a593Smuzhiyun printk(KERN_NOTICE "%s(itf %d): received cell with error\n",
255*4882a593Smuzhiyun dev->type,dev->number);
256*4882a593Smuzhiyun }
257*4882a593Smuzhiyun #endif
258*4882a593Smuzhiyun }
259*4882a593Smuzhiyun
260*4882a593Smuzhiyun
idt77105_start(struct atm_dev * dev)261*4882a593Smuzhiyun static int idt77105_start(struct atm_dev *dev)
262*4882a593Smuzhiyun {
263*4882a593Smuzhiyun unsigned long flags;
264*4882a593Smuzhiyun
265*4882a593Smuzhiyun if (!(dev->phy_data = kmalloc(sizeof(struct idt77105_priv),GFP_KERNEL)))
266*4882a593Smuzhiyun return -ENOMEM;
267*4882a593Smuzhiyun PRIV(dev)->dev = dev;
268*4882a593Smuzhiyun spin_lock_irqsave(&idt77105_priv_lock, flags);
269*4882a593Smuzhiyun PRIV(dev)->next = idt77105_all;
270*4882a593Smuzhiyun idt77105_all = PRIV(dev);
271*4882a593Smuzhiyun spin_unlock_irqrestore(&idt77105_priv_lock, flags);
272*4882a593Smuzhiyun memset(&PRIV(dev)->stats,0,sizeof(struct idt77105_stats));
273*4882a593Smuzhiyun
274*4882a593Smuzhiyun /* initialise dev->signal from Good Signal Bit */
275*4882a593Smuzhiyun atm_dev_signal_change(dev,
276*4882a593Smuzhiyun GET(ISTAT) & IDT77105_ISTAT_GOODSIG ?
277*4882a593Smuzhiyun ATM_PHY_SIG_FOUND : ATM_PHY_SIG_LOST);
278*4882a593Smuzhiyun if (dev->signal == ATM_PHY_SIG_LOST)
279*4882a593Smuzhiyun printk(KERN_WARNING "%s(itf %d): no signal\n",dev->type,
280*4882a593Smuzhiyun dev->number);
281*4882a593Smuzhiyun
282*4882a593Smuzhiyun /* initialise loop mode from hardware */
283*4882a593Smuzhiyun switch ( GET(DIAG) & IDT77105_DIAG_LCMASK ) {
284*4882a593Smuzhiyun case IDT77105_DIAG_LC_NORMAL:
285*4882a593Smuzhiyun PRIV(dev)->loop_mode = ATM_LM_NONE;
286*4882a593Smuzhiyun break;
287*4882a593Smuzhiyun case IDT77105_DIAG_LC_PHY_LOOPBACK:
288*4882a593Smuzhiyun PRIV(dev)->loop_mode = ATM_LM_LOC_ATM;
289*4882a593Smuzhiyun break;
290*4882a593Smuzhiyun case IDT77105_DIAG_LC_LINE_LOOPBACK:
291*4882a593Smuzhiyun PRIV(dev)->loop_mode = ATM_LM_RMT_ATM;
292*4882a593Smuzhiyun break;
293*4882a593Smuzhiyun }
294*4882a593Smuzhiyun
295*4882a593Smuzhiyun /* enable interrupts, e.g. on loss of signal */
296*4882a593Smuzhiyun PRIV(dev)->old_mcr = GET(MCR);
297*4882a593Smuzhiyun if (dev->signal == ATM_PHY_SIG_FOUND) {
298*4882a593Smuzhiyun PRIV(dev)->old_mcr |= IDT77105_MCR_EIP;
299*4882a593Smuzhiyun PUT(PRIV(dev)->old_mcr, MCR);
300*4882a593Smuzhiyun }
301*4882a593Smuzhiyun
302*4882a593Smuzhiyun
303*4882a593Smuzhiyun idt77105_stats_timer_func(0); /* clear 77105 counters */
304*4882a593Smuzhiyun (void) fetch_stats(dev,NULL,1); /* clear kernel counters */
305*4882a593Smuzhiyun
306*4882a593Smuzhiyun spin_lock_irqsave(&idt77105_priv_lock, flags);
307*4882a593Smuzhiyun if (start_timer) {
308*4882a593Smuzhiyun start_timer = 0;
309*4882a593Smuzhiyun
310*4882a593Smuzhiyun stats_timer.expires = jiffies+IDT77105_STATS_TIMER_PERIOD;
311*4882a593Smuzhiyun add_timer(&stats_timer);
312*4882a593Smuzhiyun
313*4882a593Smuzhiyun restart_timer.expires = jiffies+IDT77105_RESTART_TIMER_PERIOD;
314*4882a593Smuzhiyun add_timer(&restart_timer);
315*4882a593Smuzhiyun }
316*4882a593Smuzhiyun spin_unlock_irqrestore(&idt77105_priv_lock, flags);
317*4882a593Smuzhiyun return 0;
318*4882a593Smuzhiyun }
319*4882a593Smuzhiyun
320*4882a593Smuzhiyun
idt77105_stop(struct atm_dev * dev)321*4882a593Smuzhiyun static int idt77105_stop(struct atm_dev *dev)
322*4882a593Smuzhiyun {
323*4882a593Smuzhiyun struct idt77105_priv *walk, *prev;
324*4882a593Smuzhiyun
325*4882a593Smuzhiyun DPRINTK("%s(itf %d): stopping IDT77105\n",dev->type,dev->number);
326*4882a593Smuzhiyun
327*4882a593Smuzhiyun /* disable interrupts */
328*4882a593Smuzhiyun PUT( GET(MCR) & ~IDT77105_MCR_EIP, MCR );
329*4882a593Smuzhiyun
330*4882a593Smuzhiyun /* detach private struct from atm_dev & free */
331*4882a593Smuzhiyun for (prev = NULL, walk = idt77105_all ;
332*4882a593Smuzhiyun walk != NULL;
333*4882a593Smuzhiyun prev = walk, walk = walk->next) {
334*4882a593Smuzhiyun if (walk->dev == dev) {
335*4882a593Smuzhiyun if (prev != NULL)
336*4882a593Smuzhiyun prev->next = walk->next;
337*4882a593Smuzhiyun else
338*4882a593Smuzhiyun idt77105_all = walk->next;
339*4882a593Smuzhiyun dev->phy = NULL;
340*4882a593Smuzhiyun dev->phy_data = NULL;
341*4882a593Smuzhiyun kfree(walk);
342*4882a593Smuzhiyun break;
343*4882a593Smuzhiyun }
344*4882a593Smuzhiyun }
345*4882a593Smuzhiyun
346*4882a593Smuzhiyun return 0;
347*4882a593Smuzhiyun }
348*4882a593Smuzhiyun
349*4882a593Smuzhiyun
350*4882a593Smuzhiyun static const struct atmphy_ops idt77105_ops = {
351*4882a593Smuzhiyun .start = idt77105_start,
352*4882a593Smuzhiyun .ioctl = idt77105_ioctl,
353*4882a593Smuzhiyun .interrupt = idt77105_int,
354*4882a593Smuzhiyun .stop = idt77105_stop,
355*4882a593Smuzhiyun };
356*4882a593Smuzhiyun
357*4882a593Smuzhiyun
idt77105_init(struct atm_dev * dev)358*4882a593Smuzhiyun int idt77105_init(struct atm_dev *dev)
359*4882a593Smuzhiyun {
360*4882a593Smuzhiyun dev->phy = &idt77105_ops;
361*4882a593Smuzhiyun return 0;
362*4882a593Smuzhiyun }
363*4882a593Smuzhiyun
364*4882a593Smuzhiyun EXPORT_SYMBOL(idt77105_init);
365*4882a593Smuzhiyun
idt77105_exit(void)366*4882a593Smuzhiyun static void __exit idt77105_exit(void)
367*4882a593Smuzhiyun {
368*4882a593Smuzhiyun /* turn off timers */
369*4882a593Smuzhiyun del_timer_sync(&stats_timer);
370*4882a593Smuzhiyun del_timer_sync(&restart_timer);
371*4882a593Smuzhiyun }
372*4882a593Smuzhiyun
373*4882a593Smuzhiyun module_exit(idt77105_exit);
374*4882a593Smuzhiyun
375*4882a593Smuzhiyun MODULE_LICENSE("GPL");
376