18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci	Mantis PCI bridge driver
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci	Copyright (C) Manu Abraham (abraham.manu@gmail.com)
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci*/
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#ifndef __MANTIS_REG_H
108c2ecf20Sopenharmony_ci#define __MANTIS_REG_H
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci/* Interrupts */
138c2ecf20Sopenharmony_ci#define MANTIS_INT_STAT			0x00
148c2ecf20Sopenharmony_ci#define MANTIS_INT_MASK			0x04
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#define MANTIS_INT_RISCSTAT		(0x0f << 28)
178c2ecf20Sopenharmony_ci#define MANTIS_INT_RISCEN		BIT(27)
188c2ecf20Sopenharmony_ci#define MANTIS_INT_I2CRACK		BIT(26)
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci/* #define MANTIS_INT_GPIF			(0xff << 12) */
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#define MANTIS_INT_PCMCIA7		BIT(19)
238c2ecf20Sopenharmony_ci#define MANTIS_INT_PCMCIA6		BIT(18)
248c2ecf20Sopenharmony_ci#define MANTIS_INT_PCMCIA5		BIT(17)
258c2ecf20Sopenharmony_ci#define MANTIS_INT_PCMCIA4		BIT(16)
268c2ecf20Sopenharmony_ci#define MANTIS_INT_PCMCIA3		BIT(15)
278c2ecf20Sopenharmony_ci#define MANTIS_INT_PCMCIA2		BIT(14)
288c2ecf20Sopenharmony_ci#define MANTIS_INT_PCMCIA1		BIT(13)
298c2ecf20Sopenharmony_ci#define MANTIS_INT_PCMCIA0		BIT(12)
308c2ecf20Sopenharmony_ci#define MANTIS_INT_IRQ1			BIT(11)
318c2ecf20Sopenharmony_ci#define MANTIS_INT_IRQ0			BIT(10)
328c2ecf20Sopenharmony_ci#define MANTIS_INT_OCERR		BIT(8)
338c2ecf20Sopenharmony_ci#define MANTIS_INT_PABORT		BIT(7)
348c2ecf20Sopenharmony_ci#define MANTIS_INT_RIPERR		BIT(6)
358c2ecf20Sopenharmony_ci#define MANTIS_INT_PPERR		BIT(5)
368c2ecf20Sopenharmony_ci#define MANTIS_INT_FTRGT		BIT(3)
378c2ecf20Sopenharmony_ci#define MANTIS_INT_RISCI		BIT(1)
388c2ecf20Sopenharmony_ci#define MANTIS_INT_I2CDONE		BIT(0)
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci/* DMA */
418c2ecf20Sopenharmony_ci#define MANTIS_DMA_CTL			0x08
428c2ecf20Sopenharmony_ci#define MANTIS_GPIF_RD			(0xff << 24)
438c2ecf20Sopenharmony_ci#define MANTIS_GPIF_WR			(0xff << 16)
448c2ecf20Sopenharmony_ci#define MANTIS_CPU_DO			BIT(10)
458c2ecf20Sopenharmony_ci#define MANTIS_DRV_DO			BIT(9)
468c2ecf20Sopenharmony_ci#define	MANTIS_I2C_RD			BIT(7)
478c2ecf20Sopenharmony_ci#define MANTIS_I2C_WR			BIT(6)
488c2ecf20Sopenharmony_ci#define MANTIS_DCAP_MODE		BIT(5)
498c2ecf20Sopenharmony_ci#define MANTIS_FIFO_TP_4		(0x00 <<  3)
508c2ecf20Sopenharmony_ci#define MANTIS_FIFO_TP_8		(0x01 <<  3)
518c2ecf20Sopenharmony_ci#define MANTIS_FIFO_TP_16		(0x02 <<  3)
528c2ecf20Sopenharmony_ci#define MANTIS_FIFO_EN			BIT(2)
538c2ecf20Sopenharmony_ci#define MANTIS_DCAP_EN			BIT(1)
548c2ecf20Sopenharmony_ci#define MANTIS_RISC_EN			BIT(0)
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci/* DEBUG */
578c2ecf20Sopenharmony_ci#define MANTIS_DEBUGREG			0x0c
588c2ecf20Sopenharmony_ci#define MANTIS_DATINV			(0x0e <<  7)
598c2ecf20Sopenharmony_ci#define MANTIS_TOP_DEBUGSEL		(0x07 <<  4)
608c2ecf20Sopenharmony_ci#define MANTIS_PCMCIA_DEBUGSEL		(0x0f <<  0)
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci#define MANTIS_RISC_START		0x10
638c2ecf20Sopenharmony_ci#define MANTIS_RISC_PC			0x14
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci/* I2C */
668c2ecf20Sopenharmony_ci#define MANTIS_I2CDATA_CTL		0x18
678c2ecf20Sopenharmony_ci#define MANTIS_I2C_RATE_1		(0x00 <<  6)
688c2ecf20Sopenharmony_ci#define MANTIS_I2C_RATE_2		(0x01 <<  6)
698c2ecf20Sopenharmony_ci#define MANTIS_I2C_RATE_3		(0x02 <<  6)
708c2ecf20Sopenharmony_ci#define MANTIS_I2C_RATE_4		(0x03 <<  6)
718c2ecf20Sopenharmony_ci#define MANTIS_I2C_STOP			BIT(5)
728c2ecf20Sopenharmony_ci#define MANTIS_I2C_PGMODE		BIT(3)
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci/* DATA */
758c2ecf20Sopenharmony_ci#define MANTIS_CMD_DATA_R1		0x20
768c2ecf20Sopenharmony_ci#define MANTIS_CMD_DATA_3		(0xff << 24)
778c2ecf20Sopenharmony_ci#define MANTIS_CMD_DATA_2		(0xff << 16)
788c2ecf20Sopenharmony_ci#define MANTIS_CMD_DATA_1		(0xff <<  8)
798c2ecf20Sopenharmony_ci#define MANTIS_CMD_DATA_0		(0xff <<  0)
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci#define MANTIS_CMD_DATA_R2		0x24
828c2ecf20Sopenharmony_ci#define MANTIS_CMD_DATA_7		(0xff << 24)
838c2ecf20Sopenharmony_ci#define MANTIS_CMD_DATA_6		(0xff << 16)
848c2ecf20Sopenharmony_ci#define MANTIS_CMD_DATA_5		(0xff <<  8)
858c2ecf20Sopenharmony_ci#define MANTIS_CMD_DATA_4		(0xff <<  0)
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci#define MANTIS_CONTROL			0x28
888c2ecf20Sopenharmony_ci#define MANTIS_DET			BIT(7)
898c2ecf20Sopenharmony_ci#define MANTIS_DAT_CF_EN		BIT(6)
908c2ecf20Sopenharmony_ci#define MANTIS_ACS			(0x03 <<  4)
918c2ecf20Sopenharmony_ci#define MANTIS_VCCEN			BIT(3)
928c2ecf20Sopenharmony_ci#define MANTIS_BYPASS			BIT(2)
938c2ecf20Sopenharmony_ci#define MANTIS_MRST			BIT(1)
948c2ecf20Sopenharmony_ci#define MANTIS_CRST_INT			BIT(0)
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci#define MANTIS_GPIF_CFGSLA		0x84
978c2ecf20Sopenharmony_ci#define MANTIS_GPIF_WAITSMPL		(0x07 << 28)
988c2ecf20Sopenharmony_ci#define MANTIS_GPIF_BYTEADDRSUB		BIT(25)
998c2ecf20Sopenharmony_ci#define MANTIS_GPIF_WAITPOL		BIT(24)
1008c2ecf20Sopenharmony_ci#define MANTIS_GPIF_NCDELAY		(0x07 << 20)
1018c2ecf20Sopenharmony_ci#define MANTIS_GPIF_RW2CSDELAY		(0x07 << 16)
1028c2ecf20Sopenharmony_ci#define MANTIS_GPIF_SLFTIMEDMODE	BIT(15)
1038c2ecf20Sopenharmony_ci#define MANTIS_GPIF_SLFTIMEDDELY	(0x7f <<  8)
1048c2ecf20Sopenharmony_ci#define MANTIS_GPIF_DEVTYPE		(0x07 <<  4)
1058c2ecf20Sopenharmony_ci#define MANTIS_GPIF_BIGENDIAN		BIT(3)
1068c2ecf20Sopenharmony_ci#define MANTIS_GPIF_FETCHCMD		(0x03 <<  1)
1078c2ecf20Sopenharmony_ci#define MANTIS_GPIF_HWORDDEV		BIT(0)
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci#define MANTIS_GPIF_WSTOPER		0x90
1108c2ecf20Sopenharmony_ci#define MANTIS_GPIF_WSTOPERWREN3	BIT(31)
1118c2ecf20Sopenharmony_ci#define MANTIS_GPIF_PARBOOTN		BIT(29)
1128c2ecf20Sopenharmony_ci#define MANTIS_GPIF_WSTOPERSLID3	(0x1f << 24)
1138c2ecf20Sopenharmony_ci#define MANTIS_GPIF_WSTOPERWREN2	BIT(23)
1148c2ecf20Sopenharmony_ci#define MANTIS_GPIF_WSTOPERSLID2	(0x1f << 16)
1158c2ecf20Sopenharmony_ci#define MANTIS_GPIF_WSTOPERWREN1	BIT(15)
1168c2ecf20Sopenharmony_ci#define MANTIS_GPIF_WSTOPERSLID1	(0x1f <<  8)
1178c2ecf20Sopenharmony_ci#define MANTIS_GPIF_WSTOPERWREN0	BIT(7)
1188c2ecf20Sopenharmony_ci#define MANTIS_GPIF_WSTOPERSLID0	(0x1f <<  0)
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci#define MANTIS_GPIF_CS2RW		0x94
1218c2ecf20Sopenharmony_ci#define MANTIS_GPIF_CS2RWWREN3		BIT(31)
1228c2ecf20Sopenharmony_ci#define MANTIS_GPIF_CS2RWDELY3		(0x3f << 24)
1238c2ecf20Sopenharmony_ci#define MANTIS_GPIF_CS2RWWREN2		BIT(23)
1248c2ecf20Sopenharmony_ci#define MANTIS_GPIF_CS2RWDELY2		(0x3f << 16)
1258c2ecf20Sopenharmony_ci#define MANTIS_GPIF_CS2RWWREN1		BIT(15)
1268c2ecf20Sopenharmony_ci#define MANTIS_GPIF_CS2RWDELY1		(0x3f <<  8)
1278c2ecf20Sopenharmony_ci#define MANTIS_GPIF_CS2RWWREN0		BIT(7)
1288c2ecf20Sopenharmony_ci#define MANTIS_GPIF_CS2RWDELY0		(0x3f <<  0)
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci#define MANTIS_GPIF_IRQCFG		0x98
1318c2ecf20Sopenharmony_ci#define MANTIS_GPIF_IRQPOL		BIT(8)
1328c2ecf20Sopenharmony_ci#define MANTIS_MASK_WRACK		BIT(7)
1338c2ecf20Sopenharmony_ci#define MANTIS_MASK_BRRDY		BIT(6)
1348c2ecf20Sopenharmony_ci#define MANTIS_MASK_OVFLW		BIT(5)
1358c2ecf20Sopenharmony_ci#define MANTIS_MASK_OTHERR		BIT(4)
1368c2ecf20Sopenharmony_ci#define MANTIS_MASK_WSTO		BIT(3)
1378c2ecf20Sopenharmony_ci#define MANTIS_MASK_EXTIRQ		BIT(2)
1388c2ecf20Sopenharmony_ci#define MANTIS_MASK_PLUGIN		BIT(1)
1398c2ecf20Sopenharmony_ci#define MANTIS_MASK_PLUGOUT		BIT(0)
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci#define MANTIS_GPIF_STATUS		0x9c
1428c2ecf20Sopenharmony_ci#define MANTIS_SBUF_KILLOP		BIT(15)
1438c2ecf20Sopenharmony_ci#define MANTIS_SBUF_OPDONE		BIT(14)
1448c2ecf20Sopenharmony_ci#define MANTIS_SBUF_EMPTY		BIT(13)
1458c2ecf20Sopenharmony_ci#define MANTIS_GPIF_DETSTAT		BIT(9)
1468c2ecf20Sopenharmony_ci#define MANTIS_GPIF_INTSTAT		BIT(8)
1478c2ecf20Sopenharmony_ci#define MANTIS_GPIF_WRACK		BIT(7)
1488c2ecf20Sopenharmony_ci#define MANTIS_GPIF_BRRDY		BIT(6)
1498c2ecf20Sopenharmony_ci#define MANTIS_SBUF_OVFLW		BIT(5)
1508c2ecf20Sopenharmony_ci#define MANTIS_GPIF_OTHERR		BIT(4)
1518c2ecf20Sopenharmony_ci#define MANTIS_SBUF_WSTO		BIT(3)
1528c2ecf20Sopenharmony_ci#define MANTIS_GPIF_EXTIRQ		BIT(2)
1538c2ecf20Sopenharmony_ci#define MANTIS_CARD_PLUGIN		BIT(1)
1548c2ecf20Sopenharmony_ci#define MANTIS_CARD_PLUGOUT		BIT(0)
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ci#define MANTIS_GPIF_BRADDR		0xa0
1578c2ecf20Sopenharmony_ci#define MANTIS_GPIF_PCMCIAREG		BIT(27)
1588c2ecf20Sopenharmony_ci#define MANTIS_GPIF_PCMCIAIOM		BIT(26)
1598c2ecf20Sopenharmony_ci#define MANTIS_GPIF_BR_ADDR		(0xfffffff	<<  0)
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ci#define MANTIS_GPIF_BRBYTES		0xa4
1628c2ecf20Sopenharmony_ci#define MANTIS_GPIF_BRCNT		(0xfff		<<  0)
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_ci#define MANTIS_PCMCIA_RESET		0xa8
1658c2ecf20Sopenharmony_ci#define MANTIS_PCMCIA_RSTVAL		(0xff << 0)
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_ci#define MANTIS_CARD_RESET		0xac
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_ci#define MANTIS_GPIF_ADDR		0xb0
1708c2ecf20Sopenharmony_ci#define MANTIS_GPIF_HIFRDWRN		BIT(31)
1718c2ecf20Sopenharmony_ci#define MANTIS_GPIF_PCMCIAREG		BIT(27)
1728c2ecf20Sopenharmony_ci#define MANTIS_GPIF_PCMCIAIOM		BIT(26)
1738c2ecf20Sopenharmony_ci#define MANTIS_GPIF_HIFADDR		(0xfffffff	<<  0)
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_ci#define MANTIS_GPIF_DOUT		0xb4
1768c2ecf20Sopenharmony_ci#define MANTIS_GPIF_HIFDOUT		(0xfffffff	<<  0)
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci#define MANTIS_GPIF_DIN			0xb8
1798c2ecf20Sopenharmony_ci#define MANTIS_GPIF_HIFDIN		(0xfffffff	<<  0)
1808c2ecf20Sopenharmony_ci
1818c2ecf20Sopenharmony_ci#define MANTIS_GPIF_SPARE		0xbc
1828c2ecf20Sopenharmony_ci#define MANTIS_GPIF_LOGICRD		(0xffff		<< 16)
1838c2ecf20Sopenharmony_ci#define MANTIS_GPIF_LOGICRW		(0xffff		<<  0)
1848c2ecf20Sopenharmony_ci
1858c2ecf20Sopenharmony_ci#endif /* __MANTIS_REG_H */
186