linux/drivers/net/wan/framer/pef2256/pef2256-regs.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 * PEF2256 registers definition
 *
 * Copyright 2023 CS GROUP France
 *
 * Author: Herve Codina <[email protected]>
 */
#ifndef __PEF2256_REGS_H__
#define __PEF2256_REGS_H__

#include "linux/bitfield.h"

/* Command Register */
#define PEF2256_CMDR
#define PEF2256_CMDR_RRES
#define PEF2256_CMDR_XRES
#define PEF2256_CMDR_SRES

/* Interrupt Mask Register 0..5 */
#define PEF2256_IMR0
#define PEF2256_IMR1
#define PEF2256_IMR2
#define PEF2256_IMR3
#define PEF2256_IMR4
#define PEF2256_IMR5

/* Framer Mode Register 0 */
#define PEF2256_FMR0
#define PEF2256_FMR0_XC_MASK
#define PEF2256_FMR0_XC_NRZ
#define PEF2256_FMR0_XC_CMI
#define PEF2256_FMR0_XC_AMI
#define PEF2256_FMR0_XC_HDB3
#define PEF2256_FMR0_RC_MASK
#define PEF2256_FMR0_RC_NRZ
#define PEF2256_FMR0_RC_CMI
#define PEF2256_FMR0_RC_AMI
#define PEF2256_FMR0_RC_HDB3

/* Framer Mode Register 1 */
#define PEF2256_FMR1
#define PEF2256_FMR1_XFS
#define PEF2256_FMR1_ECM
/* SSD is defined on 2 bits. The other bit is on SIC1 register */
#define PEF2256_FMR1_SSD_MASK
#define PEF2256_FMR1_SSD_2048
#define PEF2256_FMR1_SSD_4096
#define PEF2256_FMR1_SSD_8192
#define PEF2256_FMR1_SSD_16384

/* Framer Mode Register 2 */
#define PEF2256_FMR2
#define PEF2256_FMR2_RFS_MASK
#define PEF2256_FMR2_RFS_DOUBLEFRAME
#define PEF2256_FMR2_RFS_CRC4_MULTIFRAME
#define PEF2256_FMR2_RFS_AUTO_MULTIFRAME
#define PEF2256_FMR2_AXRA

/* Transmit Service Word */
#define PEF2256_XSW
#define PEF2256_XSW_XSIS
#define PEF2256_XSW_XTM
#define PEF2256_XSW_XY_MASK
#define PEF2256_XSW_XY(_v)

/* Transmit Spare Bits */
#define PEF2256_XSP
#define PEF2256_XSP_XSIF

/* Transmit Control 0..1 */
#define PEF2256_XC0
#define PEF2256_XC1

/* Receive Control 0 */
#define PEF2256_RC0
#define PEF2256_RC0_SWD
#define PEF2256_RC0_ASY4

/* Receive Control 1 */
#define PEF2256_RC1

/* Transmit Pulse Mask 0..1 */
#define PEF2256_XPM0
#define PEF2256_XPM1

/* Transmit Pulse Mask 2 */
#define PEF2256_XPM2
#define PEF2256_XPM2_XLT

/* Transparent Service Word Mask */
#define PEF2256_TSWM

/* Line Interface Mode 0 */
#define PEF2256_LIM0
#define PEF2256_2X_LIM0_BIT3
#define PEF2256_LIM0_MAS

/* Line Interface Mode 1 */
#define PEF2256_LIM1
#define PEF2256_12_LIM1_RIL_MASK
#define PEF2256_12_LIM1_RIL_910
#define PEF2256_12_LIM1_RIL_740
#define PEF2256_12_LIM1_RIL_590
#define PEF2256_12_LIM1_RIL_420
#define PEF2256_12_LIM1_RIL_320
#define PEF2256_12_LIM1_RIL_210
#define PEF2256_12_LIM1_RIL_160
#define PEF2256_12_LIM1_RIL_100
#define PEF2256_2X_LIM1_RIL_MASK
#define PEF2256_2X_LIM1_RIL_2250
#define PEF2256_2X_LIM1_RIL_1100
#define PEF2256_2X_LIM1_RIL_600
#define PEF2256_2X_LIM1_RIL_350
#define PEF2256_2X_LIM1_RIL_210
#define PEF2256_2X_LIM1_RIL_140
#define PEF2256_2X_LIM1_RIL_100
#define PEF2256_2X_LIM1_RIL_50

/* Pulse Count Detection */
#define PEF2256_PCD

 /* Pulse Count Recovery */
#define PEF2256_PCR

 /* Line Interface Mode 2 */
