1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2013 Ganbold Tsagaankhuu <ganbold@freebsd.org>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 *    notice, this list of conditions and the following disclaimer in the
14 *    documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $FreeBSD$
29 */
30
31#ifndef _RK30_GRF_H_
32#define	_RK30_GRF_H_
33
34#define	RK30_GRF_BASE		0xF0008000
35
36#define	GRF_GPIO0L_DIR		0x0000
37#define	GRF_GPIO0H_DIR		0x0004
38#define	GRF_GPIO1L_DIR		0x0008
39#define	GRF_GPIO1H_DIR		0x000c
40#define	GRF_GPIO2L_DIR		0x0010
41#define	GRF_GPIO2H_DIR		0x0014
42#define	GRF_GPIO3L_DIR		0x0018
43#define	GRF_GPIO3H_DIR		0x001c
44#define	GRF_GPIO0L_DO		0x0020
45#define	GRF_GPIO0H_DO		0x0024
46#define	GRF_GPIO1L_DO		0x0028
47#define	GRF_GPIO1H_DO		0x002c
48#define	GRF_GPIO2L_DO		0x0030
49#define	GRF_GPIO2H_DO		0x0034
50#define	GRF_GPIO3L_DO		0x0038
51#define	GRF_GPIO3H_DO		0x003c
52#define	GRF_GPIO0L_EN		0x0040
53#define	GRF_GPIO0H_EN		0x0044
54#define	GRF_GPIO1L_EN		0x0048
55#define	GRF_GPIO1H_EN		0x004c
56#define	GRF_GPIO2L_EN		0x0050
57#define	GRF_GPIO2H_EN		0x0054
58#define	GRF_GPIO3L_EN		0x0058
59#define	GRF_GPIO3H_EN		0x005c
60
61#define	GRF_GPIO0C_IOMUX	0x0068
62#define	GRF_GPIO0D_IOMUX	0x006c
63#define	GRF_GPIO1A_IOMUX	0x0070
64#define	GRF_GPIO1B_IOMUX	0x0074
65#define	GRF_GPIO1C_IOMUX	0x0078
66#define	GRF_GPIO1D_IOMUX	0x007c
67#define	GRF_GPIO2A_IOMUX	0x0080
68#define	GRF_GPIO2B_IOMUX	0x0084
69#define	GRF_GPIO2C_IOMUX	0x0088
70#define	GRF_GPIO2D_IOMUX	0x008c
71#define	GRF_GPIO3A_IOMUX	0x0090
72#define	GRF_GPIO3B_IOMUX	0x0094
73#define	GRF_GPIO3C_IOMUX	0x0098
74#define	GRF_GPIO3D_IOMUX	0x009c
75#define	GRF_SOC_CON0		0x00a0
76#define	GRF_SOC_CON1		0x00a4
77#define	GRF_SOC_CON2		0x00a8
78#define	GRF_SOC_STATUS0		0x00ac
79#define	GRF_DMAC1_CON0		0x00b0
80#define	GRF_DMAC1_CON1		0x00b4
81#define	GRF_DMAC1_CON2		0x00b8
82#define	GRF_DMAC2_CON0		0x00bc
83#define	GRF_DMAC2_CON1		0x00c0
84#define	GRF_DMAC2_CON2		0x00c4
85#define	GRF_DMAC2_CON3		0x00c8
86#define	GRF_CPU_CON0		0x00cc
87#define	GRF_CPU_CON1		0x00d0
88#define	GRF_CPU_CON2		0x00d4
89#define	GRF_CPU_CON3		0x00d8
90#define	GRF_CPU_CON4		0x00dc
91#define	GRF_CPU_CON5		0x00e0
92
93#define	GRF_DDRC_CON0		0x00ec
94#define	GRF_DDRC_STAT		0x00f0
95#define	GRF_IO_CON0		0x00f4
96#define	GRF_IO_CON1		0x00f8
97#define	GRF_IO_CON2		0x00fc
98#define	GRF_IO_CON3		0x0100
99#define	GRF_IO_CON4		0x0104
100#define	GRF_SOC_STATUS1		0x0108
101#define	GRF_UOC0_CON0		0x010c
102#define	GRF_UOC0_CON1		0x0110
103#define	GRF_UOC0_CON2		0x0114
104#define	GRF_UOC0_CON3		0x0118
105#define	GRF_UOC1_CON0		0x011c
106#define	GRF_UOC1_CON1		0x0120
107#define	GRF_UOC1_CON2		0x0124
108#define	GRF_UOC1_CON3		0x0128
109#define	GRF_UOC2_CON0		0x012c
110#define	GRF_UOC2_CON1		0x0130
111
112#define	GRF_UOC3_CON0		0x0138
113#define	GRF_UOC3_CON1		0x013c
114#define	GRF_HSIC_STAT		0x0140
115#define	GRF_OS_REG0		0x0144
116#define	GRF_OS_REG1		0x0148
117#define	GRF_OS_REG2		0x014c
118#define	GRF_OS_REG3		0x0150
119#define	GRF_OS_REG4		0x0154
120#define	GRF_OS_REG5		0x0158
121#define	GRF_OS_REG6		0x015c
122#define	GRF_OS_REG7		0x0160
123#define	GRF_GPIO0B_PULL		0x0164
124#define	GRF_GPIO0C_PULL		0x0168
125#define	GRF_GPIO0D_PULL		0x016c
126#define	GRF_GPIO1A_PULL		0x0170
127#define	GRF_GPIO1B_PULL		0x0174
128#define	GRF_GPIO1C_PULL		0x0178
129#define	GRF_GPIO1D_PULL		0x017c
130#define	GRF_GPIO2A_PULL		0x0180
131#define	GRF_GPIO2B_PULL		0x0184
132#define	GRF_GPIO2C_PULL		0x0188
133#define	GRF_GPIO2D_PULL		0x018c
134#define	GRF_GPIO3A_PULL		0x0190
135#define	GRF_GPIO3B_PULL		0x0194
136#define	GRF_GPIO3C_PULL		0x0198
137#define	GRF_GPIO3D_PULL		0x019c
138#define	GRF_FLASH_DATA_PULL	0x01a0
139#define	GRF_FLASH_CMD_PULL	0x01a4
140
141void rk30_grf_gpio_pud(uint32_t bank, uint32_t pin, uint32_t state);
142
143#endif /* _RK30_GRF_H_ */
144