xref: /f-stack/freebsd/mips/mediatek/mtk_sysctl.h (revision 22ce4aff)
1 /*-
2  * Copyright (c) 2016 Stanislav Galabov.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice unmodified, this list of conditions, and the following
10  *    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  * $FreeBSD$
28  */
29 
30 #ifndef _MTK_SYSCTL_H_
31 #define _MTK_SYSCTL_H_
32 
33 /* System Control */
34 #define SYSCTL_CHIPID0_3	0x00
35 #define SYSCTL_CHIPID4_7	0x04
36 
37 #define SYSCTL_REVID		0x0C
38 #define SYSCTL_REVID_MASK	0xFFFF
39 #define SYSCTL_MT7621_REV_E	0x0101
40 
41 #define SYSCTL_SYSCFG		0x10
42 #define SYSCTL_SYSCFG1		0x14
43 #define SYSCTL_CLKCFG0		0x2C
44 #define SYSCTL_CLKCFG1		0x30
45 #define SYSCTL_RSTCTRL		0x34
46 #define SYSCTL_GPIOMODE		0x60
47 
48 #define SYSCTL_CUR_CLK_STS	0x44
49 
50 #define SYSCTL_MT7620_CPLL_CFG0	0x54
51 #define SYSCTL_MT7620_CPLL_CFG1	0x58
52 
53 #define SYSCFG1_USB_HOST_MODE	(1<<10)
54 
55 #define RT3350_CHIPID0_3	0x33335452
56 
57 #define MTK_UNKNOWN_CHIPID0_3	0x6E6B6E75	/* "unkn" */
58 #define MTK_UNKNOWN_CHIPID4_7	0x206E776F	/* "own " */
59 
60 extern uint32_t	mtk_sysctl_get(uint32_t);
61 extern void	mtk_sysctl_set(uint32_t, uint32_t);
62 extern void	mtk_sysctl_clr_set(uint32_t, uint32_t, uint32_t);
63 
64 #endif /* _MTK_SYSCTL_H_ */
65