#define PEF2256_LIM2
#define PEF2256_LIM2_SLT_MASK
#define PEF2256_LIM2_SLT_THR55
#define PEF2256_LIM2_SLT_THR67
#define PEF2256_LIM2_SLT_THR50
#define PEF2256_LIM2_SLT_THR45
#define PEF2256_LIM2_ELT

/* System Interface Control 1 */
#define PEF2256_SIC1
#define PEF2256_SIC1_SSC_MASK
#define PEF2256_SIC1_SSC_2048
#define PEF2256_SIC1_SSC_4096
#define PEF2256_SIC1_SSC_8192
#define PEF2256_SIC1_SSC_16384
/* SSD is defined on 2 bits. The other bit is on FMR1 register */
#define PEF2256_SIC1_SSD_MASK
#define PEF2256_SIC1_SSD_2048
#define PEF2256_SIC1_SSD_4096
#define PEF2256_SIC1_SSD_8192
#define PEF2256_SIC1_SSD_16384
#define PEF2256_SIC1_RBS_MASK
#define PEF2256_SIC1_RBS_2FRAMES
#define PEF2256_SIC1_RBS_1FRAME
#define PEF2256_SIC1_RBS_96BITS
#define PEF2256_SIC1_RBS_BYPASS
#define PEF2256_SIC1_XBS_MASK
#define PEF2256_SIC1_XBS_BYPASS
#define PEF2256_SIC1_XBS_1FRAME
#define PEF2256_SIC1_XBS_2FRAMES
#define PEF2256_SIC1_XBS_96BITS

/* System Interface Control 2 */
#define PEF2256_SIC2
#define PEF2256_SIC2_SICS_MASK
#define PEF2256_SIC2_SICS(_v)

/* System Interface Control 3 */
#define PEF2256_SIC3
#define PEF2256_SIC3_RTRI
#define PEF2256_SIC3_RESX
#define PEF2256_SIC3_RESR

/* Clock Mode Register 1 */
#define PEF2256_CMR1
#define PEF2256_CMR1_RS_MASK
#define PEF2256_CMR1_RS_DPLL
#define PEF2256_CMR1_RS_DPLL_LOS_HIGH
#define PEF2256_CMR1_RS_DCOR_2048
#define PEF2256_CMR1_RS_DCOR_8192
#define PEF2256_CMR1_DCS

/* Clock Mode Register 2 */
#define PEF2256_CMR2
#define PEF2256_CMR2_DCOXC

/* Global Configuration Register */
#define PEF2256_GCR
#define PEF2256_GCR_SCI
#define PEF2256_GCR_ECMC

/* Port Configuration 5 */
#define PEF2256_PC5
#define PEF2256_PC5_CRP

/* Global Port Configuration 1 */
#define PEF2256_GPC1
#define PEF2256_GPC1_CSFP_MASK
#define PEF2256_GPC1_CSFP_SEC_IN_HIGH
#define PEF2256_GPC1_CSFP_SEC_OUT_HIGH
#define PEF2256_GPC1_CSFP_FSC_OUT_HIGH
#define PEF2256_GPC1_CSFP_FSC_OUT_LOW

/* Port Configuration 6 */
#define PEF2256_PC6

/* Global Counter Mode n=1..8 */
#define PEF2256_GCM(_n)
#define PEF2256_GCM1
#define PEF2256_GCM2
#define PEF2256_GCM3
#define PEF2256_GCM4
#define PEF2256_GCM5
#define PEF2256_GCM6
#define PEF2256_GCM7
#define PEF2256_GCM8

/* Version Status Register */
#define PEF2256_VSTR
#define PEF2256_VSTR_VERSION_12
#define PEF2256_VSTR_VERSION_21
#define PEF2256_VSTR_VERSION_2x

/* Framer Receive Status 0 */
#define PEF2256_FRS0
#define PEF2256_FRS0_LOS
#define PEF2256_FRS0_AIS

/* Interrupt Status Register 0..5 */
#define PEF2256_ISR(_n)
#define PEF2256_ISR0
#define PEF2256_ISR1
#define PEF2256_ISR2
#define PEF2256_ISR3
#define PEF2256_ISR4
#define PEF2256_ISR5

/* Global Interrupt Status */
#define PEF2256_GIS
#define PEF2256_GIS_ISR(_n)

/* Wafer Identification Register */
#define PEF2256_WID
#define PEF2256_12_WID_MASK
#define PEF2256_12_WID_VERSION_12
#define PEF2256_2X_WID_MASK
#define PEF2256_2X_WID_VERSION_21
#define PEF2256_2X_WID_VERSION_22

/* IMR2/ISR2 Interrupts common bits */
#define PEF2256_INT2_AIS
#define PEF2256_INT2_LOS

#endif /* __PEF2256_REGS_H__ */