blob: e42805fa012db05c8ae4dd515dacde35aabb53ca [file] [log] [blame]
Stefan Bosch48397f12020-07-10 19:07:25 +02001/* SPDX-License-Identifier: GPL-2.0+
2 *
3 * (C) Copyright 2016 Nexell
4 * Hyunseok, Jung <hsjung@nexell.co.kr>
5 */
6
7#ifndef __NEXELL_H__
8#define __NEXELL_H__
9
10#define PHY_BASEADDR_DMA0 (0xC0000000)
11#define PHY_BASEADDR_DMA1 (0xC0001000)
12#if defined(CONFIG_ARCH_S5P4418)
13#define PHY_BASEADDR_INTC0 (0xC0002000)
14#define PHY_BASEADDR_INTC1 (0xC0003000)
15#elif defined(CONFIG_ARCH_S5P6818)
16#define PHY_BASEADDR_INTC (0xC0008000)
17#endif
18#define PHY_BASEADDR_CLKPWR (0xC0010000)
19#define PHY_BASEADDR_RTC (0xC0010C00)
20#define PHY_BASEADDR_ALIVE (0xC0010800)
21#define PHY_BASEADDR_RSTCON (0xC0012000)
22#define PHY_BASEADDR_TIEOFF (0xC0011000)
23#define PHY_BASEADDR_PDM (0xC0014000)
24#define PHY_BASEADDR_CRYPTO (0xC0015000)
25#define PHY_BASEADDR_TIMER (0xC0017000)
26#define PHY_BASEADDR_PWM (0xC0018000)
27#define PHY_BASEADDR_WDT (0xC0019000)
28#define PHY_BASEADDR_GPIOA (0xC001A000)
29#define PHY_BASEADDR_GPIOB (0xC001B000)
30#define PHY_BASEADDR_GPIOC (0xC001C000)
31#define PHY_BASEADDR_GPIOD (0xC001D000)
32#define PHY_BASEADDR_GPIOE (0xC001E000)
33#define PHY_BASEADDR_OHCI (0xC0020000)
34#define PHY_BASEADDR_EHCI (0xC0030000)
35#define PHY_BASEADDR_HSOTG (0xC0040000)
36#define PHY_BASEADDR_ADC (0xC0053000)
37#define PHY_BASEADDR_PPM (0xC0054000)
38#define PHY_BASEADDR_I2S0 (0xC0055000)
39#define PHY_BASEADDR_I2S1 (0xC0056000)
40#define PHY_BASEADDR_I2S2 (0xC0057000)
41#define PHY_BASEADDR_AC97 (0xC0058000)
42#define PHY_BASEADDR_SPDIF_TX (0xC0059000)
43#define PHY_BASEADDR_SPDIF_RX (0xC005A000)
44#define PHY_BASEADDR_SSP0 (0xC005B000)
45#define PHY_BASEADDR_SSP1 (0xC005C000)
46#define PHY_BASEADDR_SSP2 (0xC005F000)
47#define PHY_BASEADDR_MPEGTSI (0xC005D000)
48#define PHY_BASEADDR_GMAC (0xC0060000)
49#define PHY_BASEADDR_VIP0 (0xC0063000)
50#define PHY_BASEADDR_VIP1 (0xC0064000)
51#if defined(CONFIG_ARCH_S5P6818)
52#define PHY_BASEADDR_VIP2 (0xC0099000)
53#endif
54#define PHY_BASEADDR_DEINTERLACE (0xC0065000)
55#define PHY_BASEADDR_SCALER (0xC0066000)
56#define PHY_BASEADDR_ECID (0xC0067000)
57#define PHY_BASEADDR_SDMMC0 (0xC0062000)
58#define PHY_BASEADDR_SDMMC1 (0xC0068000)
59#define PHY_BASEADDR_SDMMC2 (0xC0069000)
60#define PHY_BASEADDR_MALI400 (0xC0070000)
61#define PHY_BASEADDR_CODA_APB0 (0xC0080000)
62#define PHY_BASEADDR_CODA_APB1 (0xC0081000)
63#define PHY_BASEADDR_CODA_APB2 (0xC0082000)
64#define PHY_BASEADDR_CODA_APB3 (0xC0083000)
65/* dma (O), modem(X), UART0_MODULE */
66#define PHY_BASEADDR_UART0 (0xC00A1000)
67/* dma (O), modem(O), pl01115_Uart_modem_MODULE */
68#define PHY_BASEADDR_UART1 (0xC00A0000)
69/* dma (O), modem(X), UART1_MODULE */
70#define PHY_BASEADDR_UART2 (0xC00A2000)
71/* dma (X), modem(X), pl01115_Uart_nodma0_MODULE */
72#define PHY_BASEADDR_UART3 (0xC00A3000)
73/* dma (X), modem(X), pl01115_Uart_nodma1_MODULE */
74#define PHY_BASEADDR_UART4 (0xC006D000)
75/* dma (X), modem(X), pl01115_Uart_nodma2_MODULE */
76#define PHY_BASEADDR_UART5 (0xC006F000)
77#define PHY_BASEADDR_I2C0 (0xC00A4000)
78#define PHY_BASEADDR_I2C1 (0xC00A5000)
79#define PHY_BASEADDR_I2C2 (0xC00A6000)
80#define PHY_BASEADDR_CAN0 (0xC00CE000)
81#define PHY_BASEADDR_CAN1 (0xC00CF000)
82#define PHY_BASEADDR_MIPI (0xC00D0000)
83#define PHY_BASEADDR_DISPLAYTOP (0xC0100000)
84
85#define PHY_BASEADDR_CLKGEN0 (0xC00BB000) /* TIMER_1 */
86#define PHY_BASEADDR_CLKGEN1 (0xC00BC000) /* TIMER_2 */
87#define PHY_BASEADDR_CLKGEN2 (0xC00BD000) /* TIMER_3 */
88#define PHY_BASEADDR_CLKGEN3 (0xC00BE000) /* PWM_1 */
89#define PHY_BASEADDR_CLKGEN4 (0xC00BF000) /* PWM_2 */
90#define PHY_BASEADDR_CLKGEN5 (0xC00C0000) /* PWM_3 */
91#define PHY_BASEADDR_CLKGEN6 (0xC00AE000) /* I2C_0 */
92#define PHY_BASEADDR_CLKGEN7 (0xC00AF000) /* I2C_1 */
93#define PHY_BASEADDR_CLKGEN8 (0xC00B0000) /* I2C_2 */
94#define PHY_BASEADDR_CLKGEN9 (0xC00CA000) /* MIPI */
95#define PHY_BASEADDR_CLKGEN10 (0xC00C8000) /* GMAC */
96#define PHY_BASEADDR_CLKGEN11 (0xC00B8000) /* SPDIF_TX */
97#define PHY_BASEADDR_CLKGEN12 (0xC00B7000) /* MPEGTSI */
98#define PHY_BASEADDR_CLKGEN13 (0xC00BA000) /* PWM_0 */
99#define PHY_BASEADDR_CLKGEN14 (0xC00B9000) /* TIMER_0 */
100#define PHY_BASEADDR_CLKGEN15 (0xC00B2000) /* I2S_0 */
101#define PHY_BASEADDR_CLKGEN16 (0xC00B3000) /* I2S_1 */
102#define PHY_BASEADDR_CLKGEN17 (0xC00B4000) /* I2S_2 */
103#define PHY_BASEADDR_CLKGEN18 (0xC00C5000) /* SDHC_0 */
104#define PHY_BASEADDR_CLKGEN19 (0xC00CC000) /* SDHC_1 */
105#define PHY_BASEADDR_CLKGEN20 (0xC00CD000) /* SDHC_2 */
106#define PHY_BASEADDR_CLKGEN21 (0xC00C3000) /* MALI */
107#define PHY_BASEADDR_CLKGEN22 (0xC00A9000) /* UART_0 */
108#define PHY_BASEADDR_CLKGEN23 (0xC00AA000) /* UART_2 */
109#define PHY_BASEADDR_CLKGEN24 (0xC00A8000) /* UART_1 */
110#define PHY_BASEADDR_CLKGEN25 (0xC00AB000) /* UART_3 */
111#define PHY_BASEADDR_CLKGEN26 (0xC006E000) /* UART_4 */
112#define PHY_BASEADDR_CLKGEN27 (0xC00B1000) /* UART_5 */
113#define PHY_BASEADDR_CLKGEN28 (0xC00B5000) /* DEINTERLACE */
114#define PHY_BASEADDR_CLKGEN29 (0xC00C4000) /* PPM */
115#define PHY_BASEADDR_CLKGEN30 (0xC00C1000) /* VIP_0 */
116#define PHY_BASEADDR_CLKGEN31 (0xC00C2000) /* VIP_1 */
117#define PHY_BASEADDR_CLKGEN32 (0xC006B000) /* USB2HOST */
118#define PHY_BASEADDR_CLKGEN33 (0xC00C7000) /* CODA */
119#define PHY_BASEADDR_CLKGEN34 (0xC00C6000) /* CRYPTO */
120#define PHY_BASEADDR_CLKGEN35 (0xC00B6000) /* SCALER */
121#define PHY_BASEADDR_CLKGEN36 (0xC00CB000) /* PDM */
122#define PHY_BASEADDR_CLKGEN37 (0xC00AC000) /* SPI0 */
123#define PHY_BASEADDR_CLKGEN38 (0xC00AD000) /* SPI1 */
124#define PHY_BASEADDR_CLKGEN39 (0xC00A7000) /* SPI2 */
125#if defined(CONFIG_ARCH_S5P6818)
126#define PHY_BASEADDR_CLKGEN40 (0xC009A000)
127#endif
128#define PHY_BASEADDR_DREX (0xC00E0000)
129
130#define PHY_BASEADDR_CS_NAND (0x2C000000)
131
132#define PHY_BASEADDR_SRAM (0xFFFF0000)
133
134/*
135 * Nexell clock generator
136 */
137#define CLK_ID_TIMER_1 0
138#define CLK_ID_TIMER_2 1
139#define CLK_ID_TIMER_3 2
140#define CLK_ID_PWM_1 3
141#define CLK_ID_PWM_2 4
142#define CLK_ID_PWM_3 5
143#define CLK_ID_I2C_0 6
144#define CLK_ID_I2C_1 7
145#define CLK_ID_I2C_2 8
146#define CLK_ID_MIPI 9
147#define CLK_ID_GMAC 10 /* External Clock 1 */
148#define CLK_ID_SPDIF_TX 11
149#define CLK_ID_MPEGTSI 12
150#define CLK_ID_PWM_0 13
151#define CLK_ID_TIMER_0 14
152#define CLK_ID_I2S_0 15 /* External Clock 1 */
153#define CLK_ID_I2S_1 16 /* External Clock 1 */
154#define CLK_ID_I2S_2 17 /* External Clock 1 */
155#define CLK_ID_SDHC_0 18
156#define CLK_ID_SDHC_1 19
157#define CLK_ID_SDHC_2 20
158#define CLK_ID_MALI 21
159#define CLK_ID_UART_0 22 /* UART0_MODULE */
160#define CLK_ID_UART_2 23 /* UART1_MODULE */
161#define CLK_ID_UART_1 24 /* pl01115_Uart_modem_MODULE */
162#define CLK_ID_UART_3 25 /* pl01115_Uart_nodma0_MODULE */
163#define CLK_ID_UART_4 26 /* pl01115_Uart_nodma1_MODULE */
164#define CLK_ID_UART_5 27 /* pl01115_Uart_nodma2_MODULE */
165#define CLK_ID_DIT 28
166#define CLK_ID_PPM 29
167#define CLK_ID_VIP_0 30 /* External Clock 1 */
168#define CLK_ID_VIP_1 31 /* External Clock 1, 2 */
169#define CLK_ID_USB2HOST 32 /* External Clock 2 */
170#define CLK_ID_CODA 33
171#define CLK_ID_CRYPTO 34
172#define CLK_ID_SCALER 35
173#define CLK_ID_PDM 36
174#define CLK_ID_SPI_0 37
175#define CLK_ID_SPI_1 38
176#define CLK_ID_SPI_2 39
177#define CLK_ID_MAX 39
178
179/*
180 * Nexell Reset control
181 */
182#define RESET_ID_AC97 0
183#define RESET_ID_CPU1 1
184#define RESET_ID_CPU2 2
185#define RESET_ID_CPU3 3
186#define RESET_ID_WD1 4
187#define RESET_ID_WD2 5
188#define RESET_ID_WD3 6
189#define RESET_ID_CRYPTO 7
190#define RESET_ID_DEINTERLACE 8
191#define RESET_ID_DISP_TOP 9
192#define RESET_ID_DISPLAY 10
193#define RESET_ID_RESCONV 11
194#define RESET_ID_LCDIF 12
195#define RESET_ID_HDMI 13
196#define RESET_ID_HDMI_VIDEO 14
197#define RESET_ID_HDMI_SPDIF 15
198#define RESET_ID_HDMI_TMDS 16
199#define RESET_ID_HDMI_PHY 17
200#define RESET_ID_LVDS 18
201#define RESET_ID_ECID 19
202#define RESET_ID_I2C0 20
203#define RESET_ID_I2C1 21
204#define RESET_ID_I2C2 22
205#define RESET_ID_I2S0 23
206#define RESET_ID_I2S1 24
207#define RESET_ID_I2S2 25
208#define RESET_ID_DREX_C 26
209#define RESET_ID_DREX_A 27
210#define RESET_ID_DREX 28
211#define RESET_ID_MIPI 29
212#define RESET_ID_MIPI_DSI 30
213#define RESET_ID_MIPI_CSI 31
214#define RESET_ID_MIPI_PHY_S 32
215#define RESET_ID_MIPI_PHY_M 33
216#define RESET_ID_MPEGTSI 34
217#define RESET_ID_PDM 35
218#define RESET_ID_TIMER 36
219#define RESET_ID_PWM 37
220#define RESET_ID_SCALER 38
221#define RESET_ID_SDMMC0 39
222#define RESET_ID_SDMMC1 40
223#define RESET_ID_SDMMC2 41
224#define RESET_ID_SPDIFRX 42
225#define RESET_ID_SPDIFTX 43
226#define RESET_ID_SSP0_P 44
227#define RESET_ID_SSP0 45
228#define RESET_ID_SSP1_P 46
229#define RESET_ID_SSP1 47
230#define RESET_ID_SSP2_P 48
231#define RESET_ID_SSP2 49
232#define RESET_ID_UART0 50 /* UART1 */
233#define RESET_ID_UART1 51 /* pl01115_Uart_modem */
234#define RESET_ID_UART2 52 /* UART1 */
235#define RESET_ID_UART3 53 /* pl01115_Uart_nodma0 */
236#define RESET_ID_UART4 54 /* pl01115_Uart_nodma1 */
237#define RESET_ID_UART5 55 /* pl01115_Uart_nodma2 */
238#define RESET_ID_USB20HOST 56
239#define RESET_ID_USB20OTG 57
240#define RESET_ID_WDT 58
241#define RESET_ID_WDT_POR 59
242#define RESET_ID_ADC 60
243#define RESET_ID_CODA_A 61
244#define RESET_ID_CODA_P 62
245#define RESET_ID_CODA_C 63
246#define RESET_ID_DWC_GMAC 64
247#define RESET_ID_MALI400 65
248#define RESET_ID_PPM 66
249#define RESET_ID_VIP1 67
250#define RESET_ID_VIP0 68
251#if defined(CONFIG_ARCH_S5P6818)
252#define RESET_ID_VIP2 69
253#endif
254
255/*
256 * device name
257 */
258#define DEV_NAME_UART "nx-uart" /* pl0115 (amba-pl011.c) */
259#define DEV_NAME_FB "nx-fb"
260#define DEV_NAME_DISP "nx-disp"
261#define DEV_NAME_LCD "nx-lcd"
262#define DEV_NAME_LVDS "nx-lvds"
263#define DEV_NAME_HDMI "nx-hdmi"
264#define DEV_NAME_RESCONV "nx-resconv"
265#define DEV_NAME_MIPI "nx-mipi"
266#define DEV_NAME_PCM "nx-pcm"
267#define DEV_NAME_I2S "nx-i2s"
268#define DEV_NAME_SPDIF_TX "nx-spdif-tx"
269#define DEV_NAME_SPDIF_RX "nx-spdif-rx"
270#define DEV_NAME_I2C "nx-i2c"
271#define DEV_NAME_NAND "nx-nand"
272#define DEV_NAME_KEYPAD "nx-keypad"
273#define DEV_NAME_SDHC "nx-sdhc"
274#define DEV_NAME_PWM "nx-pwm"
275#define DEV_NAME_TIMER "nx-timer"
276#define DEV_NAME_SOC_PWM "nx-soc-pwm"
277#define DEV_NAME_GPIO "nx-gpio"
278#define DEV_NAME_RTC "nx-rtc"
279#define DEV_NAME_GMAC "nx-gmac"
280#define DEV_NAME_MPEGTSI "nx-mpegtsi"
281#define DEV_NAME_MALI "nx-mali"
282#define DEV_NAME_DIT "nx-deinterlace"
283#define DEV_NAME_PPM "nx-ppm"
284#define DEV_NAME_VIP "nx-vip"
285#define DEV_NAME_CODA "nx-coda"
286#define DEV_NAME_USB2HOST "nx-usb2h"
287#define DEV_NAME_CRYPTO "nx-crypto"
288#define DEV_NAME_SCALER "nx-scaler"
289#define DEV_NAME_PDM "nx-pdm"
290#define DEV_NAME_SPI "nx-spi"
291#define DEV_NAME_CPUFREQ "nx-cpufreq"
292
293/*
294 * clock generator
295 */
296#define CORECLK_NAME_PLL0 "pll0" /* cpu clock */
297#define CORECLK_NAME_PLL1 "pll1"
298#define CORECLK_NAME_PLL2 "pll2"
299#define CORECLK_NAME_PLL3 "pll3"
300#define CORECLK_NAME_FCLK "fclk"
301#define CORECLK_NAME_MCLK "mclk"
302#define CORECLK_NAME_BCLK "bclk"
303#define CORECLK_NAME_PCLK "pclk"
304#define CORECLK_NAME_HCLK "hclk"
305
306#define CORECLK_ID_PLL0 0
307#define CORECLK_ID_PLL1 1
308#define CORECLK_ID_PLL2 2
309#define CORECLK_ID_PLL3 3
310#define CORECLK_ID_FCLK 4
311#define CORECLK_ID_MCLK 5
312#define CORECLK_ID_BCLK 6
313#define CORECLK_ID_PCLK 7
314#define CORECLK_ID_HCLK 8
315
316#define ALIVEPWRGATEREG (PHY_BASEADDR_ALIVE + 0x0)
317
318#if defined(CONFIG_ARCH_S5P4418)
319#define SCR_ARM_SECOND_BOOT (0xC0010C1C) /* PWR scratch */
320#define SCR_ARM_SECOND_BOOT_REG1 (0xc0010234) /* ToDo : Check Address */
321#elif defined(CONFIG_ARCH_S5P6818)
322#define SCR_ARM_SECOND_BOOT (0xc0010230) /* PWR scratch */
323#define SCR_ARM_SECOND_BOOT_REG1 (0xc0010234) /* PWR scratch */
324#define SCR_ARM_SECOND_BOOT_REG2 (0xc0010238) /* PWR scratch */
325#endif
326
327#define SCR_ALIVE_BASE (PHY_BASEADDR_ALIVE)
328#define SCR_SIGNAGURE_RESET (SCR_ALIVE_BASE + 0x068)
329#define SCR_SIGNAGURE_SET (SCR_ALIVE_BASE + 0x06C)
330#define SCR_SIGNAGURE_READ (SCR_ALIVE_BASE + 0x070)
331
332#define SYSRSTCONFIG (0x23C)
333#define DEVICEBOOTINFO (0x50)
334#define BOOTMODE_MASK (0x7)
335#define BOOTMODE_SDMMC 5
336#define BOOTMODE_USB 6
337#define BOOTMODE_SDMMC_PORT_VAL(x) ((((x) >> 3) & 1) | \
338 (((x) >> 19 & 1) << 1))
339#define EMMC_PORT_NUM 2
340#define SD_PORT_NUM 0
341#define ID_REG_EC0 (0x54)
342#define WIRE0_MASK (0x1)
343
344#ifndef __ASSEMBLY__
345
346#define NS_IN_HZ (1000000000UL)
347#define TO_PERIOD_NS(freq) (NS_IN_HZ / (freq))
348#define TO_DUTY_NS(duty, freq) (duty ? TO_PERIOD_NS(freq) / (100 / duty) : 0)
349
350#endif /* __ASSEMBLY__ */
351
352#endif /* __NEXELL_H__ */