blob: d75aa7c346e92b09d1062d0bcab411fe1716f6c8 [file] [log] [blame]
Jorge Ramirez-Ortiz47503d22018-09-23 09:36:52 +02001/*
2 * Copyright (c) 2018, Renesas Electronics Corporation. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <stdint.h> /* for uint32_t */
8#include <mmio.h>
9#include "pfc_init_e3.h"
10#include "rcar_def.h"
11
12/* GPIO base address */
13#define GPIO_BASE (0xE6050000U)
14
15/* GPIO registers */
16#define GPIO_IOINTSEL0 (GPIO_BASE + 0x0000U)
17#define GPIO_INOUTSEL0 (GPIO_BASE + 0x0004U)
18#define GPIO_OUTDT0 (GPIO_BASE + 0x0008U)
19#define GPIO_INDT0 (GPIO_BASE + 0x000CU)
20#define GPIO_INTDT0 (GPIO_BASE + 0x0010U)
21#define GPIO_INTCLR0 (GPIO_BASE + 0x0014U)
22#define GPIO_INTMSK0 (GPIO_BASE + 0x0018U)
23#define GPIO_MSKCLR0 (GPIO_BASE + 0x001CU)
24#define GPIO_POSNEG0 (GPIO_BASE + 0x0020U)
25#define GPIO_EDGLEVEL0 (GPIO_BASE + 0x0024U)
26#define GPIO_FILONOFF0 (GPIO_BASE + 0x0028U)
27#define GPIO_INTMSKS0 (GPIO_BASE + 0x0038U)
28#define GPIO_MSKCLRS0 (GPIO_BASE + 0x003CU)
29#define GPIO_OUTDTSEL0 (GPIO_BASE + 0x0040U)
30#define GPIO_OUTDTH0 (GPIO_BASE + 0x0044U)
31#define GPIO_OUTDTL0 (GPIO_BASE + 0x0048U)
32#define GPIO_BOTHEDGE0 (GPIO_BASE + 0x004CU)
33#define GPIO_IOINTSEL1 (GPIO_BASE + 0x1000U)
34#define GPIO_INOUTSEL1 (GPIO_BASE + 0x1004U)
35#define GPIO_OUTDT1 (GPIO_BASE + 0x1008U)
36#define GPIO_INDT1 (GPIO_BASE + 0x100CU)
37#define GPIO_INTDT1 (GPIO_BASE + 0x1010U)
38#define GPIO_INTCLR1 (GPIO_BASE + 0x1014U)
39#define GPIO_INTMSK1 (GPIO_BASE + 0x1018U)
40#define GPIO_MSKCLR1 (GPIO_BASE + 0x101CU)
41#define GPIO_POSNEG1 (GPIO_BASE + 0x1020U)
42#define GPIO_EDGLEVEL1 (GPIO_BASE + 0x1024U)
43#define GPIO_FILONOFF1 (GPIO_BASE + 0x1028U)
44#define GPIO_INTMSKS1 (GPIO_BASE + 0x1038U)
45#define GPIO_MSKCLRS1 (GPIO_BASE + 0x103CU)
46#define GPIO_OUTDTSEL1 (GPIO_BASE + 0x1040U)
47#define GPIO_OUTDTH1 (GPIO_BASE + 0x1044U)
48#define GPIO_OUTDTL1 (GPIO_BASE + 0x1048U)
49#define GPIO_BOTHEDGE1 (GPIO_BASE + 0x104CU)
50#define GPIO_IOINTSEL2 (GPIO_BASE + 0x2000U)
51#define GPIO_INOUTSEL2 (GPIO_BASE + 0x2004U)
52#define GPIO_OUTDT2 (GPIO_BASE + 0x2008U)
53#define GPIO_INDT2 (GPIO_BASE + 0x200CU)
54#define GPIO_INTDT2 (GPIO_BASE + 0x2010U)
55#define GPIO_INTCLR2 (GPIO_BASE + 0x2014U)
56#define GPIO_INTMSK2 (GPIO_BASE + 0x2018U)
57#define GPIO_MSKCLR2 (GPIO_BASE + 0x201CU)
58#define GPIO_POSNEG2 (GPIO_BASE + 0x2020U)
59#define GPIO_EDGLEVEL2 (GPIO_BASE + 0x2024U)
60#define GPIO_FILONOFF2 (GPIO_BASE + 0x2028U)
61#define GPIO_INTMSKS2 (GPIO_BASE + 0x2038U)
62#define GPIO_MSKCLRS2 (GPIO_BASE + 0x203CU)
63#define GPIO_OUTDTSEL2 (GPIO_BASE + 0x2040U)
64#define GPIO_OUTDTH2 (GPIO_BASE + 0x2044U)
65#define GPIO_OUTDTL2 (GPIO_BASE + 0x2048U)
66#define GPIO_BOTHEDGE2 (GPIO_BASE + 0x204CU)
67#define GPIO_IOINTSEL3 (GPIO_BASE + 0x3000U)
68#define GPIO_INOUTSEL3 (GPIO_BASE + 0x3004U)
69#define GPIO_OUTDT3 (GPIO_BASE + 0x3008U)
70#define GPIO_INDT3 (GPIO_BASE + 0x300CU)
71#define GPIO_INTDT3 (GPIO_BASE + 0x3010U)
72#define GPIO_INTCLR3 (GPIO_BASE + 0x3014U)
73#define GPIO_INTMSK3 (GPIO_BASE + 0x3018U)
74#define GPIO_MSKCLR3 (GPIO_BASE + 0x301CU)
75#define GPIO_POSNEG3 (GPIO_BASE + 0x3020U)
76#define GPIO_EDGLEVEL3 (GPIO_BASE + 0x3024U)
77#define GPIO_FILONOFF3 (GPIO_BASE + 0x3028U)
78#define GPIO_INTMSKS3 (GPIO_BASE + 0x3038U)
79#define GPIO_MSKCLRS3 (GPIO_BASE + 0x303CU)
80#define GPIO_OUTDTSEL3 (GPIO_BASE + 0x3040U)
81#define GPIO_OUTDTH3 (GPIO_BASE + 0x3044U)
82#define GPIO_OUTDTL3 (GPIO_BASE + 0x3048U)
83#define GPIO_BOTHEDGE3 (GPIO_BASE + 0x304CU)
84#define GPIO_IOINTSEL4 (GPIO_BASE + 0x4000U)
85#define GPIO_INOUTSEL4 (GPIO_BASE + 0x4004U)
86#define GPIO_OUTDT4 (GPIO_BASE + 0x4008U)
87#define GPIO_INDT4 (GPIO_BASE + 0x400CU)
88#define GPIO_INTDT4 (GPIO_BASE + 0x4010U)
89#define GPIO_INTCLR4 (GPIO_BASE + 0x4014U)
90#define GPIO_INTMSK4 (GPIO_BASE + 0x4018U)
91#define GPIO_MSKCLR4 (GPIO_BASE + 0x401CU)
92#define GPIO_POSNEG4 (GPIO_BASE + 0x4020U)
93#define GPIO_EDGLEVEL4 (GPIO_BASE + 0x4024U)
94#define GPIO_FILONOFF4 (GPIO_BASE + 0x4028U)
95#define GPIO_INTMSKS4 (GPIO_BASE + 0x4038U)
96#define GPIO_MSKCLRS4 (GPIO_BASE + 0x403CU)
97#define GPIO_OUTDTSEL4 (GPIO_BASE + 0x4040U)
98#define GPIO_OUTDTH4 (GPIO_BASE + 0x4044U)
99#define GPIO_OUTDTL4 (GPIO_BASE + 0x4048U)
100#define GPIO_BOTHEDGE4 (GPIO_BASE + 0x404CU)
101#define GPIO_IOINTSEL5 (GPIO_BASE + 0x5000U)
102#define GPIO_INOUTSEL5 (GPIO_BASE + 0x5004U)
103#define GPIO_OUTDT5 (GPIO_BASE + 0x5008U)
104#define GPIO_INDT5 (GPIO_BASE + 0x500CU)
105#define GPIO_INTDT5 (GPIO_BASE + 0x5010U)
106#define GPIO_INTCLR5 (GPIO_BASE + 0x5014U)
107#define GPIO_INTMSK5 (GPIO_BASE + 0x5018U)
108#define GPIO_MSKCLR5 (GPIO_BASE + 0x501CU)
109#define GPIO_POSNEG5 (GPIO_BASE + 0x5020U)
110#define GPIO_EDGLEVEL5 (GPIO_BASE + 0x5024U)
111#define GPIO_FILONOFF5 (GPIO_BASE + 0x5028U)
112#define GPIO_INTMSKS5 (GPIO_BASE + 0x5038U)
113#define GPIO_MSKCLRS5 (GPIO_BASE + 0x503CU)
114#define GPIO_OUTDTSEL5 (GPIO_BASE + 0x5040U)
115#define GPIO_OUTDTH5 (GPIO_BASE + 0x5044U)
116#define GPIO_OUTDTL5 (GPIO_BASE + 0x5048U)
117#define GPIO_BOTHEDGE5 (GPIO_BASE + 0x504CU)
118#define GPIO_IOINTSEL6 (GPIO_BASE + 0x5400U)
119#define GPIO_INOUTSEL6 (GPIO_BASE + 0x5404U)
120#define GPIO_OUTDT6 (GPIO_BASE + 0x5408U)
121#define GPIO_INDT6 (GPIO_BASE + 0x540CU)
122#define GPIO_INTDT6 (GPIO_BASE + 0x5410U)
123#define GPIO_INTCLR6 (GPIO_BASE + 0x5414U)
124#define GPIO_INTMSK6 (GPIO_BASE + 0x5418U)
125#define GPIO_MSKCLR6 (GPIO_BASE + 0x541CU)
126#define GPIO_POSNEG6 (GPIO_BASE + 0x5420U)
127#define GPIO_EDGLEVEL6 (GPIO_BASE + 0x5424U)
128#define GPIO_FILONOFF6 (GPIO_BASE + 0x5428U)
129#define GPIO_INTMSKS6 (GPIO_BASE + 0x5438U)
130#define GPIO_MSKCLRS6 (GPIO_BASE + 0x543CU)
131#define GPIO_OUTDTSEL6 (GPIO_BASE + 0x5440U)
132#define GPIO_OUTDTH6 (GPIO_BASE + 0x5444U)
133#define GPIO_OUTDTL6 (GPIO_BASE + 0x5448U)
134#define GPIO_BOTHEDGE6 (GPIO_BASE + 0x544CU)
135
136/* Pin functon base address */
137#define PFC_BASE (0xE6060000U)
138
139/* Pin functon registers */
140#define PFC_PMMR (PFC_BASE + 0x0000U)
141#define PFC_GPSR0 (PFC_BASE + 0x0100U)
142#define PFC_GPSR1 (PFC_BASE + 0x0104U)
143#define PFC_GPSR2 (PFC_BASE + 0x0108U)
144#define PFC_GPSR3 (PFC_BASE + 0x010CU)
145#define PFC_GPSR4 (PFC_BASE + 0x0110U)
146#define PFC_GPSR5 (PFC_BASE + 0x0114U)
147#define PFC_GPSR6 (PFC_BASE + 0x0118U)
148#define PFC_IPSR0 (PFC_BASE + 0x0200U)
149#define PFC_IPSR1 (PFC_BASE + 0x0204U)
150#define PFC_IPSR2 (PFC_BASE + 0x0208U)
151#define PFC_IPSR3 (PFC_BASE + 0x020CU)
152#define PFC_IPSR4 (PFC_BASE + 0x0210U)
153#define PFC_IPSR5 (PFC_BASE + 0x0214U)
154#define PFC_IPSR6 (PFC_BASE + 0x0218U)
155#define PFC_IPSR7 (PFC_BASE + 0x021CU)
156#define PFC_IPSR8 (PFC_BASE + 0x0220U)
157#define PFC_IPSR9 (PFC_BASE + 0x0224U)
158#define PFC_IPSR10 (PFC_BASE + 0x0228U)
159#define PFC_IPSR11 (PFC_BASE + 0x022CU)
160#define PFC_IPSR12 (PFC_BASE + 0x0230U)
161#define PFC_IPSR13 (PFC_BASE + 0x0234U)
162#define PFC_IPSR14 (PFC_BASE + 0x0238U)
163#define PFC_IPSR15 (PFC_BASE + 0x023CU)
164#define PFC_IOCTRL30 (PFC_BASE + 0x0380U)
165#define PFC_IOCTRL32 (PFC_BASE + 0x0388U)
166#define PFC_IOCTRL40 (PFC_BASE + 0x03C0U)
167#define PFC_PUEN0 (PFC_BASE + 0x0400U)
168#define PFC_PUEN1 (PFC_BASE + 0x0404U)
169#define PFC_PUEN2 (PFC_BASE + 0x0408U)
170#define PFC_PUEN3 (PFC_BASE + 0x040CU)
171#define PFC_PUEN4 (PFC_BASE + 0x0410U)
172#define PFC_PUEN5 (PFC_BASE + 0x0414U)
173#define PFC_PUD0 (PFC_BASE + 0x0440U)
174#define PFC_PUD1 (PFC_BASE + 0x0444U)
175#define PFC_PUD2 (PFC_BASE + 0x0448U)
176#define PFC_PUD3 (PFC_BASE + 0x044CU)
177#define PFC_PUD4 (PFC_BASE + 0x0450U)
178#define PFC_PUD5 (PFC_BASE + 0x0454U)
179#define PFC_MOD_SEL0 (PFC_BASE + 0x0500U)
180#define PFC_MOD_SEL1 (PFC_BASE + 0x0504U)
181
182#define GPSR0_SDA4 ((uint32_t)1U << 17U)
183#define GPSR0_SCL4 ((uint32_t)1U << 16U)
184#define GPSR0_D15 ((uint32_t)1U << 15U)
185#define GPSR0_D14 ((uint32_t)1U << 14U)
186#define GPSR0_D13 ((uint32_t)1U << 13U)
187#define GPSR0_D12 ((uint32_t)1U << 12U)
188#define GPSR0_D11 ((uint32_t)1U << 11U)
189#define GPSR0_D10 ((uint32_t)1U << 10U)
190#define GPSR0_D9 ((uint32_t)1U << 9U)
191#define GPSR0_D8 ((uint32_t)1U << 8U)
192#define GPSR0_D7 ((uint32_t)1U << 7U)
193#define GPSR0_D6 ((uint32_t)1U << 6U)
194#define GPSR0_D5 ((uint32_t)1U << 5U)
195#define GPSR0_D4 ((uint32_t)1U << 4U)
196#define GPSR0_D3 ((uint32_t)1U << 3U)
197#define GPSR0_D2 ((uint32_t)1U << 2U)
198#define GPSR0_D1 ((uint32_t)1U << 1U)
199#define GPSR0_D0 ((uint32_t)1U << 0U)
200#define GPSR1_WE0 ((uint32_t)1U << 22U)
201#define GPSR1_CS0 ((uint32_t)1U << 21U)
202#define GPSR1_CLKOUT ((uint32_t)1U << 20U)
203#define GPSR1_A19 ((uint32_t)1U << 19U)
204#define GPSR1_A18 ((uint32_t)1U << 18U)
205#define GPSR1_A17 ((uint32_t)1U << 17U)
206#define GPSR1_A16 ((uint32_t)1U << 16U)
207#define GPSR1_A15 ((uint32_t)1U << 15U)
208#define GPSR1_A14 ((uint32_t)1U << 14U)
209#define GPSR1_A13 ((uint32_t)1U << 13U)
210#define GPSR1_A12 ((uint32_t)1U << 12U)
211#define GPSR1_A11 ((uint32_t)1U << 11U)
212#define GPSR1_A10 ((uint32_t)1U << 10U)
213#define GPSR1_A9 ((uint32_t)1U << 9U)
214#define GPSR1_A8 ((uint32_t)1U << 8U)
215#define GPSR1_A7 ((uint32_t)1U << 7U)
216#define GPSR1_A6 ((uint32_t)1U << 6U)
217#define GPSR1_A5 ((uint32_t)1U << 5U)
218#define GPSR1_A4 ((uint32_t)1U << 4U)
219#define GPSR1_A3 ((uint32_t)1U << 3U)
220#define GPSR1_A2 ((uint32_t)1U << 2U)
221#define GPSR1_A1 ((uint32_t)1U << 1U)
222#define GPSR1_A0 ((uint32_t)1U << 0U)
223#define GPSR2_BIT27_REVERCED ((uint32_t)1U << 27U)
224#define GPSR2_BIT26_REVERCED ((uint32_t)1U << 26U)
225#define GPSR2_EX_WAIT0 ((uint32_t)1U << 25U)
226#define GPSR2_RD_WR ((uint32_t)1U << 24U)
227#define GPSR2_RD ((uint32_t)1U << 23U)
228#define GPSR2_BS ((uint32_t)1U << 22U)
229#define GPSR2_AVB_PHY_INT ((uint32_t)1U << 21U)
230#define GPSR2_AVB_TXCREFCLK ((uint32_t)1U << 20U)
231#define GPSR2_AVB_RD3 ((uint32_t)1U << 19U)
232#define GPSR2_AVB_RD2 ((uint32_t)1U << 18U)
233#define GPSR2_AVB_RD1 ((uint32_t)1U << 17U)
234#define GPSR2_AVB_RD0 ((uint32_t)1U << 16U)
235#define GPSR2_AVB_RXC ((uint32_t)1U << 15U)
236#define GPSR2_AVB_RX_CTL ((uint32_t)1U << 14U)
237#define GPSR2_RPC_RESET ((uint32_t)1U << 13U)
238#define GPSR2_RPC_RPC_INT ((uint32_t)1U << 12U)
239#define GPSR2_QSPI1_SSL ((uint32_t)1U << 11U)
240#define GPSR2_QSPI1_IO3 ((uint32_t)1U << 10U)
241#define GPSR2_QSPI1_IO2 ((uint32_t)1U << 9U)
242#define GPSR2_QSPI1_MISO_IO1 ((uint32_t)1U << 8U)
243#define GPSR2_QSPI1_MOSI_IO0 ((uint32_t)1U << 7U)
244#define GPSR2_QSPI1_SPCLK ((uint32_t)1U << 6U)
245#define GPSR2_QSPI0_SSL ((uint32_t)1U << 5U)
246#define GPSR2_QSPI0_IO3 ((uint32_t)1U << 4U)
247#define GPSR2_QSPI0_IO2 ((uint32_t)1U << 3U)
248#define GPSR2_QSPI0_MISO_IO1 ((uint32_t)1U << 2U)
249#define GPSR2_QSPI0_MOSI_IO0 ((uint32_t)1U << 1U)
250#define GPSR2_QSPI0_SPCLK ((uint32_t)1U << 0U)
251#define GPSR3_SD1_WP ((uint32_t)1U << 15U)
252#define GPSR3_SD1_CD ((uint32_t)1U << 14U)
253#define GPSR3_SD0_WP ((uint32_t)1U << 13U)
254#define GPSR3_SD0_CD ((uint32_t)1U << 12U)
255#define GPSR3_SD1_DAT3 ((uint32_t)1U << 11U)
256#define GPSR3_SD1_DAT2 ((uint32_t)1U << 10U)
257#define GPSR3_SD1_DAT1 ((uint32_t)1U << 9U)
258#define GPSR3_SD1_DAT0 ((uint32_t)1U << 8U)
259#define GPSR3_SD1_CMD ((uint32_t)1U << 7U)
260#define GPSR3_SD1_CLK ((uint32_t)1U << 6U)
261#define GPSR3_SD0_DAT3 ((uint32_t)1U << 5U)
262#define GPSR3_SD0_DAT2 ((uint32_t)1U << 4U)
263#define GPSR3_SD0_DAT1 ((uint32_t)1U << 3U)
264#define GPSR3_SD0_DAT0 ((uint32_t)1U << 2U)
265#define GPSR3_SD0_CMD ((uint32_t)1U << 1U)
266#define GPSR3_SD0_CLK ((uint32_t)1U << 0U)
267#define GPSR4_SD3_DS ((uint32_t)1U << 10U)
268#define GPSR4_SD3_DAT7 ((uint32_t)1U << 9U)
269#define GPSR4_SD3_DAT6 ((uint32_t)1U << 8U)
270#define GPSR4_SD3_DAT5 ((uint32_t)1U << 7U)
271#define GPSR4_SD3_DAT4 ((uint32_t)1U << 6U)
272#define GPSR4_SD3_DAT3 ((uint32_t)1U << 5U)
273#define GPSR4_SD3_DAT2 ((uint32_t)1U << 4U)
274#define GPSR4_SD3_DAT1 ((uint32_t)1U << 3U)
275#define GPSR4_SD3_DAT0 ((uint32_t)1U << 2U)
276#define GPSR4_SD3_CMD ((uint32_t)1U << 1U)
277#define GPSR4_SD3_CLK ((uint32_t)1U << 0U)
278#define GPSR5_MLB_DAT ((uint32_t)1U << 19U)
279#define GPSR5_MLB_SIG ((uint32_t)1U << 18U)
280#define GPSR5_MLB_CLK ((uint32_t)1U << 17U)
281#define GPSR5_SSI_SDATA9 ((uint32_t)1U << 16U)
282#define GPSR5_MSIOF0_SS2 ((uint32_t)1U << 15U)
283#define GPSR5_MSIOF0_SS1 ((uint32_t)1U << 14U)
284#define GPSR5_MSIOF0_SYNC ((uint32_t)1U << 13U)
285#define GPSR5_MSIOF0_TXD ((uint32_t)1U << 12U)
286#define GPSR5_MSIOF0_RXD ((uint32_t)1U << 11U)
287#define GPSR5_MSIOF0_SCK ((uint32_t)1U << 10U)
288#define GPSR5_RX2_A ((uint32_t)1U << 9U)
289#define GPSR5_TX2_A ((uint32_t)1U << 8U)
290#define GPSR5_SCK2_A ((uint32_t)1U << 7U)
291#define GPSR5_TX1 ((uint32_t)1U << 6U)
292#define GPSR5_RX1 ((uint32_t)1U << 5U)
293#define GPSR5_RTS0_TANS_A ((uint32_t)1U << 4U)
294#define GPSR5_CTS0_A ((uint32_t)1U << 3U)
295#define GPSR5_TX0_A ((uint32_t)1U << 2U)
296#define GPSR5_RX0_A ((uint32_t)1U << 1U)
297#define GPSR5_SCK0_A ((uint32_t)1U << 0U)
298#define GPSR6_USB30_PWEN ((uint32_t)1U << 17U)
299#define GPSR6_SSI_SDATA6 ((uint32_t)1U << 16U)
300#define GPSR6_SSI_WS6 ((uint32_t)1U << 15U)
301#define GPSR6_SSI_SCK6 ((uint32_t)1U << 14U)
302#define GPSR6_SSI_SDATA5 ((uint32_t)1U << 13U)
303#define GPSR6_SSI_WS5 ((uint32_t)1U << 12U)
304#define GPSR6_SSI_SCK5 ((uint32_t)1U << 11U)
305#define GPSR6_SSI_SDATA4 ((uint32_t)1U << 10U)
306#define GPSR6_USB30_OVC ((uint32_t)1U << 9U)
307#define GPSR6_AUDIO_CLKA ((uint32_t)1U << 8U)
308#define GPSR6_SSI_SDATA3 ((uint32_t)1U << 7U)
309#define GPSR6_SSI_WS349 ((uint32_t)1U << 6U)
310#define GPSR6_SSI_SCK349 ((uint32_t)1U << 5U)
311#define GPSR6_SSI_SDATA2 ((uint32_t)1U << 4U)
312#define GPSR6_SSI_SDATA1 ((uint32_t)1U << 3U)
313#define GPSR6_SSI_SDATA0 ((uint32_t)1U << 2U)
314#define GPSR6_SSI_WS01239 ((uint32_t)1U << 1U)
315#define GPSR6_SSI_SCK01239 ((uint32_t)1U << 0U)
316
317#define IPSR_28_FUNC(x) ((uint32_t)(x) << 28U)
318#define IPSR_24_FUNC(x) ((uint32_t)(x) << 24U)
319#define IPSR_20_FUNC(x) ((uint32_t)(x) << 20U)
320#define IPSR_16_FUNC(x) ((uint32_t)(x) << 16U)
321#define IPSR_12_FUNC(x) ((uint32_t)(x) << 12U)
322#define IPSR_8_FUNC(x) ((uint32_t)(x) << 8U)
323#define IPSR_4_FUNC(x) ((uint32_t)(x) << 4U)
324#define IPSR_0_FUNC(x) ((uint32_t)(x) << 0U)
325
326#define IOCTRL30_MASK (0x0007F000U)
327#define POC_SD3_DS_33V ((uint32_t)1U << 29U)
328#define POC_SD3_DAT7_33V ((uint32_t)1U << 28U)
329#define POC_SD3_DAT6_33V ((uint32_t)1U << 27U)
330#define POC_SD3_DAT5_33V ((uint32_t)1U << 26U)
331#define POC_SD3_DAT4_33V ((uint32_t)1U << 25U)
332#define POC_SD3_DAT3_33V ((uint32_t)1U << 24U)
333#define POC_SD3_DAT2_33V ((uint32_t)1U << 23U)
334#define POC_SD3_DAT1_33V ((uint32_t)1U << 22U)
335#define POC_SD3_DAT0_33V ((uint32_t)1U << 21U)
336#define POC_SD3_CMD_33V ((uint32_t)1U << 20U)
337#define POC_SD3_CLK_33V ((uint32_t)1U << 19U)
338#define POC_SD1_DAT3_33V ((uint32_t)1U << 11U)
339#define POC_SD1_DAT2_33V ((uint32_t)1U << 10U)
340#define POC_SD1_DAT1_33V ((uint32_t)1U << 9U)
341#define POC_SD1_DAT0_33V ((uint32_t)1U << 8U)
342#define POC_SD1_CMD_33V ((uint32_t)1U << 7U)
343#define POC_SD1_CLK_33V ((uint32_t)1U << 6U)
344#define POC_SD0_DAT3_33V ((uint32_t)1U << 5U)
345#define POC_SD0_DAT2_33V ((uint32_t)1U << 4U)
346#define POC_SD0_DAT1_33V ((uint32_t)1U << 3U)
347#define POC_SD0_DAT0_33V ((uint32_t)1U << 2U)
348#define POC_SD0_CMD_33V ((uint32_t)1U << 1U)
349#define POC_SD0_CLK_33V ((uint32_t)1U << 0U)
350
351#define IOCTRL32_MASK (0xFFFFFFFEU)
352#define POC2_VREF_33V ((uint32_t)1U << 0U)
353
354#define MOD_SEL0_ADGB_A ((uint32_t)0U << 29U)
355#define MOD_SEL0_ADGB_B ((uint32_t)1U << 29U)
356#define MOD_SEL0_ADGB_C ((uint32_t)2U << 29U)
357#define MOD_SEL0_DRIF0_A ((uint32_t)0U << 28U)
358#define MOD_SEL0_DRIF0_B ((uint32_t)1U << 28U)
359#define MOD_SEL0_FM_A ((uint32_t)0U << 26U)
360#define MOD_SEL0_FM_B ((uint32_t)1U << 26U)
361#define MOD_SEL0_FM_C ((uint32_t)2U << 26U)
362#define MOD_SEL0_FSO_A ((uint32_t)0U << 25U)
363#define MOD_SEL0_FSO_B ((uint32_t)1U << 25U)
364#define MOD_SEL0_HSCIF0_A ((uint32_t)0U << 24U)
365#define MOD_SEL0_HSCIF0_B ((uint32_t)1U << 24U)
366#define MOD_SEL0_HSCIF1_A ((uint32_t)0U << 23U)
367#define MOD_SEL0_HSCIF1_B ((uint32_t)1U << 23U)
368#define MOD_SEL0_HSCIF2_A ((uint32_t)0U << 22U)
369#define MOD_SEL0_HSCIF2_B ((uint32_t)1U << 22U)
370#define MOD_SEL0_I2C1_A ((uint32_t)0U << 20U)
371#define MOD_SEL0_I2C1_B ((uint32_t)1U << 20U)
372#define MOD_SEL0_I2C1_C ((uint32_t)2U << 20U)
373#define MOD_SEL0_I2C1_D ((uint32_t)3U << 20U)
374#define MOD_SEL0_I2C2_A ((uint32_t)0U << 17U)
375#define MOD_SEL0_I2C2_B ((uint32_t)1U << 17U)
376#define MOD_SEL0_I2C2_C ((uint32_t)2U << 17U)
377#define MOD_SEL0_I2C2_D ((uint32_t)3U << 17U)
378#define MOD_SEL0_I2C2_E ((uint32_t)4U << 17U)
379#define MOD_SEL0_NDFC_A ((uint32_t)0U << 16U)
380#define MOD_SEL0_NDFC_B ((uint32_t)1U << 16U)
381#define MOD_SEL0_PWM0_A ((uint32_t)0U << 15U)
382#define MOD_SEL0_PWM0_B ((uint32_t)1U << 15U)
383#define MOD_SEL0_PWM1_A ((uint32_t)0U << 14U)
384#define MOD_SEL0_PWM1_B ((uint32_t)1U << 14U)
385#define MOD_SEL0_PWM2_A ((uint32_t)0U << 12U)
386#define MOD_SEL0_PWM2_B ((uint32_t)1U << 12U)
387#define MOD_SEL0_PWM2_C ((uint32_t)2U << 12U)
388#define MOD_SEL0_PWM3_A ((uint32_t)0U << 10U)
389#define MOD_SEL0_PWM3_B ((uint32_t)1U << 10U)
390#define MOD_SEL0_PWM3_C ((uint32_t)2U << 10U)
391#define MOD_SEL0_PWM4_A ((uint32_t)0U << 9U)
392#define MOD_SEL0_PWM4_B ((uint32_t)1U << 9U)
393#define MOD_SEL0_PWM5_A ((uint32_t)0U << 8U)
394#define MOD_SEL0_PWM5_B ((uint32_t)1U << 8U)
395#define MOD_SEL0_PWM6_A ((uint32_t)0U << 7U)
396#define MOD_SEL0_PWM6_B ((uint32_t)1U << 7U)
397#define MOD_SEL0_REMOCON_A ((uint32_t)0U << 5U)
398#define MOD_SEL0_REMOCON_B ((uint32_t)1U << 5U)
399#define MOD_SEL0_REMOCON_C ((uint32_t)2U << 5U)
400#define MOD_SEL0_SCIF_A ((uint32_t)0U << 4U)
401#define MOD_SEL0_SCIF_B ((uint32_t)1U << 4U)
402#define MOD_SEL0_SCIF0_A ((uint32_t)0U << 3U)
403#define MOD_SEL0_SCIF0_B ((uint32_t)1U << 3U)
404#define MOD_SEL0_SCIF2_A ((uint32_t)0U << 2U)
405#define MOD_SEL0_SCIF2_B ((uint32_t)1U << 2U)
406#define MOD_SEL0_SPEED_PULSE_IF_A ((uint32_t)0U << 0U)
407#define MOD_SEL0_SPEED_PULSE_IF_B ((uint32_t)1U << 0U)
408#define MOD_SEL0_SPEED_PULSE_IF_C ((uint32_t)2U << 0U)
409#define MOD_SEL1_SIMCARD_A ((uint32_t)0U << 31U)
410#define MOD_SEL1_SIMCARD_B ((uint32_t)1U << 31U)
411#define MOD_SEL1_SSI2_A ((uint32_t)0U << 30U)
412#define MOD_SEL1_SSI2_B ((uint32_t)1U << 30U)
413#define MOD_SEL1_TIMER_TMU_A ((uint32_t)0U << 29U)
414#define MOD_SEL1_TIMER_TMU_B ((uint32_t)1U << 29U)
415#define MOD_SEL1_USB20_CH0_A ((uint32_t)0U << 28U)
416#define MOD_SEL1_USB20_CH0_B ((uint32_t)1U << 28U)
417#define MOD_SEL1_DRIF2_A ((uint32_t)0U << 26U)
418#define MOD_SEL1_DRIF2_B ((uint32_t)1U << 26U)
419#define MOD_SEL1_DRIF3_A ((uint32_t)0U << 25U)
420#define MOD_SEL1_DRIF3_B ((uint32_t)1U << 25U)
421#define MOD_SEL1_HSCIF3_A ((uint32_t)0U << 22U)
422#define MOD_SEL1_HSCIF3_B ((uint32_t)1U << 22U)
423#define MOD_SEL1_HSCIF3_C ((uint32_t)2U << 22U)
424#define MOD_SEL1_HSCIF3_D ((uint32_t)3U << 22U)
425#define MOD_SEL1_HSCIF3_E ((uint32_t)4U << 22U)
426#define MOD_SEL1_HSCIF4_A ((uint32_t)0U << 19U)
427#define MOD_SEL1_HSCIF4_B ((uint32_t)1U << 19U)
428#define MOD_SEL1_HSCIF4_C ((uint32_t)2U << 19U)
429#define MOD_SEL1_HSCIF4_D ((uint32_t)3U << 19U)
430#define MOD_SEL1_HSCIF4_E ((uint32_t)4U << 19U)
431#define MOD_SEL1_I2C6_A ((uint32_t)0U << 18U)
432#define MOD_SEL1_I2C6_B ((uint32_t)1U << 18U)
433#define MOD_SEL1_I2C7_A ((uint32_t)0U << 17U)
434#define MOD_SEL1_I2C7_B ((uint32_t)1U << 17U)
435#define MOD_SEL1_MSIOF2_A ((uint32_t)0U << 16U)
436#define MOD_SEL1_MSIOF2_B ((uint32_t)1U << 16U)
437#define MOD_SEL1_MSIOF3_A ((uint32_t)0U << 15U)
438#define MOD_SEL1_MSIOF3_B ((uint32_t)1U << 15U)
439#define MOD_SEL1_SCIF3_A ((uint32_t)0U << 13U)
440#define MOD_SEL1_SCIF3_B ((uint32_t)1U << 13U)
441#define MOD_SEL1_SCIF3_C ((uint32_t)2U << 13U)
442#define MOD_SEL1_SCIF4_A ((uint32_t)0U << 11U)
443#define MOD_SEL1_SCIF4_B ((uint32_t)1U << 11U)
444#define MOD_SEL1_SCIF4_C ((uint32_t)2U << 11U)
445#define MOD_SEL1_SCIF5_A ((uint32_t)0U << 9U)
446#define MOD_SEL1_SCIF5_B ((uint32_t)1U << 9U)
447#define MOD_SEL1_SCIF5_C ((uint32_t)2U << 9U)
448#define MOD_SEL1_VIN4_A ((uint32_t)0U << 8U)
449#define MOD_SEL1_VIN4_B ((uint32_t)1U << 8U)
450#define MOD_SEL1_VIN5_A ((uint32_t)0U << 7U)
451#define MOD_SEL1_VIN5_B ((uint32_t)1U << 7U)
452#define MOD_SEL1_ADGC_A ((uint32_t)0U << 5U)
453#define MOD_SEL1_ADGC_B ((uint32_t)1U << 5U)
454#define MOD_SEL1_ADGC_C ((uint32_t)2U << 5U)
455#define MOD_SEL1_SSI9_A ((uint32_t)0U << 4U)
456#define MOD_SEL1_SSI9_B ((uint32_t)1U << 4U)
457
458static void pfc_reg_write(uint32_t addr, uint32_t data);
459
460static void pfc_reg_write(uint32_t addr, uint32_t data)
461{
462 mmio_write_32(PFC_PMMR, ~data);
463 mmio_write_32((uintptr_t) addr, data);
464}
465
466void pfc_init_e3(void)
467{
468 uint32_t reg;
469
470 /* initialize module select */
471 pfc_reg_write(PFC_MOD_SEL0, MOD_SEL0_ADGB_A
472 | MOD_SEL0_DRIF0_A
473 | MOD_SEL0_FM_A
474 | MOD_SEL0_FSO_A
475 | MOD_SEL0_HSCIF0_A
476 | MOD_SEL0_HSCIF1_A
477 | MOD_SEL0_HSCIF2_A
478 | MOD_SEL0_I2C1_A
479 | MOD_SEL0_I2C2_A
480 | MOD_SEL0_NDFC_A
481 | MOD_SEL0_PWM0_A
482 | MOD_SEL0_PWM1_A
483 | MOD_SEL0_PWM2_A
484 | MOD_SEL0_PWM3_A
485 | MOD_SEL0_PWM4_A
486 | MOD_SEL0_PWM5_A
487 | MOD_SEL0_PWM6_A
488 | MOD_SEL0_REMOCON_A
489 | MOD_SEL0_SCIF_A
490 | MOD_SEL0_SCIF0_A
491 | MOD_SEL0_SCIF2_A | MOD_SEL0_SPEED_PULSE_IF_A);
492 pfc_reg_write(PFC_MOD_SEL1, MOD_SEL1_SIMCARD_A
493 | MOD_SEL1_SSI2_A
494 | MOD_SEL1_TIMER_TMU_A
495 | MOD_SEL1_USB20_CH0_B
496 | MOD_SEL1_DRIF2_A
497 | MOD_SEL1_DRIF3_A
498 | MOD_SEL1_HSCIF3_A
499 | MOD_SEL1_HSCIF4_A
500 | MOD_SEL1_I2C6_A
501 | MOD_SEL1_I2C7_A
502 | MOD_SEL1_MSIOF2_A
503 | MOD_SEL1_MSIOF3_A
504 | MOD_SEL1_SCIF3_A
505 | MOD_SEL1_SCIF4_A
506 | MOD_SEL1_SCIF5_A
507 | MOD_SEL1_VIN4_A
508 | MOD_SEL1_VIN5_A | MOD_SEL1_ADGC_A | MOD_SEL1_SSI9_A);
509
510 /* initialize peripheral function select */
511 pfc_reg_write(PFC_IPSR0, IPSR_28_FUNC(0) /* QSPI1_MISO/IO1 */
512 |IPSR_24_FUNC(0) /* QSPI1_MOSI/IO0 */
513 |IPSR_20_FUNC(0) /* QSPI1_SPCLK */
514 |IPSR_16_FUNC(0) /* QSPI0_IO3 */
515 |IPSR_12_FUNC(0) /* QSPI0_IO2 */
516 |IPSR_8_FUNC(0) /* QSPI0_MISO/IO1 */
517 |IPSR_4_FUNC(0) /* QSPI0_MOSI/IO0 */
518 |IPSR_0_FUNC(0)); /* QSPI0_SPCLK */
519 pfc_reg_write(PFC_IPSR1, IPSR_28_FUNC(0) /* AVB_RD2 */
520 |IPSR_24_FUNC(0) /* AVB_RD1 */
521 |IPSR_20_FUNC(0) /* AVB_RD0 */
522 |IPSR_16_FUNC(0) /* RPC_RESET# */
523 |IPSR_12_FUNC(0) /* RPC_INT# */
524 |IPSR_8_FUNC(0) /* QSPI1_SSL */
525 |IPSR_4_FUNC(0) /* QSPI1_IO3 */
526 |IPSR_0_FUNC(0)); /* QSPI1_IO2 */
527 pfc_reg_write(PFC_IPSR2, IPSR_28_FUNC(1) /* IRQ0 */
528 |IPSR_24_FUNC(0)
529 | IPSR_20_FUNC(0)
530 | IPSR_16_FUNC(2) /* AVB_LINK */
531 |IPSR_12_FUNC(0)
532 | IPSR_8_FUNC(0) /* AVB_MDC */
533 |IPSR_4_FUNC(0) /* AVB_MDIO */
534 |IPSR_0_FUNC(0)); /* AVB_TXCREFCLK */
535 pfc_reg_write(PFC_IPSR3, IPSR_28_FUNC(5) /* DU_HSYNC */
536 |IPSR_24_FUNC(0)
537 | IPSR_20_FUNC(0)
538 | IPSR_16_FUNC(0)
539 | IPSR_12_FUNC(5) /* DU_DG4 */
540 |IPSR_8_FUNC(5) /* DU_DOTCLKOUT0 */
541 |IPSR_4_FUNC(5) /* DU_DISP */
542 |IPSR_0_FUNC(1)); /* IRQ1 */
543 pfc_reg_write(PFC_IPSR4, IPSR_28_FUNC(5) /* DU_DB5 */
544 |IPSR_24_FUNC(5) /* DU_DB4 */
545 |IPSR_20_FUNC(5) /* DU_DB3 */
546 |IPSR_16_FUNC(5) /* DU_DB2 */
547 |IPSR_12_FUNC(5) /* DU_DG6 */
548 |IPSR_8_FUNC(5) /* DU_VSYNC */
549 |IPSR_4_FUNC(5) /* DU_DG5 */
550 |IPSR_0_FUNC(5)); /* DU_DG7 */
551 pfc_reg_write(PFC_IPSR5, IPSR_28_FUNC(5) /* DU_DR3 */
552 |IPSR_24_FUNC(5) /* DU_DB7 */
553 |IPSR_20_FUNC(5) /* DU_DR2 */
554 |IPSR_16_FUNC(5) /* DU_DR1 */
555 |IPSR_12_FUNC(5) /* DU_DR0 */
556 |IPSR_8_FUNC(5) /* DU_DB1 */
557 |IPSR_4_FUNC(5) /* DU_DB0 */
558 |IPSR_0_FUNC(5)); /* DU_DB6 */
559 pfc_reg_write(PFC_IPSR6, IPSR_28_FUNC(5) /* DU_DG1 */
560 |IPSR_24_FUNC(5) /* DU_DG0 */
561 |IPSR_20_FUNC(5) /* DU_DR7 */
562 |IPSR_16_FUNC(2) /* IRQ5 */
563 |IPSR_12_FUNC(5) /* DU_DR6 */
564 |IPSR_8_FUNC(5) /* DU_DR5 */
565 |IPSR_4_FUNC(0)
566 | IPSR_0_FUNC(5)); /* DU_DR4 */
567 pfc_reg_write(PFC_IPSR7, IPSR_28_FUNC(0) /* SD0_CLK */
568 |IPSR_24_FUNC(0)
569 | IPSR_20_FUNC(5) /* DU_DOTCLKIN0 */
570 |IPSR_16_FUNC(5) /* DU_DG3 */
571 |IPSR_12_FUNC(0)
572 | IPSR_8_FUNC(0)
573 | IPSR_4_FUNC(0)
574 | IPSR_0_FUNC(5)); /* DU_DG2 */
575 pfc_reg_write(PFC_IPSR8, IPSR_28_FUNC(0) /* SD1_DAT0 */
576 |IPSR_24_FUNC(0) /* SD1_CMD */
577 |IPSR_20_FUNC(0) /* SD1_CLK */
578 |IPSR_16_FUNC(0) /* SD0_DAT3 */
579 |IPSR_12_FUNC(0) /* SD0_DAT2 */
580 |IPSR_8_FUNC(0) /* SD0_DAT1 */
581 |IPSR_4_FUNC(0) /* SD0_DAT0 */
582 |IPSR_0_FUNC(0)); /* SD0_CMD */
583 pfc_reg_write(PFC_IPSR9, IPSR_28_FUNC(0) /* SD3_DAT2 */
584 |IPSR_24_FUNC(0) /* SD3_DAT1 */
585 |IPSR_20_FUNC(0) /* SD3_DAT0 */
586 |IPSR_16_FUNC(0) /* SD3_CMD */
587 |IPSR_12_FUNC(0) /* SD3_CLK */
588 |IPSR_8_FUNC(0) /* SD1_DAT3 */
589 |IPSR_4_FUNC(0) /* SD1_DAT2 */
590 |IPSR_0_FUNC(0)); /* SD1_DAT1 */
591 pfc_reg_write(PFC_IPSR10, IPSR_28_FUNC(0) /* SD0_WP */
592 |IPSR_24_FUNC(0) /* SD0_CD */
593 |IPSR_20_FUNC(0) /* SD3_DS */
594 |IPSR_16_FUNC(0) /* SD3_DAT7 */
595 |IPSR_12_FUNC(0) /* SD3_DAT6 */
596 |IPSR_8_FUNC(0) /* SD3_DAT5 */
597 |IPSR_4_FUNC(0) /* SD3_DAT4 */
598 |IPSR_0_FUNC(0)); /* SD3_DAT3 */
599 pfc_reg_write(PFC_IPSR11, IPSR_28_FUNC(0)
600 | IPSR_24_FUNC(0)
601 | IPSR_20_FUNC(2) /* AUDIO_CLKOUT1_A */
602 |IPSR_16_FUNC(2) /* AUDIO_CLKOUT_A */
603 |IPSR_12_FUNC(0)
604 | IPSR_8_FUNC(0)
605 | IPSR_4_FUNC(0) /* SD1_WP */
606 |IPSR_0_FUNC(0)); /* SD1_CD */
607 pfc_reg_write(PFC_IPSR12, IPSR_28_FUNC(0)
608 | IPSR_24_FUNC(0)
609 | IPSR_20_FUNC(0)
610 | IPSR_16_FUNC(0)
611 | IPSR_12_FUNC(0) /* RX2_A */
612 |IPSR_8_FUNC(0) /* TX2_A */
613 |IPSR_4_FUNC(2) /* AUDIO_CLKB_A */
614 |IPSR_0_FUNC(0));
615 pfc_reg_write(PFC_IPSR13, IPSR_28_FUNC(0)
616 | IPSR_24_FUNC(0)
617 | IPSR_20_FUNC(0)
618 | IPSR_16_FUNC(0)
619 | IPSR_12_FUNC(0)
620 | IPSR_8_FUNC(2) /* AUDIO_CLKC_A */
621 |IPSR_4_FUNC(1) /* HTX2_A */
622 |IPSR_0_FUNC(1)); /* HRX2_A */
623 pfc_reg_write(PFC_IPSR14, IPSR_28_FUNC(3) /* USB0_PWEN_B */
624 |IPSR_24_FUNC(0) /* SSI_SDATA4 */
625 |IPSR_20_FUNC(0) /* SSI_SDATA3 */
626 |IPSR_16_FUNC(0) /* SSI_WS349 */
627 |IPSR_12_FUNC(0) /* SSI_SCK349 */
628 |IPSR_8_FUNC(0)
629 | IPSR_4_FUNC(0) /* SSI_SDATA1 */
630 |IPSR_0_FUNC(0)); /* SSI_SDATA0 */
631 pfc_reg_write(PFC_IPSR15, IPSR_28_FUNC(0) /* USB30_OVC */
632 |IPSR_24_FUNC(0) /* USB30_PWEN */
633 |IPSR_20_FUNC(0) /* AUDIO_CLKA */
634 |IPSR_16_FUNC(1) /* HRTS2#_A */
635 |IPSR_12_FUNC(1) /* HCTS2#_A */
636 |IPSR_8_FUNC(0)
637 | IPSR_4_FUNC(0)
638 | IPSR_0_FUNC(3)); /* USB0_OVC_B */
639
640 /* initialize GPIO/perihperal function select */
641 pfc_reg_write(PFC_GPSR0, GPSR0_SCL4
642 | GPSR0_D15
643 | GPSR0_D11
644 | GPSR0_D10
645 | GPSR0_D9
646 | GPSR0_D8
647 | GPSR0_D7
648 | GPSR0_D6
649 | GPSR0_D5 | GPSR0_D3 | GPSR0_D2 | GPSR0_D1 | GPSR0_D0);
650 pfc_reg_write(PFC_GPSR1, GPSR1_WE0
651 | GPSR1_CS0
652 | GPSR1_A19
653 | GPSR1_A18
654 | GPSR1_A17
655 | GPSR1_A16
656 | GPSR1_A15
657 | GPSR1_A14
658 | GPSR1_A13
659 | GPSR1_A12
660 | GPSR1_A11
661 | GPSR1_A10
662 | GPSR1_A9
663 | GPSR1_A8
664 | GPSR1_A4 | GPSR1_A3 | GPSR1_A2 | GPSR1_A1 | GPSR1_A0);
665 pfc_reg_write(PFC_GPSR2, GPSR2_BIT27_REVERCED
666 | GPSR2_BIT26_REVERCED
667 | GPSR2_RD
668 | GPSR2_AVB_PHY_INT
669 | GPSR2_AVB_TXCREFCLK
670 | GPSR2_AVB_RD3
671 | GPSR2_AVB_RD2
672 | GPSR2_AVB_RD1
673 | GPSR2_AVB_RD0
674 | GPSR2_AVB_RXC
675 | GPSR2_AVB_RX_CTL
676 | GPSR2_RPC_RESET
677 | GPSR2_RPC_RPC_INT
678 | GPSR2_QSPI1_SSL
679 | GPSR2_QSPI1_IO3
680 | GPSR2_QSPI1_IO2
681 | GPSR2_QSPI1_MISO_IO1
682 | GPSR2_QSPI1_MOSI_IO0
683 | GPSR2_QSPI1_SPCLK
684 | GPSR2_QSPI0_SSL
685 | GPSR2_QSPI0_IO3
686 | GPSR2_QSPI0_IO2
687 | GPSR2_QSPI0_MISO_IO1
688 | GPSR2_QSPI0_MOSI_IO0 | GPSR2_QSPI0_SPCLK);
689 pfc_reg_write(PFC_GPSR3, GPSR3_SD1_WP
690 | GPSR3_SD1_CD
691 | GPSR3_SD0_WP
692 | GPSR3_SD0_CD
693 | GPSR3_SD1_DAT3
694 | GPSR3_SD1_DAT2
695 | GPSR3_SD1_DAT1
696 | GPSR3_SD1_DAT0
697 | GPSR3_SD1_CMD
698 | GPSR3_SD1_CLK
699 | GPSR3_SD0_DAT3
700 | GPSR3_SD0_DAT2
701 | GPSR3_SD0_DAT1
702 | GPSR3_SD0_DAT0 | GPSR3_SD0_CMD | GPSR3_SD0_CLK);
703 pfc_reg_write(PFC_GPSR4, GPSR4_SD3_DS
704 | GPSR4_SD3_DAT7
705 | GPSR4_SD3_DAT6
706 | GPSR4_SD3_DAT5
707 | GPSR4_SD3_DAT4
708 | GPSR4_SD3_DAT3
709 | GPSR4_SD3_DAT2
710 | GPSR4_SD3_DAT1
711 | GPSR4_SD3_DAT0 | GPSR4_SD3_CMD | GPSR4_SD3_CLK);
712 pfc_reg_write(PFC_GPSR5, GPSR5_SSI_SDATA9
713 | GPSR5_MSIOF0_SS2
714 | GPSR5_MSIOF0_SS1
715 | GPSR5_RX2_A
716 | GPSR5_TX2_A
717 | GPSR5_SCK2_A | GPSR5_RTS0_TANS_A | GPSR5_CTS0_A);
718 pfc_reg_write(PFC_GPSR6, GPSR6_USB30_PWEN
719 | GPSR6_SSI_SDATA6
720 | GPSR6_SSI_WS6
721 | GPSR6_SSI_WS5
722 | GPSR6_SSI_SCK5
723 | GPSR6_SSI_SDATA4
724 | GPSR6_USB30_OVC
725 | GPSR6_AUDIO_CLKA
726 | GPSR6_SSI_SDATA3
727 | GPSR6_SSI_WS349
728 | GPSR6_SSI_SCK349
729 | GPSR6_SSI_SDATA1
730 | GPSR6_SSI_SDATA0
731 | GPSR6_SSI_WS01239 | GPSR6_SSI_SCK01239);
732
733 /* initialize POC control */
734 reg = mmio_read_32(PFC_IOCTRL30);
735 reg = ((reg & IOCTRL30_MASK) | POC_SD1_DAT3_33V
736 | POC_SD1_DAT2_33V
737 | POC_SD1_DAT1_33V
738 | POC_SD1_DAT0_33V
739 | POC_SD1_CMD_33V
740 | POC_SD1_CLK_33V
741 | POC_SD0_DAT3_33V
742 | POC_SD0_DAT2_33V
743 | POC_SD0_DAT1_33V
744 | POC_SD0_DAT0_33V | POC_SD0_CMD_33V | POC_SD0_CLK_33V);
745 pfc_reg_write(PFC_IOCTRL30, reg);
746 reg = mmio_read_32(PFC_IOCTRL32);
747 reg = (reg & IOCTRL32_MASK);
748 pfc_reg_write(PFC_IOCTRL32, reg);
749
750 /* initialize LSI pin pull-up/down control */
751 pfc_reg_write(PFC_PUD0, 0xFDF80000U);
752 pfc_reg_write(PFC_PUD1, 0xCE298464U);
753 pfc_reg_write(PFC_PUD2, 0xA4C380F4U);
754 pfc_reg_write(PFC_PUD3, 0x0000079FU);
755 pfc_reg_write(PFC_PUD4, 0xFFF0FFFFU);
756 pfc_reg_write(PFC_PUD5, 0x40000000U);
757
758 /* initialize LSI pin pull-enable register */
759 pfc_reg_write(PFC_PUEN0, 0xFFF00000U);
760 pfc_reg_write(PFC_PUEN1, 0x00000000U);
761 pfc_reg_write(PFC_PUEN2, 0x00000004U);
762 pfc_reg_write(PFC_PUEN3, 0x00000000U);
763 pfc_reg_write(PFC_PUEN4, 0x07800010U);
764 pfc_reg_write(PFC_PUEN5, 0x00000000U);
765
766 /* initialize positive/negative logic select */
767 mmio_write_32(GPIO_POSNEG0, 0x00000000U);
768 mmio_write_32(GPIO_POSNEG1, 0x00000000U);
769 mmio_write_32(GPIO_POSNEG2, 0x00000000U);
770 mmio_write_32(GPIO_POSNEG3, 0x00000000U);
771 mmio_write_32(GPIO_POSNEG4, 0x00000000U);
772 mmio_write_32(GPIO_POSNEG5, 0x00000000U);
773 mmio_write_32(GPIO_POSNEG6, 0x00000000U);
774
775 /* initialize general IO/interrupt switching */
776 mmio_write_32(GPIO_IOINTSEL0, 0x00020000U);
777 mmio_write_32(GPIO_IOINTSEL1, 0x00000000U);
778 mmio_write_32(GPIO_IOINTSEL2, 0x00000000U);
779 mmio_write_32(GPIO_IOINTSEL3, 0x00000000U);
780 mmio_write_32(GPIO_IOINTSEL4, 0x00000000U);
781 mmio_write_32(GPIO_IOINTSEL5, 0x00000000U);
782 mmio_write_32(GPIO_IOINTSEL6, 0x00000000U);
783
784 /* initialize general output register */
785 mmio_write_32(GPIO_OUTDT0, 0x00000010U);
786 mmio_write_32(GPIO_OUTDT1, 0x00100000U);
787 mmio_write_32(GPIO_OUTDT2, 0x00000000U);
788 mmio_write_32(GPIO_OUTDT3, 0x00008000U);
789 mmio_write_32(GPIO_OUTDT5, 0x00060000U);
790 mmio_write_32(GPIO_OUTDT6, 0x00000000U);
791
792 /* initialize general input/output switching */
793 mmio_write_32(GPIO_INOUTSEL0, 0x00000010U);
794 mmio_write_32(GPIO_INOUTSEL1, 0x00100020U);
795 mmio_write_32(GPIO_INOUTSEL2, 0x03000000U);
796 mmio_write_32(GPIO_INOUTSEL3, 0x00008000U);
797 mmio_write_32(GPIO_INOUTSEL4, 0x00000000U);
798 mmio_write_32(GPIO_INOUTSEL5, 0x00060000U);
799 mmio_write_32(GPIO_INOUTSEL6, 0x00004000U);
800}