exynos_reg.h revision 1.8 1 1.1 matt /* $NetBSD */
2 1.1 matt /*-
3 1.1 matt * Copyright (c) 2014 The NetBSD Foundation, Inc.
4 1.1 matt * All rights reserved.
5 1.1 matt *
6 1.1 matt * This code is derived from software contributed to The NetBSD Foundation
7 1.1 matt * by Reinoud Zandijk.
8 1.1 matt *
9 1.1 matt * Redistribution and use in source and binary forms, with or without
10 1.1 matt * modification, are permitted provided that the following conditions
11 1.1 matt * are met:
12 1.1 matt * 1. Redistributions of source code must retain the above copyright
13 1.1 matt * notice, this list of conditions and the following disclaimer.
14 1.1 matt * 2. Redistributions in binary form must reproduce the above copyright
15 1.1 matt * notice, this list of conditions and the following disclaimer in the
16 1.1 matt * documentation and/or other materials provided with the distribution.
17 1.1 matt *
18 1.1 matt * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 1.1 matt * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 1.1 matt * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 1.1 matt * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 1.1 matt * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 1.1 matt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 1.1 matt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 1.1 matt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 1.1 matt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 1.1 matt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 1.1 matt * POSSIBILITY OF SUCH DAMAGE.
29 1.1 matt */
30 1.1 matt
31 1.1 matt #ifndef _ARM_SAMSUNG_EXYNOS_REG_H_
32 1.1 matt #define _ARM_SAMSUNG_EXYNOS_REG_H_
33 1.1 matt
34 1.1 matt /*
35 1.1 matt *
36 1.1 matt * The exynos can boot from its iROM or from an external Nand memory. Since
37 1.1 matt * these are normally hardly used they are excluded from the normal register
38 1.1 matt * space here.
39 1.1 matt *
40 1.1 matt * XXX What about the audio subsystem region. Where are the docs?
41 1.1 matt *
42 1.1 matt * EXYNOS_CORE_PBASE points to the main SFR region.
43 1.1 matt *
44 1.1 matt * Notes:
45 1.1 matt *
46 1.1 matt * SFR Special Function Register
47 1.1 matt * ISP In-System Programming, like a JTAG
48 1.1 matt * ACP Accelerator Coherency Port
49 1.1 matt * SSS Security Sub System
50 1.1 matt * GIC Generic Interurrupt Controller
51 1.1 matt * PMU Power Management Unit
52 1.1 matt * DMC 2D Graphics engine
53 1.1 matt * LEFTBUS Data bus / Peripheral bus
54 1.1 matt * RIGHTBUS ,,
55 1.1 matt * G3D 3D Graphics engine
56 1.1 matt * MFC Multi-Format Codec
57 1.1 matt * LCD0 LCD display
58 1.1 matt * MCT Multi Core Timer
59 1.1 matt * CMU Clock Management Unit
60 1.1 matt * TMU Thermal Management Unit
61 1.1 matt * PPMU Pin Parametric Measurement Unit (?)
62 1.1 matt * MMU Memory Management Unit
63 1.1 matt * MCTimer ?
64 1.1 matt * WDT Watch Dog Timer
65 1.1 matt * RTC Real Time Clock
66 1.1 matt * KEYIF Keypad interface
67 1.1 matt * SECKEY ?
68 1.1 matt * TZPC TrustZone Protection Controller
69 1.1 matt * UART Universal asynchronous receiver/transmitter
70 1.1 matt * I2C Inter IC Connect
71 1.1 matt * SPI Serial Peripheral Interface Bus
72 1.1 matt * I2S Inter-IC Sound, Integrated Interchip Sound, or IIS
73 1.1 matt * PCM Pulse-code modulation, audio stream at set fixed rate
74 1.1 matt * SPDIF Sony/Philips Digital Interface Format
75 1.1 matt * Slimbus Serial Low-power Inter-chip Media Bus
76 1.1 matt * SMMU System mmu. No idea as how its programmed (or not)
77 1.1 matt * PERI-L UART, I2C, SPI, I2S, PCM, SPDIF, PWM, I2CHDMI, Slimbus
78 1.1 matt * PERI-R CHIPID, SYSREG, PMU/CMU/TMU Bus I/F, MCTimer, WDT, RTC, KEYIF,
79 1.1 matt * SECKEY, TZPC
80 1.1 matt */
81 1.1 matt
82 1.1 matt /*
83 1.1 matt * Common to Exynos4 and Exynos 5
84 1.1 matt * */
85 1.1 matt #define EXYNOS_CORE_PBASE 0x10000000 /* SFR */
86 1.1 matt #define EXYNOS_CORE_SIZE 0x10000000
87 1.1 matt
88 1.1 matt
89 1.1 matt #define EXYNOS_CHIPID_OFFSET 0x00000000
90 1.1 matt #define EXYNOS_PROD_ID_OFFSET (EXYNOS_CHIPID_OFFSET + 0)
91 1.1 matt #define EXYNOS_PACKAGE_ID_OFFSET (EXYNOS_CHIPID_OFFSET + 4)
92 1.1 matt
93 1.1 matt #define EXYNOS_PACKAGE_ID_2_GIG 0x06030058
94 1.1 matt
95 1.1 matt /* standard block size for offsets defined below */
96 1.1 matt #define EXYNOS_BLOCK_SIZE 0x00010000
97 1.1 matt
98 1.1 matt
99 1.1 matt #if defined(EXYNOS5)
100 1.1 matt #include <arm/samsung/exynos5_reg.h>
101 1.1 matt #endif
102 1.1 matt #if defined(EXYNOS4)
103 1.1 matt #include <arm/samsung/exynos4_reg.h>
104 1.1 matt #endif
105 1.1 matt
106 1.3 reinoud
107 1.3 reinoud /* standard frequency settings */
108 1.3 reinoud #define EXYNOS_ACLK_REF_FREQ (200*1000*1000) /* 200 Mhz */
109 1.3 reinoud #define EXYNOS_UART_FREQ (109*1000*1000) /* should be EXYNOS_ACLK_REF_FREQ! */
110 1.5 reinoud
111 1.5 reinoud #define EXYNOS_F_IN_FREQ (24*1000*1000) /* 24 Mhz */
112 1.5 reinoud #define EXYNOS_USB_FREQ EXYNOS_F_IN_FREQ/* 24 Mhz */
113 1.5 reinoud
114 1.3 reinoud
115 1.8 reinoud /* PLLs */
116 1.8 reinoud #define PLL_LOCK_OFFSET 0x000
117 1.8 reinoud #define PLL_CON0_OFFSET 0x100
118 1.8 reinoud #define PLL_CON1_OFFSET 0x104
119 1.8 reinoud
120 1.8 reinoud #define PLL_CON0_ENABLE __BIT(31)
121 1.8 reinoud #define PLL_CON0_LOCKED __BIT(29) /* has the PLL locked on */
122 1.8 reinoud #define PLL_CON0_M __BITS(16,25) /* PLL M divide value */
123 1.8 reinoud #define PLL_CON0_P __BITS( 8,13) /* PLL P divide value */
124 1.8 reinoud #define PLL_CON0_S __BITS( 0, 2) /* PLL S divide value */
125 1.8 reinoud
126 1.8 reinoud #define PLL_PMS2FREQ(F, M, P, S) (((M)*(F))/((P)*(1<<(S))))
127 1.8 reinoud #define PLL_FREQ(f, v) PLL_PMS2FREQ( \
128 1.8 reinoud (f),\
129 1.8 reinoud __SHIFTOUT((v), PLL_CON0_M),\
130 1.8 reinoud __SHIFTOUT((v), PLL_CON0_P),\
131 1.8 reinoud __SHIFTOUT((v), PLL_CON0_S))
132 1.8 reinoud
133 1.8 reinoud
134 1.3 reinoud /* Watchdog register definitions */
135 1.3 reinoud #define EXYNOS_WDT_WTCON 0x0000
136 1.3 reinoud #define WTCON_PRESCALER __BITS(15,8)
137 1.3 reinoud #define WTCON_ENABLE __BIT(5)
138 1.3 reinoud #define WTCON_CLOCK_SELECT __BITS(4,3)
139 1.3 reinoud #define WTCON_CLOCK_SELECT_16 __SHIFTIN(0, WTCON_CLOCK_SELECT)
140 1.3 reinoud #define WTCON_CLOCK_SELECT_32 __SHIFTIN(1, WTCON_CLOCK_SELECT)
141 1.3 reinoud #define WTCON_CLOCK_SELECT_64 __SHIFTIN(2, WTCON_CLOCK_SELECT)
142 1.3 reinoud #define WTCON_CLOCK_SELECT_128 __SHIFTIN(3, WTCON_CLOCK_SELECT)
143 1.3 reinoud #define WTCON_INT_ENABLE __BIT(2)
144 1.3 reinoud #define WTCON_RESET_ENABLE __BIT(0)
145 1.3 reinoud #define EXYNOS_WDT_WTDAT 0x0004
146 1.3 reinoud #define WTDAT_RELOAD __BITS(15,0)
147 1.3 reinoud #define EXYNOS_WDT_WTCNT 0x0008
148 1.3 reinoud #define WTCNT_COUNT __BITS(15,0)
149 1.3 reinoud #define EXYNOS_WDT_WTCLRINT 0x000C
150 1.3 reinoud
151 1.3 reinoud
152 1.4 reinoud /* GPIO register definitions */
153 1.4 reinoud #define EXYNOS_GPIO_GRP_SIZE 0x20
154 1.4 reinoud #define EXYNOS_GPIO_CON 0x00
155 1.4 reinoud #define EXYNOS_GPIO_DAT 0x04
156 1.4 reinoud #define EXYNOS_GPIO_PUD 0x08
157 1.4 reinoud #define EXYNOS_GPIO_DRV 0x0C
158 1.4 reinoud #define EXYNOS_GPIO_CONPWD 0x10
159 1.4 reinoud #define EXYNOS_GPIO_PUDPWD 0x14
160 1.4 reinoud /* rest of space is not used */
161 1.4 reinoud
162 1.4 reinoud #define EXYNOS_GPIO_FUNC_INPUT 0x0
163 1.4 reinoud #define EXYNOS_GPIO_FUNC_OUTPUT 0x1
164 1.7 wiz /* intermediate values are devices, definitions dependent on pin */
165 1.4 reinoud #define EXYNOS_GPIO_FUNC_EXTINT 0xF
166 1.4 reinoud
167 1.4 reinoud #define EXYNOS_GPIO_PIN_FLOAT 0
168 1.4 reinoud #define EXYNOS_GPIO_PIN_PULL_DOWN 1
169 1.4 reinoud #define EXYNOS_GPIO_PIN_PULL_UP 3
170 1.4 reinoud
171 1.4 reinoud
172 1.6 reinoud /* used PMU registers */
173 1.6 reinoud /* Exynos 4210 or Exynos 5 */
174 1.6 reinoud #define EXYNOS_PMU_USBDEV_PHY_CTRL 0x704
175 1.6 reinoud #define EXYNOS_PMU_USBHOST_PHY_CTRL 0x708
176 1.6 reinoud /* Exynos 4x12 */
177 1.6 reinoud #define EXYNOS_PMU_USB_PHY_CTRL 0x704
178 1.6 reinoud #define EXYNOS_PMU_USB_HSIC_1_PHY_CTRL 0x708
179 1.6 reinoud #define EXYNOS_PMU_USB_HSIC_2_PHY_CTRL 0x70C
180 1.6 reinoud
181 1.6 reinoud #define PMU_PHY_ENABLE (1<< 0)
182 1.6 reinoud #define PMU_PHY_DISABLE (0)
183 1.6 reinoud
184 1.6 reinoud
185 1.6 reinoud /* used SYSREG registers */
186 1.6 reinoud #define EXYNOS5_SYSREG_USB20_PHY_TYPE 0x230
187 1.6 reinoud
188 1.6 reinoud
189 1.6 reinoud /* used USB PHY registers */
190 1.6 reinoud #define USB_PHYPWR 0x00
191 1.6 reinoud #define PHYPWR_FORCE_SUSPEND __BIT(1)
192 1.6 reinoud #define PHYPWR_ANALOG_POWERDOWN __BIT(3)
193 1.6 reinoud #define PHYPWR_OTG_DISABLE __BIT(4)
194 1.6 reinoud #define PHYPWR_SLEEP_PHY0 __BIT(5)
195 1.6 reinoud #define PHYPWR_NORMAL_MASK 0x19
196 1.6 reinoud #define PHYPWR_NORMAL_MASK_PHY0 (__BITS(3,3) | 1)
197 1.6 reinoud #define PHYPWR_NORMAL_MASK_PHY1 __BITS(6,3)
198 1.6 reinoud #define PHYPWR_NORMAL_MASK_HSIC0 __BITS(9,3)
199 1.6 reinoud #define PHYPWR_NORMAL_MASK_HSIC1 __BITS(12,3)
200 1.6 reinoud #define USB_PHYCLK 0x04
201 1.6 reinoud #define USB_RSTCON 0x08
202 1.6 reinoud #define RSTCON_SWRST __BIT(0)
203 1.6 reinoud #define RSTCON_HLINK_RWRST __BIT(1)
204 1.6 reinoud #define RSTCON_DEVPHYLINK_SWRST __BIT(2)
205 1.6 reinoud #define RSTCON_DEVPHY_SWRST __BITS(0,3)
206 1.6 reinoud #define RSTCON_HOSTPHY_SWRST __BITS(3,4)
207 1.6 reinoud #define RSTCON_HOSTPHYLINK_SWRST __BITS(7,4)
208 1.6 reinoud
209 1.1 matt #endif /* _ARM_SAMSUNG_EXYNOS_REG_H_ */
210