Lines Matching +full:loss +full:- +full:of +full:- +full:signal
1 // SPDX-License-Identifier: GPL-2.0-only
2 /* drivers/atm/idt77105.c - IDT77105 (PHY) driver */
36 struct atm_dev *dev; /* device back-pointer */
39 unsigned char old_mcr; /* storage of MCR reg while signal lost */
44 #define PRIV(dev) ((struct idt77105_priv *) dev->phy_data)
46 #define PUT(val,reg) dev->ops->phy_put(dev,val,IDT77105_##reg)
47 #define GET(reg) dev->ops->phy_get(dev,IDT77105_##reg)
59 * Retrieve the value of one of the IDT77105's counters.
60 * `counter' is one of the IDT77105_CTRSEL_* constants.
81 * a separate copy of the stats allows implementation of
91 for (walk = idt77105_all; walk; walk = walk->next) { in idt77105_stats_timer_func()
92 dev = walk->dev; in idt77105_stats_timer_func()
94 stats = &walk->stats; in idt77105_stats_timer_func()
95 stats->symbol_errors += get_counter(dev, IDT77105_CTRSEL_SEC); in idt77105_stats_timer_func()
96 stats->tx_cells += get_counter(dev, IDT77105_CTRSEL_TCC); in idt77105_stats_timer_func()
97 stats->rx_cells += get_counter(dev, IDT77105_CTRSEL_RCC); in idt77105_stats_timer_func()
98 stats->rx_hec_errors += get_counter(dev, IDT77105_CTRSEL_RHEC); in idt77105_stats_timer_func()
106 * have had the cable re-inserted after being pulled out. This is
107 * done by polling the Good Signal Bit in the Interrupt Status
109 * Signal Bit in the interrupt handler) cannot be used because PHY
111 * to avoid lots of spurious cell error interrupts.
119 DPRINTK("IDT77105 checking for cable re-insertion\n"); in idt77105_restart_timer_func()
120 for (walk = idt77105_all; walk; walk = walk->next) { in idt77105_restart_timer_func()
121 dev = walk->dev; in idt77105_restart_timer_func()
123 if (dev->signal != ATM_PHY_SIG_LOST) in idt77105_restart_timer_func()
128 /* Found signal again */ in idt77105_restart_timer_func()
130 printk(KERN_NOTICE "%s(itf %d): signal detected again\n", in idt77105_restart_timer_func()
131 dev->type,dev->number); in idt77105_restart_timer_func()
134 /* re-enable interrupts */ in idt77105_restart_timer_func()
135 PUT( walk->old_mcr ,MCR); in idt77105_restart_timer_func()
148 memcpy(&stats, &PRIV(dev)->stats, sizeof(struct idt77105_stats)); in fetch_stats()
150 memset(&PRIV(dev)->stats, 0, sizeof(struct idt77105_stats)); in fetch_stats()
155 sizeof(struct idt77105_stats)) ? -EFAULT : 0; in fetch_stats()
174 return -EINVAL; in set_loopback()
177 printk(KERN_NOTICE "%s(%d) Loopback mode is: %s\n", dev->type, in set_loopback()
178 dev->number, in set_loopback()
184 PRIV(dev)->loop_mode = mode; in set_loopback()
191 printk(KERN_NOTICE "%s(%d) idt77105_ioctl() called\n",dev->type,dev->number); in idt77105_ioctl()
194 if (!capable(CAP_NET_ADMIN)) return -EPERM; in idt77105_ioctl()
201 return put_user(PRIV(dev)->loop_mode,(int __user *)arg) ? in idt77105_ioctl()
202 -EFAULT : 0; in idt77105_ioctl()
205 (int __user *) arg) ? -EFAULT : 0; in idt77105_ioctl()
207 return -ENOIOCTLCMD; in idt77105_ioctl()
222 /* Rx Signal Condition Change - line went up or down */ in idt77105_int()
223 if (istat & IDT77105_ISTAT_GOODSIG) { /* signal detected again */ in idt77105_int()
226 } else { /* signal lost */ in idt77105_int()
229 * reception - the restart timer will restore these. in idt77105_int()
231 PRIV(dev)->old_mcr = GET(MCR); in idt77105_int()
233 (PRIV(dev)->old_mcr| in idt77105_int()
239 printk(KERN_NOTICE "%s(itf %d): signal lost\n", in idt77105_int()
240 dev->type,dev->number); in idt77105_int()
245 /* Rx FIFO Overrun -- perform a FIFO flush */ in idt77105_int()
248 dev->type,dev->number); in idt77105_int()
253 /* normally don't care - just report in stats */ in idt77105_int()
255 dev->type,dev->number); in idt77105_int()
265 if (!(dev->phy_data = kmalloc(sizeof(struct idt77105_priv),GFP_KERNEL))) in idt77105_start()
266 return -ENOMEM; in idt77105_start()
267 PRIV(dev)->dev = dev; in idt77105_start()
269 PRIV(dev)->next = idt77105_all; in idt77105_start()
272 memset(&PRIV(dev)->stats,0,sizeof(struct idt77105_stats)); in idt77105_start()
274 /* initialise dev->signal from Good Signal Bit */ in idt77105_start()
278 if (dev->signal == ATM_PHY_SIG_LOST) in idt77105_start()
279 printk(KERN_WARNING "%s(itf %d): no signal\n",dev->type, in idt77105_start()
280 dev->number); in idt77105_start()
285 PRIV(dev)->loop_mode = ATM_LM_NONE; in idt77105_start()
288 PRIV(dev)->loop_mode = ATM_LM_LOC_ATM; in idt77105_start()
291 PRIV(dev)->loop_mode = ATM_LM_RMT_ATM; in idt77105_start()
295 /* enable interrupts, e.g. on loss of signal */ in idt77105_start()
296 PRIV(dev)->old_mcr = GET(MCR); in idt77105_start()
297 if (dev->signal == ATM_PHY_SIG_FOUND) { in idt77105_start()
298 PRIV(dev)->old_mcr |= IDT77105_MCR_EIP; in idt77105_start()
299 PUT(PRIV(dev)->old_mcr, MCR); in idt77105_start()
325 DPRINTK("%s(itf %d): stopping IDT77105\n",dev->type,dev->number); in idt77105_stop()
333 prev = walk, walk = walk->next) { in idt77105_stop()
334 if (walk->dev == dev) { in idt77105_stop()
336 prev->next = walk->next; in idt77105_stop()
338 idt77105_all = walk->next; in idt77105_stop()
339 dev->phy = NULL; in idt77105_stop()
340 dev->phy_data = NULL; in idt77105_stop()
360 dev->phy = &idt77105_ops; in idt77105_init()