18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/* drivers/atm/uPD98401.h - NEC uPD98401 (SAR) declarations */
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci/* Written 1995 by Werner Almesberger, EPFL LRC */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifndef DRIVERS_ATM_uPD98401_H
88c2ecf20Sopenharmony_ci#define DRIVERS_ATM_uPD98401_H
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#define MAX_CRAM_SIZE	(1 << 18)	/* 2^18 words */
128c2ecf20Sopenharmony_ci#define RAM_INCREMENT	1024		/* check in 4 kB increments */
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#define uPD98401_PORTS	0x24		/* probably more ? */
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci/*
188c2ecf20Sopenharmony_ci * Commands
198c2ecf20Sopenharmony_ci */
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#define uPD98401_OPEN_CHAN	0x20000000 /* open channel */
228c2ecf20Sopenharmony_ci#define uPD98401_CHAN_ADDR	0x0003fff8 /*	channel address */
238c2ecf20Sopenharmony_ci#define uPD98401_CHAN_ADDR_SHIFT 3
248c2ecf20Sopenharmony_ci#define uPD98401_CLOSE_CHAN	0x24000000 /* close channel */
258c2ecf20Sopenharmony_ci#define uPD98401_CHAN_RT	0x02000000 /*	RX/TX (0 TX, 1 RX) */
268c2ecf20Sopenharmony_ci#define uPD98401_DEACT_CHAN	0x28000000 /* deactivate channel */
278c2ecf20Sopenharmony_ci#define uPD98401_TX_READY	0x30000000 /* TX ready */
288c2ecf20Sopenharmony_ci#define uPD98401_ADD_BAT	0x34000000 /* add batches */
298c2ecf20Sopenharmony_ci#define uPD98401_POOL		0x000f0000 /* pool number */
308c2ecf20Sopenharmony_ci#define uPD98401_POOL_SHIFT	16
318c2ecf20Sopenharmony_ci#define uPD98401_POOL_NUMBAT	0x0000ffff /* number of batches */
328c2ecf20Sopenharmony_ci#define uPD98401_NOP		0x3f000000 /* NOP */
338c2ecf20Sopenharmony_ci#define uPD98401_IND_ACC	0x00000000 /* Indirect Access */
348c2ecf20Sopenharmony_ci#define uPD98401_IA_RW		0x10000000 /*	Read/Write (0 W, 1 R) */
358c2ecf20Sopenharmony_ci#define uPD98401_IA_B3		0x08000000 /*	Byte select, 1 enable */
368c2ecf20Sopenharmony_ci#define uPD98401_IA_B2		0x04000000
378c2ecf20Sopenharmony_ci#define uPD98401_IA_B1		0x02000000
388c2ecf20Sopenharmony_ci#define uPD98401_IA_B0		0x01000000
398c2ecf20Sopenharmony_ci#define uPD98401_IA_BALL	0x0f000000 /*   whole longword */
408c2ecf20Sopenharmony_ci#define uPD98401_IA_TGT		0x000c0000 /*	Target */
418c2ecf20Sopenharmony_ci#define uPD98401_IA_TGT_SHIFT	18
428c2ecf20Sopenharmony_ci#define uPD98401_IA_TGT_CM	0	   /*	- Control Memory */
438c2ecf20Sopenharmony_ci#define uPD98401_IA_TGT_SAR	1	   /*	- uPD98401 registers */
448c2ecf20Sopenharmony_ci#define uPD98401_IA_TGT_PHY	3	   /*   - PHY device */
458c2ecf20Sopenharmony_ci#define uPD98401_IA_ADDR	0x0003ffff
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/*
488c2ecf20Sopenharmony_ci * Command Register Status
498c2ecf20Sopenharmony_ci */
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci#define uPD98401_BUSY		0x80000000 /* SAR is busy */
528c2ecf20Sopenharmony_ci#define uPD98401_LOCKED		0x40000000 /* SAR is locked by other CPU */
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci/*
558c2ecf20Sopenharmony_ci * Indications
568c2ecf20Sopenharmony_ci */
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci/* Normal (AAL5) Receive Indication */
598c2ecf20Sopenharmony_ci#define uPD98401_AAL5_UINFO	0xffff0000 /* user-supplied information */
608c2ecf20Sopenharmony_ci#define uPD98401_AAL5_UINFO_SHIFT 16
618c2ecf20Sopenharmony_ci#define uPD98401_AAL5_SIZE	0x0000ffff /* PDU size (in _CELLS_ !!) */
628c2ecf20Sopenharmony_ci#define uPD98401_AAL5_CHAN	0x7fff0000 /* Channel number */
638c2ecf20Sopenharmony_ci#define uPD98401_AAL5_CHAN_SHIFT	16
648c2ecf20Sopenharmony_ci#define uPD98401_AAL5_ERR	0x00008000 /* Error indication */
658c2ecf20Sopenharmony_ci#define uPD98401_AAL5_CI	0x00004000 /* Congestion Indication */
668c2ecf20Sopenharmony_ci#define uPD98401_AAL5_CLP	0x00002000 /* CLP (>= 1 cell had CLP=1) */
678c2ecf20Sopenharmony_ci#define uPD98401_AAL5_ES	0x00000f00 /* Error Status */
688c2ecf20Sopenharmony_ci#define uPD98401_AAL5_ES_SHIFT	8
698c2ecf20Sopenharmony_ci#define uPD98401_AAL5_ES_NONE	0	   /*	No error */
708c2ecf20Sopenharmony_ci#define uPD98401_AAL5_ES_FREE	1	   /*	Receiver free buf underflow */
718c2ecf20Sopenharmony_ci#define uPD98401_AAL5_ES_FIFO	2	   /*	Receiver FIFO overrun */
728c2ecf20Sopenharmony_ci#define uPD98401_AAL5_ES_TOOBIG	3	   /*	Maximum length violation */
738c2ecf20Sopenharmony_ci#define uPD98401_AAL5_ES_CRC	4	   /*	CRC error */
748c2ecf20Sopenharmony_ci#define uPD98401_AAL5_ES_ABORT	5	   /*	User abort */
758c2ecf20Sopenharmony_ci#define uPD98401_AAL5_ES_LENGTH	6	   /*   Length violation */
768c2ecf20Sopenharmony_ci#define uPD98401_AAL5_ES_T1	7	   /*	T1 error (timeout) */
778c2ecf20Sopenharmony_ci#define uPD98401_AAL5_ES_DEACT	8	   /*	Deactivated with DEACT_CHAN */
788c2ecf20Sopenharmony_ci#define uPD98401_AAL5_POOL	0x0000001f /* Free buffer pool number */
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci/* Raw Cell Indication */
818c2ecf20Sopenharmony_ci#define uPD98401_RAW_UINFO	uPD98401_AAL5_UINFO
828c2ecf20Sopenharmony_ci#define uPD98401_RAW_UINFO_SHIFT uPD98401_AAL5_UINFO_SHIFT
838c2ecf20Sopenharmony_ci#define uPD98401_RAW_HEC	0x000000ff /* HEC */
848c2ecf20Sopenharmony_ci#define uPD98401_RAW_CHAN	uPD98401_AAL5_CHAN
858c2ecf20Sopenharmony_ci#define uPD98401_RAW_CHAN_SHIFT uPD98401_AAL5_CHAN_SHIFT
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci/* Transmit Indication */
888c2ecf20Sopenharmony_ci#define uPD98401_TXI_CONN	0x7fff0000 /* Connection Number */
898c2ecf20Sopenharmony_ci#define uPD98401_TXI_CONN_SHIFT	16
908c2ecf20Sopenharmony_ci#define uPD98401_TXI_ACTIVE	0x00008000 /* Channel remains active */
918c2ecf20Sopenharmony_ci#define uPD98401_TXI_PQP	0x00007fff /* Packet Queue Pointer */
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci/*
948c2ecf20Sopenharmony_ci * Directly Addressable Registers
958c2ecf20Sopenharmony_ci */
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci#define uPD98401_GMR	0x00	/* General Mode Register */
988c2ecf20Sopenharmony_ci#define uPD98401_GSR	0x01	/* General Status Register */
998c2ecf20Sopenharmony_ci#define uPD98401_IMR	0x02	/* Interrupt Mask Register */
1008c2ecf20Sopenharmony_ci#define uPD98401_RQU	0x03	/* Receive Queue Underrun */
1018c2ecf20Sopenharmony_ci#define uPD98401_RQA	0x04	/* Receive Queue Alert */
1028c2ecf20Sopenharmony_ci#define uPD98401_ADDR	0x05	/* Last Burst Address */
1038c2ecf20Sopenharmony_ci#define uPD98401_VER	0x06	/* Version Number */
1048c2ecf20Sopenharmony_ci#define uPD98401_SWR	0x07	/* Software Reset */
1058c2ecf20Sopenharmony_ci#define uPD98401_CMR	0x08	/* Command Register */
1068c2ecf20Sopenharmony_ci#define uPD98401_CMR_L	0x09	/* Command Register and Lock/Unlock */
1078c2ecf20Sopenharmony_ci#define uPD98401_CER	0x0a	/* Command Extension Register */
1088c2ecf20Sopenharmony_ci#define uPD98401_CER_L	0x0b	/* Command Ext Reg and Lock/Unlock */
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci#define uPD98401_MSH(n) (0x10+(n))	/* Mailbox n Start Address High */
1118c2ecf20Sopenharmony_ci#define uPD98401_MSL(n) (0x14+(n))	/* Mailbox n Start Address High */
1128c2ecf20Sopenharmony_ci#define uPD98401_MBA(n) (0x18+(n))	/* Mailbox n Bottom Address */
1138c2ecf20Sopenharmony_ci#define uPD98401_MTA(n) (0x1c+(n))	/* Mailbox n Tail Address */
1148c2ecf20Sopenharmony_ci#define uPD98401_MWA(n) (0x20+(n))	/* Mailbox n Write Address */
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci/* GMR is at 0x00 */
1178c2ecf20Sopenharmony_ci#define uPD98401_GMR_ONE	0x80000000 /* Must be set to one */
1188c2ecf20Sopenharmony_ci#define uPD98401_GMR_SLM	0x40000000 /* Address mode (0 word, 1 byte) */
1198c2ecf20Sopenharmony_ci#define uPD98401_GMR_CPE	0x00008000 /* Control Memory Parity Enable */
1208c2ecf20Sopenharmony_ci#define uPD98401_GMR_LP		0x00004000 /* Loopback */
1218c2ecf20Sopenharmony_ci#define uPD98401_GMR_WA		0x00002000 /* Early Bus Write Abort/RDY */
1228c2ecf20Sopenharmony_ci#define uPD98401_GMR_RA		0x00001000 /* Early Read Abort/RDY */
1238c2ecf20Sopenharmony_ci#define uPD98401_GMR_SZ		0x00000f00 /* Burst Size Enable */
1248c2ecf20Sopenharmony_ci#define uPD98401_BURST16	0x00000800 /*	16-word burst */
1258c2ecf20Sopenharmony_ci#define uPD98401_BURST8		0x00000400 /*	 8-word burst */
1268c2ecf20Sopenharmony_ci#define uPD98401_BURST4		0x00000200 /*	 4-word burst */
1278c2ecf20Sopenharmony_ci#define uPD98401_BURST2		0x00000100 /*	 2-word burst */
1288c2ecf20Sopenharmony_ci#define uPD98401_GMR_AD		0x00000080 /* Address (burst resolution) Disable */
1298c2ecf20Sopenharmony_ci#define uPD98401_GMR_BO		0x00000040 /* Byte Order (0 little, 1 big) */
1308c2ecf20Sopenharmony_ci#define uPD98401_GMR_PM		0x00000020 /* Bus Parity Mode (0 byte, 1 word)*/
1318c2ecf20Sopenharmony_ci#define uPD98401_GMR_PC		0x00000010 /* Bus Parity Control (0even,1odd) */
1328c2ecf20Sopenharmony_ci#define uPD98401_GMR_BPE	0x00000008 /* Bus Parity Enable */
1338c2ecf20Sopenharmony_ci#define uPD98401_GMR_DR		0x00000004 /* Receive Drop Mode (0drop,1don't)*/
1348c2ecf20Sopenharmony_ci#define uPD98401_GMR_SE		0x00000002 /* Shapers Enable */
1358c2ecf20Sopenharmony_ci#define uPD98401_GMR_RE		0x00000001 /* Receiver Enable */
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci/* GSR is at 0x01, IMR is at 0x02 */
1388c2ecf20Sopenharmony_ci#define uPD98401_INT_PI		0x80000000 /* PHY interrupt */
1398c2ecf20Sopenharmony_ci#define uPD98401_INT_RQA	0x40000000 /* Receive Queue Alert */
1408c2ecf20Sopenharmony_ci#define uPD98401_INT_RQU	0x20000000 /* Receive Queue Underrun */
1418c2ecf20Sopenharmony_ci#define uPD98401_INT_RD		0x10000000 /* Receiver Deactivated */
1428c2ecf20Sopenharmony_ci#define uPD98401_INT_SPE	0x08000000 /* System Parity Error */
1438c2ecf20Sopenharmony_ci#define uPD98401_INT_CPE	0x04000000 /* Control Memory Parity Error */
1448c2ecf20Sopenharmony_ci#define uPD98401_INT_SBE	0x02000000 /* System Bus Error */
1458c2ecf20Sopenharmony_ci#define uPD98401_INT_IND	0x01000000 /* Initialization Done */
1468c2ecf20Sopenharmony_ci#define uPD98401_INT_RCR	0x0000ff00 /* Raw Cell Received */
1478c2ecf20Sopenharmony_ci#define uPD98401_INT_RCR_SHIFT	8
1488c2ecf20Sopenharmony_ci#define uPD98401_INT_MF		0x000000f0 /* Mailbox Full */
1498c2ecf20Sopenharmony_ci#define uPD98401_INT_MF_SHIFT	4
1508c2ecf20Sopenharmony_ci#define uPD98401_INT_MM		0x0000000f /* Mailbox Modified */
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ci/* VER is at 0x06 */
1538c2ecf20Sopenharmony_ci#define uPD98401_MAJOR		0x0000ff00 /* Major revision */
1548c2ecf20Sopenharmony_ci#define uPD98401_MAJOR_SHIFT	8
1558c2ecf20Sopenharmony_ci#define uPD98401_MINOR		0x000000ff /* Minor revision */
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci/*
1588c2ecf20Sopenharmony_ci * Indirectly Addressable Registers
1598c2ecf20Sopenharmony_ci */
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ci#define uPD98401_IM(n)	(0x40000+(n))	/* Scheduler n I and M */
1628c2ecf20Sopenharmony_ci#define uPD98401_X(n)	(0x40010+(n))	/* Scheduler n X */
1638c2ecf20Sopenharmony_ci#define uPD98401_Y(n)	(0x40020+(n))	/* Scheduler n Y */
1648c2ecf20Sopenharmony_ci#define uPD98401_PC(n)	(0x40030+(n))	/* Scheduler n P, C, p and c */
1658c2ecf20Sopenharmony_ci#define uPD98401_PS(n)	(0x40040+(n))	/* Scheduler n priority and status */
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_ci/* IM contents */
1688c2ecf20Sopenharmony_ci#define uPD98401_IM_I		0xff000000 /* I */
1698c2ecf20Sopenharmony_ci#define uPD98401_IM_I_SHIFT	24
1708c2ecf20Sopenharmony_ci#define uPD98401_IM_M		0x00ffffff /* M */
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci/* PC contents */
1738c2ecf20Sopenharmony_ci#define uPD98401_PC_P		0xff000000 /* P */
1748c2ecf20Sopenharmony_ci#define uPD98401_PC_P_SHIFT	24
1758c2ecf20Sopenharmony_ci#define uPD98401_PC_C		0x00ff0000 /* C */
1768c2ecf20Sopenharmony_ci#define uPD98401_PC_C_SHIFT	16
1778c2ecf20Sopenharmony_ci#define uPD98401_PC_p		0x0000ff00 /* p */
1788c2ecf20Sopenharmony_ci#define uPD98401_PC_p_SHIFT	8
1798c2ecf20Sopenharmony_ci#define uPD98401_PC_c		0x000000ff /* c */
1808c2ecf20Sopenharmony_ci
1818c2ecf20Sopenharmony_ci/* PS contents */
1828c2ecf20Sopenharmony_ci#define uPD98401_PS_PRIO	0xf0	/* Priority level (0 high, 15 low) */
1838c2ecf20Sopenharmony_ci#define uPD98401_PS_PRIO_SHIFT	4
1848c2ecf20Sopenharmony_ci#define uPD98401_PS_S		0x08	/* Scan - must be 0 (internal) */
1858c2ecf20Sopenharmony_ci#define uPD98401_PS_R		0x04	/* Round Robin (internal) */
1868c2ecf20Sopenharmony_ci#define uPD98401_PS_A		0x02	/* Active (internal) */
1878c2ecf20Sopenharmony_ci#define uPD98401_PS_E		0x01	/* Enabled */
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci#define uPD98401_TOS	0x40100	/* Top of Stack Control Memory Address */
1908c2ecf20Sopenharmony_ci#define uPD98401_SMA	0x40200	/* Shapers Control Memory Start Address */
1918c2ecf20Sopenharmony_ci#define uPD98401_PMA	0x40201	/* Receive Pool Control Memory Start Address */
1928c2ecf20Sopenharmony_ci#define uPD98401_T1R	0x40300	/* T1 Register */
1938c2ecf20Sopenharmony_ci#define uPD98401_VRR	0x40301	/* VPI/VCI Reduction Register/Recv. Shutdown */
1948c2ecf20Sopenharmony_ci#define uPD98401_TSR	0x40302	/* Time-Stamp Register */
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci/* VRR is at 0x40301 */
1978c2ecf20Sopenharmony_ci#define uPD98401_VRR_SDM	0x80000000 /* Shutdown Mode */
1988c2ecf20Sopenharmony_ci#define uPD98401_VRR_SHIFT	0x000f0000 /* VPI/VCI Shift */
1998c2ecf20Sopenharmony_ci#define uPD98401_VRR_SHIFT_SHIFT 16
2008c2ecf20Sopenharmony_ci#define uPD98401_VRR_MASK	0x0000ffff /* VPI/VCI mask */
2018c2ecf20Sopenharmony_ci
2028c2ecf20Sopenharmony_ci/*
2038c2ecf20Sopenharmony_ci * TX packet descriptor
2048c2ecf20Sopenharmony_ci */
2058c2ecf20Sopenharmony_ci
2068c2ecf20Sopenharmony_ci#define uPD98401_TXPD_SIZE	16	   /* descriptor size (in bytes) */
2078c2ecf20Sopenharmony_ci
2088c2ecf20Sopenharmony_ci#define uPD98401_TXPD_V		0x80000000 /* Valid bit */
2098c2ecf20Sopenharmony_ci#define uPD98401_TXPD_DP	0x40000000 /* Descriptor (1) or Pointer (0) */
2108c2ecf20Sopenharmony_ci#define uPD98401_TXPD_SM	0x20000000 /* Single (1) or Multiple (0) */
2118c2ecf20Sopenharmony_ci#define uPD98401_TXPD_CLPM	0x18000000 /* CLP mode */
2128c2ecf20Sopenharmony_ci#define uPD98401_CLPM_0		0	   /*	00 CLP = 0 */
2138c2ecf20Sopenharmony_ci#define uPD98401_CLPM_1		3	   /*	11 CLP = 1 */
2148c2ecf20Sopenharmony_ci#define uPD98401_CLPM_LAST	1	   /*	01 CLP unless last cell */
2158c2ecf20Sopenharmony_ci#define uPD98401_TXPD_CLPM_SHIFT 27
2168c2ecf20Sopenharmony_ci#define uPD98401_TXPD_PTI	0x07000000 /* PTI pattern */
2178c2ecf20Sopenharmony_ci#define uPD98401_TXPD_PTI_SHIFT	24
2188c2ecf20Sopenharmony_ci#define uPD98401_TXPD_GFC	0x00f00000 /* GFC pattern */
2198c2ecf20Sopenharmony_ci#define uPD98401_TXPD_GFC_SHIFT	20
2208c2ecf20Sopenharmony_ci#define uPD98401_TXPD_C10	0x00040000 /* insert CRC-10 */
2218c2ecf20Sopenharmony_ci#define uPD98401_TXPD_AAL5	0x00020000 /* AAL5 processing */
2228c2ecf20Sopenharmony_ci#define uPD98401_TXPD_MB	0x00010000 /* TX mailbox number */
2238c2ecf20Sopenharmony_ci#define uPD98401_TXPD_UU	0x0000ff00 /* CPCS-UU */
2248c2ecf20Sopenharmony_ci#define uPD98401_TXPD_UU_SHIFT	8
2258c2ecf20Sopenharmony_ci#define uPD98401_TXPD_CPI	0x000000ff /* CPI */
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_ci/*
2288c2ecf20Sopenharmony_ci * TX buffer descriptor
2298c2ecf20Sopenharmony_ci */
2308c2ecf20Sopenharmony_ci
2318c2ecf20Sopenharmony_ci#define uPD98401_TXBD_SIZE	8	   /* descriptor size (in bytes) */
2328c2ecf20Sopenharmony_ci
2338c2ecf20Sopenharmony_ci#define uPD98401_TXBD_LAST	0x80000000 /* last buffer in packet */
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_ci/*
2368c2ecf20Sopenharmony_ci * TX VC table
2378c2ecf20Sopenharmony_ci */
2388c2ecf20Sopenharmony_ci
2398c2ecf20Sopenharmony_ci/* 1st word has the same structure as in a TX packet descriptor */
2408c2ecf20Sopenharmony_ci#define uPD98401_TXVC_L		0x80000000 /* last buffer */
2418c2ecf20Sopenharmony_ci#define uPD98401_TXVC_SHP	0x0f000000 /* shaper number */
2428c2ecf20Sopenharmony_ci#define uPD98401_TXVC_SHP_SHIFT	24
2438c2ecf20Sopenharmony_ci#define uPD98401_TXVC_VPI	0x00ff0000 /* VPI */
2448c2ecf20Sopenharmony_ci#define uPD98401_TXVC_VPI_SHIFT	16
2458c2ecf20Sopenharmony_ci#define uPD98401_TXVC_VCI	0x0000ffff /* VCI */
2468c2ecf20Sopenharmony_ci#define uPD98401_TXVC_QRP	6	   /* Queue Read Pointer is in word 6 */
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_ci/*
2498c2ecf20Sopenharmony_ci * RX free buffer pools descriptor
2508c2ecf20Sopenharmony_ci */
2518c2ecf20Sopenharmony_ci
2528c2ecf20Sopenharmony_ci#define uPD98401_RXFP_ALERT	0x70000000 /* low water mark */
2538c2ecf20Sopenharmony_ci#define uPD98401_RXFP_ALERT_SHIFT 28
2548c2ecf20Sopenharmony_ci#define uPD98401_RXFP_BFSZ	0x0f000000 /* buffer size, 64*2^n */
2558c2ecf20Sopenharmony_ci#define uPD98401_RXFP_BFSZ_SHIFT 24
2568c2ecf20Sopenharmony_ci#define uPD98401_RXFP_BTSZ	0x00ff0000 /* batch size, n+1 */
2578c2ecf20Sopenharmony_ci#define uPD98401_RXFP_BTSZ_SHIFT 16
2588c2ecf20Sopenharmony_ci#define uPD98401_RXFP_REMAIN	0x0000ffff /* remaining batches in pool */
2598c2ecf20Sopenharmony_ci
2608c2ecf20Sopenharmony_ci/*
2618c2ecf20Sopenharmony_ci * RX VC table
2628c2ecf20Sopenharmony_ci */
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_ci#define uPD98401_RXVC_BTSZ	0xff000000 /* remaining free buffers in batch */
2658c2ecf20Sopenharmony_ci#define uPD98401_RXVC_BTSZ_SHIFT 24
2668c2ecf20Sopenharmony_ci#define uPD98401_RXVC_MB	0x00200000 /* RX mailbox number */
2678c2ecf20Sopenharmony_ci#define uPD98401_RXVC_POOL	0x001f0000 /* free buffer pool number */
2688c2ecf20Sopenharmony_ci#define uPD98401_RXVC_POOL_SHIFT 16
2698c2ecf20Sopenharmony_ci#define uPD98401_RXVC_UINFO	0x0000ffff /* user-supplied information */
2708c2ecf20Sopenharmony_ci#define uPD98401_RXVC_T1	0xffff0000 /* T1 timestamp */
2718c2ecf20Sopenharmony_ci#define uPD98401_RXVC_T1_SHIFT	16
2728c2ecf20Sopenharmony_ci#define uPD98401_RXVC_PR	0x00008000 /* Packet Reception, 1 if busy */
2738c2ecf20Sopenharmony_ci#define uPD98401_RXVC_DR	0x00004000 /* FIFO Drop */
2748c2ecf20Sopenharmony_ci#define uPD98401_RXVC_OD	0x00001000 /* Drop OAM cells */
2758c2ecf20Sopenharmony_ci#define uPD98401_RXVC_AR	0x00000800 /* AAL5 or raw cell; 1 if AAL5 */
2768c2ecf20Sopenharmony_ci#define uPD98401_RXVC_MAXSEG	0x000007ff /* max number of segments per PDU */
2778c2ecf20Sopenharmony_ci#define uPD98401_RXVC_REM	0xfffe0000 /* remaining words in curr buffer */
2788c2ecf20Sopenharmony_ci#define uPD98401_RXVC_REM_SHIFT	17
2798c2ecf20Sopenharmony_ci#define uPD98401_RXVC_CLP	0x00010000 /* CLP received */
2808c2ecf20Sopenharmony_ci#define uPD98401_RXVC_BFA	0x00008000 /* Buffer Assigned */
2818c2ecf20Sopenharmony_ci#define uPD98401_RXVC_BTA	0x00004000 /* Batch Assigned */
2828c2ecf20Sopenharmony_ci#define uPD98401_RXVC_CI	0x00002000 /* Congestion Indication */
2838c2ecf20Sopenharmony_ci#define uPD98401_RXVC_DD	0x00001000 /* Dropping incoming cells */
2848c2ecf20Sopenharmony_ci#define uPD98401_RXVC_DP	0x00000800 /* like PR ? */
2858c2ecf20Sopenharmony_ci#define uPD98401_RXVC_CURSEG	0x000007ff /* Current Segment count */
2868c2ecf20Sopenharmony_ci
2878c2ecf20Sopenharmony_ci/*
2888c2ecf20Sopenharmony_ci * RX lookup table
2898c2ecf20Sopenharmony_ci */
2908c2ecf20Sopenharmony_ci
2918c2ecf20Sopenharmony_ci#define uPD98401_RXLT_ENBL	0x8000	   /* Enable */
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_ci#endif
294