162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/* drivers/atm/idt77105.h - IDT77105 (PHY) declarations */
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci/* Written 1999 by Greg Banks, NEC Australia <gnb@linuxfan.com>. Based on suni.h */
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#ifndef DRIVER_ATM_IDT77105_H
862306a36Sopenharmony_ci#define DRIVER_ATM_IDT77105_H
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#include <linux/atmdev.h>
1162306a36Sopenharmony_ci#include <linux/atmioc.h>
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci/* IDT77105 registers */
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#define IDT77105_MCR		0x0	/* Master Control Register */
1762306a36Sopenharmony_ci#define IDT77105_ISTAT	        0x1	/* Interrupt Status */
1862306a36Sopenharmony_ci#define IDT77105_DIAG   	0x2	/* Diagnostic Control */
1962306a36Sopenharmony_ci#define IDT77105_LEDHEC		0x3	/* LED Driver & HEC Status/Control */
2062306a36Sopenharmony_ci#define IDT77105_CTRLO		0x4	/* Low Byte Counter Register */
2162306a36Sopenharmony_ci#define IDT77105_CTRHI		0x5	/* High Byte Counter Register */
2262306a36Sopenharmony_ci#define IDT77105_CTRSEL		0x6	/* Counter Register Read Select */
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci/* IDT77105 register values */
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci/* MCR */
2762306a36Sopenharmony_ci#define IDT77105_MCR_UPLO	0x80	/* R/W, User Prog'le Output Latch */
2862306a36Sopenharmony_ci#define IDT77105_MCR_DREC	0x40	/* R/W, Discard Receive Error Cells */
2962306a36Sopenharmony_ci#define IDT77105_MCR_ECEIO	0x20	/* R/W, Enable Cell Error Interrupts
3062306a36Sopenharmony_ci                                         * Only */
3162306a36Sopenharmony_ci#define IDT77105_MCR_TDPC	0x10	/* R/W, Transmit Data Parity Check */
3262306a36Sopenharmony_ci#define IDT77105_MCR_DRIC	0x08	/* R/W, Discard Received Idle Cells */
3362306a36Sopenharmony_ci#define IDT77105_MCR_HALTTX	0x04	/* R/W, Halt Tx */
3462306a36Sopenharmony_ci#define IDT77105_MCR_UMODE	0x02	/* R/W, Utopia (cell/byte) Mode */
3562306a36Sopenharmony_ci#define IDT77105_MCR_EIP	0x01	/* R/W, Enable Interrupt Pin */
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci/* ISTAT */
3862306a36Sopenharmony_ci#define IDT77105_ISTAT_GOODSIG	0x40	/* R, Good Signal Bit */
3962306a36Sopenharmony_ci#define IDT77105_ISTAT_HECERR	0x20	/* sticky, HEC Error*/
4062306a36Sopenharmony_ci#define IDT77105_ISTAT_SCR	0x10	/* sticky, Short Cell Received */
4162306a36Sopenharmony_ci#define IDT77105_ISTAT_TPE	0x08	/* sticky, Transmit Parity Error */
4262306a36Sopenharmony_ci#define IDT77105_ISTAT_RSCC	0x04	/* sticky, Rx Signal Condition Change */
4362306a36Sopenharmony_ci#define IDT77105_ISTAT_RSE	0x02	/* sticky, Rx Symbol Error */
4462306a36Sopenharmony_ci#define IDT77105_ISTAT_RFO	0x01	/* sticky, Rx FIFO Overrun */
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci/* DIAG */
4762306a36Sopenharmony_ci#define IDT77105_DIAG_FTD	0x80	/* R/W, Force TxClav deassert */
4862306a36Sopenharmony_ci#define IDT77105_DIAG_ROS	0x40	/* R/W, RxClav operation select */
4962306a36Sopenharmony_ci#define IDT77105_DIAG_MPCS	0x20	/* R/W, Multi-PHY config'n select */
5062306a36Sopenharmony_ci#define IDT77105_DIAG_RFLUSH	0x10	/* R/W, clear receive FIFO */
5162306a36Sopenharmony_ci#define IDT77105_DIAG_ITPE	0x08	/* R/W, Insert Tx payload error */
5262306a36Sopenharmony_ci#define IDT77105_DIAG_ITHE	0x04	/* R/W, Insert Tx HEC error */
5362306a36Sopenharmony_ci#define IDT77105_DIAG_UMODE	0x02	/* R/W, Utopia (cell/byte) Mode */
5462306a36Sopenharmony_ci#define IDT77105_DIAG_LCMASK	0x03	/* R/W, Loopback Control */
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci#define IDT77105_DIAG_LC_NORMAL         0x00	/* Receive from network */
5762306a36Sopenharmony_ci#define IDT77105_DIAG_LC_PHY_LOOPBACK	0x02
5862306a36Sopenharmony_ci#define IDT77105_DIAG_LC_LINE_LOOPBACK	0x03
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci/* LEDHEC */
6162306a36Sopenharmony_ci#define IDT77105_LEDHEC_DRHC	0x40	/* R/W, Disable Rx HEC check */
6262306a36Sopenharmony_ci#define IDT77105_LEDHEC_DTHC	0x20	/* R/W, Disable Tx HEC calculation */
6362306a36Sopenharmony_ci#define IDT77105_LEDHEC_RPWMASK	0x18	/* R/W, RxRef pulse width select */
6462306a36Sopenharmony_ci#define IDT77105_LEDHEC_TFS	0x04	/* R, Tx FIFO Status (1=empty) */
6562306a36Sopenharmony_ci#define IDT77105_LEDHEC_TLS	0x02	/* R, Tx LED Status (1=lit) */
6662306a36Sopenharmony_ci#define IDT77105_LEDHEC_RLS	0x01	/* R, Rx LED Status (1=lit) */
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci#define IDT77105_LEDHEC_RPW_1	0x00	/* RxRef active for 1 RxClk cycle */
6962306a36Sopenharmony_ci#define IDT77105_LEDHEC_RPW_2	0x08	/* RxRef active for 2 RxClk cycle */
7062306a36Sopenharmony_ci#define IDT77105_LEDHEC_RPW_4	0x10	/* RxRef active for 4 RxClk cycle */
7162306a36Sopenharmony_ci#define IDT77105_LEDHEC_RPW_8	0x18	/* RxRef active for 8 RxClk cycle */
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ci/* CTRSEL */
7462306a36Sopenharmony_ci#define IDT77105_CTRSEL_SEC	0x08	/* W, Symbol Error Counter */
7562306a36Sopenharmony_ci#define IDT77105_CTRSEL_TCC	0x04	/* W, Tx Cell Counter */
7662306a36Sopenharmony_ci#define IDT77105_CTRSEL_RCC	0x02	/* W, Rx Cell Counter */
7762306a36Sopenharmony_ci#define IDT77105_CTRSEL_RHEC	0x01	/* W, Rx HEC Error Counter */
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci#ifdef __KERNEL__
8062306a36Sopenharmony_ciint idt77105_init(struct atm_dev *dev);
8162306a36Sopenharmony_ci#endif
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ci/*
8462306a36Sopenharmony_ci * Tunable parameters
8562306a36Sopenharmony_ci */
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci/* Time between samples of the hardware cell counters. Should be <= 1 sec */
8862306a36Sopenharmony_ci#define IDT77105_STATS_TIMER_PERIOD     (HZ)
8962306a36Sopenharmony_ci/* Time between checks to see if the signal has been found again */
9062306a36Sopenharmony_ci#define IDT77105_RESTART_TIMER_PERIOD   (5 * HZ)
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ci#endif
93