18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Winbond W6692 specific defines
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Author       Karsten Keil <keil@isdn4linux.de>
68c2ecf20Sopenharmony_ci *		based on the w6692 I4L driver from Petr Novak <petr.novak@i.cz>
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Copyright 2009  by Karsten Keil <keil@isdn4linux.de>
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci/* Specifications of W6692 registers */
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#define W_D_RFIFO	0x00	/* R */
148c2ecf20Sopenharmony_ci#define W_D_XFIFO	0x04	/* W */
158c2ecf20Sopenharmony_ci#define W_D_CMDR	0x08	/* W */
168c2ecf20Sopenharmony_ci#define W_D_MODE	0x0c	/* R/W */
178c2ecf20Sopenharmony_ci#define W_D_TIMR	0x10	/* R/W */
188c2ecf20Sopenharmony_ci#define W_ISTA		0x14	/* R_clr */
198c2ecf20Sopenharmony_ci#define W_IMASK		0x18	/* R/W */
208c2ecf20Sopenharmony_ci#define W_D_EXIR	0x1c	/* R_clr */
218c2ecf20Sopenharmony_ci#define W_D_EXIM	0x20	/* R/W */
228c2ecf20Sopenharmony_ci#define W_D_STAR	0x24	/* R */
238c2ecf20Sopenharmony_ci#define W_D_RSTA	0x28	/* R */
248c2ecf20Sopenharmony_ci#define W_D_SAM		0x2c	/* R/W */
258c2ecf20Sopenharmony_ci#define W_D_SAP1	0x30	/* R/W */
268c2ecf20Sopenharmony_ci#define W_D_SAP2	0x34	/* R/W */
278c2ecf20Sopenharmony_ci#define W_D_TAM		0x38	/* R/W */
288c2ecf20Sopenharmony_ci#define W_D_TEI1	0x3c	/* R/W */
298c2ecf20Sopenharmony_ci#define W_D_TEI2	0x40	/* R/W */
308c2ecf20Sopenharmony_ci#define W_D_RBCH	0x44	/* R */
318c2ecf20Sopenharmony_ci#define W_D_RBCL	0x48	/* R */
328c2ecf20Sopenharmony_ci#define W_TIMR2		0x4c	/* W */
338c2ecf20Sopenharmony_ci#define W_L1_RC		0x50	/* R/W */
348c2ecf20Sopenharmony_ci#define W_D_CTL		0x54	/* R/W */
358c2ecf20Sopenharmony_ci#define W_CIR		0x58	/* R */
368c2ecf20Sopenharmony_ci#define W_CIX		0x5c	/* W */
378c2ecf20Sopenharmony_ci#define W_SQR		0x60	/* R */
388c2ecf20Sopenharmony_ci#define W_SQX		0x64	/* W */
398c2ecf20Sopenharmony_ci#define W_PCTL		0x68	/* R/W */
408c2ecf20Sopenharmony_ci#define W_MOR		0x6c	/* R */
418c2ecf20Sopenharmony_ci#define W_MOX		0x70	/* R/W */
428c2ecf20Sopenharmony_ci#define W_MOSR		0x74	/* R_clr */
438c2ecf20Sopenharmony_ci#define W_MOCR		0x78	/* R/W */
448c2ecf20Sopenharmony_ci#define W_GCR		0x7c	/* R/W */
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci#define	W_B_RFIFO	0x80	/* R */
478c2ecf20Sopenharmony_ci#define	W_B_XFIFO	0x84	/* W */
488c2ecf20Sopenharmony_ci#define	W_B_CMDR	0x88	/* W */
498c2ecf20Sopenharmony_ci#define	W_B_MODE	0x8c	/* R/W */
508c2ecf20Sopenharmony_ci#define	W_B_EXIR	0x90	/* R_clr */
518c2ecf20Sopenharmony_ci#define	W_B_EXIM	0x94	/* R/W */
528c2ecf20Sopenharmony_ci#define	W_B_STAR	0x98	/* R */
538c2ecf20Sopenharmony_ci#define	W_B_ADM1	0x9c	/* R/W */
548c2ecf20Sopenharmony_ci#define	W_B_ADM2	0xa0	/* R/W */
558c2ecf20Sopenharmony_ci#define	W_B_ADR1	0xa4	/* R/W */
568c2ecf20Sopenharmony_ci#define	W_B_ADR2	0xa8	/* R/W */
578c2ecf20Sopenharmony_ci#define	W_B_RBCL	0xac	/* R */
588c2ecf20Sopenharmony_ci#define	W_B_RBCH	0xb0	/* R */
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci#define W_XADDR		0xf4	/* R/W */
618c2ecf20Sopenharmony_ci#define W_XDATA		0xf8	/* R/W */
628c2ecf20Sopenharmony_ci#define W_EPCTL		0xfc	/* W */
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci/* W6692 register bits */
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci#define	W_D_CMDR_XRST	0x01
678c2ecf20Sopenharmony_ci#define	W_D_CMDR_XME	0x02
688c2ecf20Sopenharmony_ci#define	W_D_CMDR_XMS	0x08
698c2ecf20Sopenharmony_ci#define	W_D_CMDR_STT	0x10
708c2ecf20Sopenharmony_ci#define	W_D_CMDR_RRST	0x40
718c2ecf20Sopenharmony_ci#define	W_D_CMDR_RACK	0x80
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci#define	W_D_MODE_RLP	0x01
748c2ecf20Sopenharmony_ci#define	W_D_MODE_DLP	0x02
758c2ecf20Sopenharmony_ci#define	W_D_MODE_MFD	0x04
768c2ecf20Sopenharmony_ci#define	W_D_MODE_TEE	0x08
778c2ecf20Sopenharmony_ci#define	W_D_MODE_TMS	0x10
788c2ecf20Sopenharmony_ci#define	W_D_MODE_RACT	0x40
798c2ecf20Sopenharmony_ci#define	W_D_MODE_MMS	0x80
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci#define W_INT_B2_EXI	0x01
828c2ecf20Sopenharmony_ci#define W_INT_B1_EXI	0x02
838c2ecf20Sopenharmony_ci#define W_INT_D_EXI	0x04
848c2ecf20Sopenharmony_ci#define W_INT_XINT0	0x08
858c2ecf20Sopenharmony_ci#define W_INT_XINT1	0x10
868c2ecf20Sopenharmony_ci#define W_INT_D_XFR	0x20
878c2ecf20Sopenharmony_ci#define W_INT_D_RME	0x40
888c2ecf20Sopenharmony_ci#define W_INT_D_RMR	0x80
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci#define W_D_EXI_WEXP	0x01
918c2ecf20Sopenharmony_ci#define W_D_EXI_TEXP	0x02
928c2ecf20Sopenharmony_ci#define W_D_EXI_ISC	0x04
938c2ecf20Sopenharmony_ci#define W_D_EXI_MOC	0x08
948c2ecf20Sopenharmony_ci#define W_D_EXI_TIN2	0x10
958c2ecf20Sopenharmony_ci#define W_D_EXI_XCOL	0x20
968c2ecf20Sopenharmony_ci#define W_D_EXI_XDUN	0x40
978c2ecf20Sopenharmony_ci#define W_D_EXI_RDOV	0x80
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci#define	W_D_STAR_DRDY	0x10
1008c2ecf20Sopenharmony_ci#define	W_D_STAR_XBZ	0x20
1018c2ecf20Sopenharmony_ci#define	W_D_STAR_XDOW	0x80
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci#define W_D_RSTA_RMB	0x10
1048c2ecf20Sopenharmony_ci#define W_D_RSTA_CRCE	0x20
1058c2ecf20Sopenharmony_ci#define W_D_RSTA_RDOV	0x40
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci#define W_D_CTL_SRST	0x20
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci#define W_CIR_SCC	0x80
1108c2ecf20Sopenharmony_ci#define W_CIR_ICC	0x40
1118c2ecf20Sopenharmony_ci#define W_CIR_COD_MASK	0x0f
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci#define W_PCTL_PCX	0x01
1148c2ecf20Sopenharmony_ci#define W_PCTL_XMODE	0x02
1158c2ecf20Sopenharmony_ci#define W_PCTL_OE0	0x04
1168c2ecf20Sopenharmony_ci#define W_PCTL_OE1	0x08
1178c2ecf20Sopenharmony_ci#define W_PCTL_OE2	0x10
1188c2ecf20Sopenharmony_ci#define W_PCTL_OE3	0x20
1198c2ecf20Sopenharmony_ci#define W_PCTL_OE4	0x40
1208c2ecf20Sopenharmony_ci#define W_PCTL_OE5	0x80
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ci#define	W_B_CMDR_XRST	0x01
1238c2ecf20Sopenharmony_ci#define	W_B_CMDR_XME	0x02
1248c2ecf20Sopenharmony_ci#define	W_B_CMDR_XMS	0x04
1258c2ecf20Sopenharmony_ci#define	W_B_CMDR_RACT	0x20
1268c2ecf20Sopenharmony_ci#define	W_B_CMDR_RRST	0x40
1278c2ecf20Sopenharmony_ci#define	W_B_CMDR_RACK	0x80
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_ci#define	W_B_MODE_FTS0	0x01
1308c2ecf20Sopenharmony_ci#define	W_B_MODE_FTS1	0x02
1318c2ecf20Sopenharmony_ci#define	W_B_MODE_SW56	0x04
1328c2ecf20Sopenharmony_ci#define	W_B_MODE_BSW0	0x08
1338c2ecf20Sopenharmony_ci#define	W_B_MODE_BSW1	0x10
1348c2ecf20Sopenharmony_ci#define	W_B_MODE_EPCM	0x20
1358c2ecf20Sopenharmony_ci#define	W_B_MODE_ITF	0x40
1368c2ecf20Sopenharmony_ci#define	W_B_MODE_MMS	0x80
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_ci#define	W_B_EXI_XDUN	0x01
1398c2ecf20Sopenharmony_ci#define	W_B_EXI_XFR	0x02
1408c2ecf20Sopenharmony_ci#define	W_B_EXI_RDOV	0x10
1418c2ecf20Sopenharmony_ci#define	W_B_EXI_RME	0x20
1428c2ecf20Sopenharmony_ci#define	W_B_EXI_RMR	0x40
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci#define	W_B_STAR_XBZ	0x01
1458c2ecf20Sopenharmony_ci#define	W_B_STAR_XDOW	0x04
1468c2ecf20Sopenharmony_ci#define	W_B_STAR_RMB	0x10
1478c2ecf20Sopenharmony_ci#define	W_B_STAR_CRCE	0x20
1488c2ecf20Sopenharmony_ci#define	W_B_STAR_RDOV	0x40
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_ci#define	W_B_RBCH_LOV	0x20
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ci/* W6692 Layer1 commands */
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci#define	W_L1CMD_ECK	0x00
1558c2ecf20Sopenharmony_ci#define W_L1CMD_RST	0x01
1568c2ecf20Sopenharmony_ci#define W_L1CMD_SCP	0x04
1578c2ecf20Sopenharmony_ci#define W_L1CMD_SSP	0x02
1588c2ecf20Sopenharmony_ci#define W_L1CMD_AR8	0x08
1598c2ecf20Sopenharmony_ci#define W_L1CMD_AR10	0x09
1608c2ecf20Sopenharmony_ci#define W_L1CMD_EAL	0x0a
1618c2ecf20Sopenharmony_ci#define W_L1CMD_DRC	0x0f
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci/* W6692 Layer1 indications */
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci#define W_L1IND_CE	0x07
1668c2ecf20Sopenharmony_ci#define W_L1IND_DRD	0x00
1678c2ecf20Sopenharmony_ci#define W_L1IND_LD	0x04
1688c2ecf20Sopenharmony_ci#define W_L1IND_ARD	0x08
1698c2ecf20Sopenharmony_ci#define W_L1IND_TI	0x0a
1708c2ecf20Sopenharmony_ci#define W_L1IND_ATI	0x0b
1718c2ecf20Sopenharmony_ci#define W_L1IND_AI8	0x0c
1728c2ecf20Sopenharmony_ci#define W_L1IND_AI10	0x0d
1738c2ecf20Sopenharmony_ci#define W_L1IND_CD	0x0f
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_ci/* FIFO thresholds */
1768c2ecf20Sopenharmony_ci#define W_D_FIFO_THRESH	64
1778c2ecf20Sopenharmony_ci#define W_B_FIFO_THRESH	64
178