xref: /freebsd/sys/dev/qcom_qup/qcom_qup_reg.h (revision 61e21613)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2021 Adrian Chadd <adrian@FreeBSD.org>
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  */
27 
28 #ifndef	__QCOM_QUP_REG_H__
29 #define	__QCOM_QUP_REG_H__
30 
31 #define	QUP_CONFIG			0x0000
32 #define		QUP_CONFIG_N			0x001f
33 #define		QUP_CONFIG_SPI_MODE		(1U << 8)
34 #define		QUP_CONFIG_MINI_CORE_I2C_MASTER	(2U << 8)
35 #define		QUP_CONFIG_MINI_CORE_I2C_SLAVE	(3U << 8)
36 
37 #define		QUP_CONFIG_NO_OUTPUT		(1U << 6)
38 #define		QUP_CONFIG_NO_INPUT		(1U << 7)
39 #define		QUP_CONFIG_APP_CLK_ON_EN	(1 << 12)
40 #define		QUP_CONFIG_CLOCK_AUTO_GATE	(1U << 13)
41 
42 #define	QUP_STATE			0x0004
43 #define		QUP_STATE_VALID		(1U << 2)
44 #define		QUP_STATE_RESET		0
45 #define		QUP_STATE_RUN		1
46 #define		QUP_STATE_PAUSE		3
47 #define		QUP_STATE_MASK		3
48 #define		QUP_STATE_CLEAR		2
49 
50 #define	QUP_IO_M_MODES			0x0008
51 #define		QUP_IO_M_OUTPUT_BLOCK_SIZE_MASK		0x3
52 #define		QUP_IO_M_OUTPUT_BLOCK_SIZE_SHIFT	0
53 
54 #define		QUP_IO_M_OUTPUT_FIFO_SIZE_MASK		0x7
55 #define		QUP_IO_M_OUTPUT_FIFO_SIZE_SHIFT		2
56 
57 #define		QUP_IO_M_INPUT_BLOCK_SIZE_MASK		0x3
58 #define		QUP_IO_M_INPUT_BLOCK_SIZE_SHIFT		5
59 
60 #define		QUP_IO_M_INPUT_FIFO_SIZE_MASK		0x7
61 #define		QUP_IO_M_INPUT_FIFO_SIZE_SHIFT		7
62 
63 #define		QUP_IO_M_PACK_EN		(1U << 15)
64 #define		QUP_IO_M_UNPACK_EN		(1U << 14)
65 #define		QUP_IO_M_INPUT_MODE_SHIFT	12
66 #define		QUP_IO_M_OUTPUT_MODE_SHIFT	10
67 #define		QUP_IO_M_INPUT_MODE_MASK	0x3
68 #define		QUP_IO_M_OUTPUT_MODE_MASK	0x3
69 
70 #define		QUP_IO_M_MODE_FIFO		0
71 #define		QUP_IO_M_MODE_BLOCK		1
72 #define		QUP_IO_M_MODE_DMOV		2
73 #define		QUP_IO_M_MODE_BAM		3
74 
75 #define	QUP_SW_RESET			0x000c
76 
77 #define	QUP_OPERATIONAL			0x0018
78 #define		QUP_OP_IN_BLOCK_READ_REQ	(1U << 13)
79 #define		QUP_OP_OUT_BLOCK_WRITE_REQ	(1U << 12)
80 #define		QUP_OP_MAX_INPUT_DONE_FLAG	(1U << 11)
81 #define		QUP_OP_MAX_OUTPUT_DONE_FLAG	(1U << 10)
82 #define		QUP_OP_IN_SERVICE_FLAG		(1U << 9)
83 #define		QUP_OP_OUT_SERVICE_FLAG		(1U << 8)
84 #define		QUP_OP_IN_FIFO_FULL		(1U << 7)
85 #define		QUP_OP_OUT_FIFO_FULL		(1U << 6)
86 #define		QUP_OP_IN_FIFO_NOT_EMPTY	(1U << 5)
87 #define		QUP_OP_OUT_FIFO_NOT_EMPTY	(1U << 4)
88 
89 #define	QUP_ERROR_FLAGS			0x001c
90 #define	QUP_ERROR_FLAGS_EN		0x0020
91 #define		QUP_ERROR_OUTPUT_OVER_RUN	(1U << 5)
92 #define		QUP_ERROR_INPUT_UNDER_RUN	(1U << 4)
93 #define		QUP_ERROR_OUTPUT_UNDER_RUN	(1U << 3)
94 #define		QUP_ERROR_INPUT_OVER_RUN	(1U << 2)
95 
96 #define	QUP_OPERATIONAL_MASK		0x0028
97 
98 #define	QUP_HW_VERSION			0x0030
99 #define		QUP_HW_VERSION_2_1_1		0x20010001
100 
101 #define	QUP_MX_OUTPUT_CNT		0x0100
102 #define	QUP_MX_OUTPUT_CNT_CURRENT	0x0104
103 #define	QUP_OUTPUT_FIFO			0x0110
104 #define	QUP_MX_WRITE_CNT		0x0150
105 #define	QUP_MX_WRITE_CNT_CURRENT	0x0154
106 #define	QUP_MX_INPUT_CNT		0x0200
107 #define	QUP_MX_INPUT_CNT_CURRENT	0x0204
108 #define	QUP_MX_READ_CNT			0x0208
109 #define	QUP_MX_READ_CNT_CURRENT		0x020c
110 #define	QUP_INPUT_FIFO			0x0218
111 
112 #endif	/* __QCOM_QUP_REG_H__ */
113 
114