xloader: Panda - kill OTG and reset PHY in case ROM started them
[x-loader:lihh89s-x-loader.git] / board / omap4430panda / omap4430panda.c
1 /*
2  * (C) Copyright 2004-2009
3  * Texas Instruments, <www.ti.com>
4  * Richard Woodruff <r-woodruff2@ti.com>
5  *
6  * See file CREDITS for list of people who contributed to this
7  * project.
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * version 2 as published by the Free Software Foundation.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21  * MA 02111-1307 USA
22  */
23 #include <common.h>
24 #include <asm/arch/cpu.h>
25 #include <asm/io.h>
26 #include <asm/arch/bits.h>
27 #include <asm/arch/mux.h>
28 #include <asm/arch/sys_proto.h>
29 #include <asm/arch/sys_info.h>
30 #include <asm/arch/clocks.h>
31 #include <asm/arch/mem.h>
32 #include <i2c.h>
33 #if (CONFIG_COMMANDS & CFG_CMD_NAND) && defined(CFG_NAND_LEGACY)
34 #include <linux/mtd/nand_legacy.h>
35 #endif
36
37 /* EMIF and DMM registers */
38 #define EMIF1_BASE                      0x4c000000
39 #define EMIF2_BASE                      0x4d000000
40 #define DMM_BASE                        0x4e000000
41 /* EMIF */
42 #define EMIF_MOD_ID_REV                 0x0000
43 #define EMIF_STATUS                     0x0004
44 #define EMIF_SDRAM_CONFIG               0x0008
45 #define EMIF_LPDDR2_NVM_CONFIG          0x000C
46 #define EMIF_SDRAM_REF_CTRL             0x0010
47 #define EMIF_SDRAM_REF_CTRL_SHDW        0x0014
48 #define EMIF_SDRAM_TIM_1                0x0018
49 #define EMIF_SDRAM_TIM_1_SHDW           0x001C
50 #define EMIF_SDRAM_TIM_2                0x0020
51 #define EMIF_SDRAM_TIM_2_SHDW           0x0024
52 #define EMIF_SDRAM_TIM_3                0x0028
53 #define EMIF_SDRAM_TIM_3_SHDW           0x002C
54 #define EMIF_LPDDR2_NVM_TIM             0x0030
55 #define EMIF_LPDDR2_NVM_TIM_SHDW        0x0034
56 #define EMIF_PWR_MGMT_CTRL              0x0038
57 #define EMIF_PWR_MGMT_CTRL_SHDW         0x003C
58 #define EMIF_LPDDR2_MODE_REG_DATA       0x0040
59 #define EMIF_LPDDR2_MODE_REG_CFG        0x0050
60 #define EMIF_L3_CONFIG                  0x0054
61 #define EMIF_L3_CFG_VAL_1               0x0058
62 #define EMIF_L3_CFG_VAL_2               0x005C
63 #define IODFT_TLGC                      0x0060
64 #define EMIF_PERF_CNT_1                 0x0080
65 #define EMIF_PERF_CNT_2                 0x0084
66 #define EMIF_PERF_CNT_CFG               0x0088
67 #define EMIF_PERF_CNT_SEL               0x008C
68 #define EMIF_PERF_CNT_TIM               0x0090
69 #define EMIF_READ_IDLE_CTRL             0x0098
70 #define EMIF_READ_IDLE_CTRL_SHDW        0x009c
71 #define EMIF_ZQ_CONFIG                  0x00C8
72 #define EMIF_DDR_PHY_CTRL_1             0x00E4
73 #define EMIF_DDR_PHY_CTRL_1_SHDW        0x00E8
74 #define EMIF_DDR_PHY_CTRL_2             0x00EC
75
76 #define DMM_LISA_MAP_0                  0x0040
77 #define DMM_LISA_MAP_1                  0x0044
78 #define DMM_LISA_MAP_2                  0x0048
79 #define DMM_LISA_MAP_3                  0x004C
80
81 #define MR0_ADDR                        0
82 #define MR1_ADDR                        1
83 #define MR2_ADDR                        2
84 #define MR4_ADDR                        4
85 #define MR10_ADDR                       10
86 #define MR16_ADDR                       16
87 #define REF_EN                          0x40000000
88 /* defines for MR1 */
89 #define MR1_BL4                         2
90 #define MR1_BL8                         3
91 #define MR1_BL16                        4
92
93 #define MR1_BT_SEQ                      0
94 #define BT_INT                          1
95
96 #define MR1_WC                          0
97 #define MR1_NWC                         1
98
99 #define MR1_NWR3                        1
100 #define MR1_NWR4                        2
101 #define MR1_NWR5                        3
102 #define MR1_NWR6                        4
103 #define MR1_NWR7                        5
104 #define MR1_NWR8                        6
105
106 #define MR1_VALUE       ((MR1_NWR3 << 5) | (MR1_WC << 4) | (MR1_BT_SEQ << 3)  \
107                                                         | (MR1_BL8 << 0))
108
109 /* defines for MR2 */
110 #define MR2_RL3_WL1                     1
111 #define MR2_RL4_WL2                     2
112 #define MR2_RL5_WL2                     3
113 #define MR2_RL6_WL3                     4
114
115 /* defines for MR10 */
116 #define MR10_ZQINIT                     0xFF
117 #define MR10_ZQRESET                    0xC3
118 #define MR10_ZQCL                       0xAB
119 #define MR10_ZQCS                       0x56
120
121
122 /* TODO: FREQ update method is not working so shadow registers programming
123  * is just for same of completeness. This would be safer if auto
124  * trasnitions are working
125  */
126 #define FREQ_UPDATE_EMIF
127 /* EMIF Needs to be configured@19.2 MHz and shadow registers
128  * should be programmed for new OPP.
129  */
130 /* Elpida 2x2Gbit */
131 #define SDRAM_CONFIG_INIT               0x80800EB1
132 #define DDR_PHY_CTRL_1_INIT             0x849FFFF5
133 #define READ_IDLE_CTRL                  0x000501FF
134 #define PWR_MGMT_CTRL                   0x4000000f
135 #define PWR_MGMT_CTRL_OPP100            0x4000000f
136 #define ZQ_CONFIG                       0x500b3215
137
138 #define CS1_MR(mr)      ((mr) | 0x80000000)
139 struct ddr_regs{
140         u32 tim1;
141         u32 tim2;
142         u32 tim3;
143         u32 phy_ctrl_1;
144         u32 ref_ctrl;
145         u32 config_init;
146         u32 config_final;
147         u32 zq_config;
148         u8 mr1;
149         u8 mr2;
150 };
151 const struct ddr_regs ddr_regs_380_mhz = {
152         .tim1           = 0x10cb061a,
153         .tim2           = 0x20350d52,
154         .tim3           = 0x00b1431f,
155         .phy_ctrl_1     = 0x849FF408,
156         .ref_ctrl       = 0x000005ca,
157         .config_init    = 0x80000eb1,
158         .config_final   = 0x80001ab1,
159         .zq_config      = 0x500b3215,
160         .mr1            = 0x83,
161         .mr2            = 0x4
162 };
163
164 /*
165  * Unused timings - but we may need them later
166  * Keep them commented
167  */
168 #if 0
169 const struct ddr_regs ddr_regs_400_mhz = {
170         .tim1           = 0x10eb065a,
171         .tim2           = 0x20370dd2,
172         .tim3           = 0x00b1c33f,
173         .phy_ctrl_1     = 0x849FF408,
174         .ref_ctrl       = 0x00000618,
175         .config_init    = 0x80000eb1,
176         .config_final   = 0x80001ab1,
177         .zq_config      = 0x500b3215,
178         .mr1            = 0x83,
179         .mr2            = 0x4
180 };
181
182 const struct ddr_regs ddr_regs_200_mhz = {
183         .tim1           = 0x08648309,
184         .tim2           = 0x101b06ca,
185         .tim3           = 0x0048a19f,
186         .phy_ctrl_1     = 0x849FF405,
187         .ref_ctrl       = 0x0000030c,
188         .config_init    = 0x80000eb1,
189         .config_final   = 0x80000eb1,
190         .zq_config      = 0x500b3215,
191         .mr1            = 0x23,
192         .mr2            = 0x1
193 };
194 #endif
195
196 const struct ddr_regs ddr_regs_200_mhz_2cs = {
197         .tim1           = 0x08648309,
198         .tim2           = 0x101b06ca,
199         .tim3           = 0x0048a19f,
200         .phy_ctrl_1     = 0x849FF405,
201         .ref_ctrl       = 0x0000030c,
202         .config_init    = 0x80000eb9,
203         .config_final   = 0x80000eb9,
204         .zq_config      = 0xD00b3215,
205         .mr1            = 0x23,
206         .mr2            = 0x1
207 };
208
209 const struct ddr_regs ddr_regs_400_mhz_2cs = {
210         /* tRRD changed from 10ns to 12.5ns because of the tFAW requirement*/
211         .tim1           = 0x10eb0662,
212         .tim2           = 0x20370dd2,
213         .tim3           = 0x00b1c33f,
214         .phy_ctrl_1     = 0x849FF408,
215         .ref_ctrl       = 0x00000618,
216         .config_init    = 0x80000eb9,
217         .config_final   = 0x80001ab9,
218         .zq_config      = 0xD00b3215,
219         .mr1            = 0x83,
220         .mr2            = 0x4
221 };
222
223 /*******************************************************
224  * Routine: delay
225  * Description: spinning delay to use before udelay works
226  ******************************************************/
227 static inline void delay(unsigned long loops)
228 {
229         __asm__ volatile ("1:\n" "subs %0, %1, #1\n"
230                           "bne 1b" : "=r" (loops) : "0"(loops));
231 }
232
233
234 void big_delay(unsigned int count)
235 {
236         int i;
237         for (i = 0; i < count; i++)
238                 delay(1);
239 }
240
241 void reset_phy(unsigned int base)
242 {
243         __raw_writel(__raw_readl(base + IODFT_TLGC) | (1 << 10),
244                                                              base + IODFT_TLGC);
245 }
246
247 /* this flashes the Panda LEDs forever, if called after muxconf */
248
249 void spam_leds(void)
250 {
251         unsigned int v = __raw_readl(OMAP44XX_GPIO_BASE1 + 0x134);
252
253         /* set both LED gpio to output */
254         __raw_writel((v & ~(0x03 << 7)), OMAP44XX_GPIO_BASE1 + 0x134);
255
256         v = __raw_readl(OMAP44XX_GPIO_BASE1 + 0x13c);
257         while (1) {
258                 __raw_writel((v & ~(0x03 << 7)), OMAP44XX_GPIO_BASE1 + 0x13c);
259                 big_delay(3000000);
260                 __raw_writel((v | (0x03 << 7)), OMAP44XX_GPIO_BASE1 + 0x13c);
261                 big_delay(3000000);
262         }
263 }
264
265 /* TODO: FREQ update method is not working so shadow registers programming
266  * is just for same of completeness. This would be safer if auto
267  * trasnitions are working
268  */
269 static int emif_config(unsigned int base)
270 {
271         unsigned int reg_value, rev;
272         const struct ddr_regs *ddr_regs = NULL;
273         rev = omap_revision();
274
275         if (rev == OMAP4430_ES1_0)
276                 ddr_regs = &ddr_regs_380_mhz;
277         else if (rev == OMAP4430_ES2_0)
278                 ddr_regs = &ddr_regs_200_mhz_2cs;
279         else if (rev >= OMAP4430_ES2_1)
280                 ddr_regs = &ddr_regs_400_mhz_2cs;
281
282         /*
283          * set SDRAM CONFIG register
284          * EMIF_SDRAM_CONFIG[31:29] REG_SDRAM_TYPE = 4 for LPDDR2-S4
285          * EMIF_SDRAM_CONFIG[28:27] REG_IBANK_POS = 0
286          * EMIF_SDRAM_CONFIG[13:10] REG_CL = 3
287          * EMIF_SDRAM_CONFIG[6:4] REG_IBANK = 3 - 8 banks
288          * EMIF_SDRAM_CONFIG[3] REG_EBANK = 0 - CS0
289          * EMIF_SDRAM_CONFIG[2:0] REG_PAGESIZE = 2  - 512- 9 column
290          * JDEC specs - S4-2Gb --8 banks -- R0-R13, C0-c8
291          */
292         __raw_writel(__raw_readl(base + EMIF_LPDDR2_NVM_CONFIG) & 0xbfffffff,
293                                                  base + EMIF_LPDDR2_NVM_CONFIG);
294         __raw_writel(ddr_regs->config_init, base + EMIF_SDRAM_CONFIG);
295
296         /* PHY control values */
297         __raw_writel(DDR_PHY_CTRL_1_INIT, base + EMIF_DDR_PHY_CTRL_1);
298         __raw_writel(ddr_regs->phy_ctrl_1, base + EMIF_DDR_PHY_CTRL_1_SHDW);
299
300         /*
301          * EMIF_READ_IDLE_CTRL
302          */
303         __raw_writel(READ_IDLE_CTRL, base + EMIF_READ_IDLE_CTRL);
304         __raw_writel(READ_IDLE_CTRL, base + EMIF_READ_IDLE_CTRL);
305
306         /*
307          * EMIF_SDRAM_TIM_1
308          */
309         __raw_writel(ddr_regs->tim1, base + EMIF_SDRAM_TIM_1);
310         __raw_writel(ddr_regs->tim1, base + EMIF_SDRAM_TIM_1_SHDW);
311
312         /*
313          * EMIF_SDRAM_TIM_2
314          */
315         __raw_writel(ddr_regs->tim2, base + EMIF_SDRAM_TIM_2);
316         __raw_writel(ddr_regs->tim2, base + EMIF_SDRAM_TIM_2_SHDW);
317
318         /*
319          * EMIF_SDRAM_TIM_3
320          */
321         __raw_writel(ddr_regs->tim3, base + EMIF_SDRAM_TIM_3);
322         __raw_writel(ddr_regs->tim3, base + EMIF_SDRAM_TIM_3_SHDW);
323
324         __raw_writel(ddr_regs->zq_config, base + EMIF_ZQ_CONFIG);
325
326         /*
327          * poll MR0 register (DAI bit)
328          * REG_CS[31] = 0 -- Mode register command to CS0
329          * REG_REFRESH_EN[30] = 1 -- Refresh enable after MRW
330          * REG_ADDRESS[7:0] = 00 -- Refresh enable after MRW
331          */
332
333         __raw_writel(MR0_ADDR, base + EMIF_LPDDR2_MODE_REG_CFG);
334
335         do {
336                 reg_value = __raw_readl(base + EMIF_LPDDR2_MODE_REG_DATA);
337         } while (reg_value & 1);
338
339         __raw_writel(CS1_MR(MR0_ADDR), base + EMIF_LPDDR2_MODE_REG_CFG);
340
341         do {
342                 reg_value = __raw_readl(base + EMIF_LPDDR2_MODE_REG_DATA);
343         } while (reg_value & 1);
344
345
346         /* set MR10 register */
347         __raw_writel(MR10_ADDR, base + EMIF_LPDDR2_MODE_REG_CFG);
348         __raw_writel(MR10_ZQINIT, base + EMIF_LPDDR2_MODE_REG_DATA);
349         __raw_writel(CS1_MR(MR10_ADDR), base + EMIF_LPDDR2_MODE_REG_CFG);
350         __raw_writel(MR10_ZQINIT, base + EMIF_LPDDR2_MODE_REG_DATA);
351
352         /* wait for tZQINIT=1us  */
353         delay(10);
354
355         /* set MR1 register */
356         __raw_writel(MR1_ADDR, base + EMIF_LPDDR2_MODE_REG_CFG);
357         __raw_writel(ddr_regs->mr1, base + EMIF_LPDDR2_MODE_REG_DATA);
358         __raw_writel(CS1_MR(MR1_ADDR), base + EMIF_LPDDR2_MODE_REG_CFG);
359         __raw_writel(ddr_regs->mr1, base + EMIF_LPDDR2_MODE_REG_DATA);
360
361         /* set MR2 register RL=6 for OPP100 */
362         __raw_writel(MR2_ADDR, base + EMIF_LPDDR2_MODE_REG_CFG);
363         __raw_writel(ddr_regs->mr2, base + EMIF_LPDDR2_MODE_REG_DATA);
364         __raw_writel(CS1_MR(MR2_ADDR), base + EMIF_LPDDR2_MODE_REG_CFG);
365         __raw_writel(ddr_regs->mr2, base + EMIF_LPDDR2_MODE_REG_DATA);
366
367         /* Set SDRAM CONFIG register again here with final RL-WL value */
368         __raw_writel(ddr_regs->config_final, base + EMIF_SDRAM_CONFIG);
369         __raw_writel(ddr_regs->phy_ctrl_1, base + EMIF_DDR_PHY_CTRL_1);
370
371         /*
372          * EMIF_SDRAM_REF_CTRL
373          * refresh rate = DDR_CLK / reg_refresh_rate
374          * 3.9 uS = (400MHz)    / reg_refresh_rate
375          */
376         __raw_writel(ddr_regs->ref_ctrl, base + EMIF_SDRAM_REF_CTRL);
377         __raw_writel(ddr_regs->ref_ctrl, base + EMIF_SDRAM_REF_CTRL_SHDW);
378
379         /* set MR16 register */
380         __raw_writel(MR16_ADDR | REF_EN, base + EMIF_LPDDR2_MODE_REG_CFG);
381         __raw_writel(0, base + EMIF_LPDDR2_MODE_REG_DATA);
382         __raw_writel(CS1_MR(MR16_ADDR | REF_EN),
383                                                base + EMIF_LPDDR2_MODE_REG_CFG);
384         __raw_writel(0, base + EMIF_LPDDR2_MODE_REG_DATA);
385
386         /* LPDDR2 init complete */
387
388         return 0;
389 }
390 /*****************************************
391  * Routine: ddr_init
392  * Description: Configure DDR
393  * EMIF1 -- CS0 -- DDR1 (256 MB)
394  * EMIF2 -- CS0 -- DDR2 (256 MB)
395  *****************************************/
396 static void ddr_init(void)
397 {
398         unsigned int base_addr, rev;
399         rev = omap_revision();
400
401         if (rev == OMAP4430_ES1_0) {
402                 /* Configurte the Control Module DDRIO device */
403                 __raw_writel(0x1c1c1c1c, 0x4A100638);
404                 __raw_writel(0x1c1c1c1c, 0x4A10063c);
405                 __raw_writel(0x1c1c1c1c, 0x4A100640);
406                 __raw_writel(0x1c1c1c1c, 0x4A100648);
407                 __raw_writel(0x1c1c1c1c, 0x4A10064c);
408                 __raw_writel(0x1c1c1c1c, 0x4A100650);
409                 /* LPDDR2IO set to NMOS PTV */
410                 __raw_writel(0x00ffc000, 0x4A100704);
411         } else if (rev == OMAP4430_ES2_0) {
412                 __raw_writel(0x9e9e9e9e, 0x4A100638);
413                 __raw_writel(0x9e9e9e9e, 0x4A10063c);
414                 __raw_writel(0x9e9e9e9e, 0x4A100640);
415                 __raw_writel(0x9e9e9e9e, 0x4A100648);
416                 __raw_writel(0x9e9e9e9e, 0x4A10064c);
417                 __raw_writel(0x9e9e9e9e, 0x4A100650);
418                 /* LPDDR2IO set to NMOS PTV */
419                 __raw_writel(0x00ffc000, 0x4A100704);
420         }
421
422         /*
423          * DMM Configuration
424          */
425
426         /* Both EMIFs 128 byte interleaved*/
427         if (rev == OMAP4430_ES1_0)
428                 __raw_writel(0x80540300, DMM_BASE + DMM_LISA_MAP_0);
429         else
430                 __raw_writel(0x80640300, DMM_BASE + DMM_LISA_MAP_0);
431
432         __raw_writel(0x00000000, DMM_BASE + DMM_LISA_MAP_2);
433         __raw_writel(0xFF020100, DMM_BASE + DMM_LISA_MAP_3);
434
435         /* DDR needs to be initialised @ 19.2 MHz
436          * So put core DPLL in bypass mode
437          * Configure the Core DPLL but don't lock it
438          */
439         configure_core_dpll_no_lock();
440
441         /*
442          * the following is re-enabled because without the EMIF going idle,
443          * the shadow DPLL update scheme can delay for minutes until it is
444          * able to apply the new settings... it waits until EMIF idle.
445          *
446          * This is seen in the case the ROM enabled USB boot being tried before
447          * normal boot over MMC.
448          */
449
450         /* No IDLE: BUG in SDC */
451         sr32(CM_MEMIF_CLKSTCTRL, 0, 32, 0x2);
452         while ((__raw_readl(CM_MEMIF_CLKSTCTRL) & 0x700) != 0x700)
453                 ;
454
455         __raw_writel(0, EMIF1_BASE + EMIF_PWR_MGMT_CTRL);
456         __raw_writel(0, EMIF2_BASE + EMIF_PWR_MGMT_CTRL);
457
458         base_addr = EMIF1_BASE;
459         emif_config(base_addr);
460
461         /* Configure EMIF24D */
462         base_addr = EMIF2_BASE;
463         emif_config(base_addr);
464         /* Lock Core using shadow CM_SHADOW_FREQ_CONFIG1 */
465         lock_core_dpll_shadow();
466         /* TODO: SDC needs few hacks to get DDR freq update working */
467
468         /* Set DLL_OVERRIDE = 0 */
469         __raw_writel(0, CM_DLL_CTRL);
470
471         delay(200);
472
473         /* Check for DDR PHY ready for EMIF1 & EMIF2 */
474         while (!(__raw_readl(EMIF1_BASE + EMIF_STATUS) & 4) ||
475                                    !(__raw_readl(EMIF2_BASE + EMIF_STATUS) & 4))
476                 ;
477
478         /* Reprogram the DDR PYHY Control register */
479         /* PHY control values */
480
481         sr32(CM_MEMIF_EMIF_1_CLKCTRL, 0, 32, 0x1);
482         sr32(CM_MEMIF_EMIF_2_CLKCTRL, 0, 32, 0x1);
483
484         /* Put the Core Subsystem PD to ON State */
485
486         __raw_writel(0x80000000, EMIF1_BASE + EMIF_PWR_MGMT_CTRL);
487         __raw_writel(0x80000000, EMIF2_BASE + EMIF_PWR_MGMT_CTRL);
488
489         /* SYSTEM BUG:
490          * In n a specific situation, the OCP interface between the DMM and
491          * EMIF may hang.
492          * 1. A TILER port is used to perform 2D burst writes of
493          *       width 1 and height 8
494          * 2. ELLAn port is used to perform reads
495          * 3. All accesses are routed to the same EMIF controller
496          *
497          * Work around to avoid this issue REG_SYS_THRESH_MAX value should
498          * be kept higher than default 0x7. As per recommondation 0x0A will
499          * be used for better performance with REG_LL_THRESH_MAX = 0x00
500          */
501         if (rev == OMAP4430_ES1_0) {
502                 __raw_writel(0x0A0000FF, EMIF1_BASE + EMIF_L3_CONFIG);
503                 __raw_writel(0x0A0000FF, EMIF2_BASE + EMIF_L3_CONFIG);
504         }
505
506         /*
507          * DMM : DMM_LISA_MAP_0(Section_0)
508          * [31:24] SYS_ADDR             0x80
509          * [22:20] SYS_SIZE             0x7 - 2Gb
510          * [19:18] SDRC_INTLDMM         0x1 - 128 byte
511          * [17:16] SDRC_ADDRSPC         0x0
512          * [9:8] SDRC_MAP               0x3
513          * [7:0] SDRC_ADDR              0X0
514          */
515         reset_phy(EMIF1_BASE);
516         reset_phy(EMIF2_BASE);
517
518         __raw_writel(0, 0x80000000);
519         __raw_writel(0, 0x80000000);
520
521         /* MEMIF Clock Domain -> HW_AUTO */
522         sr32(CM_MEMIF_CLKSTCTRL, 0, 32, 0x3);
523 }
524 /*****************************************
525  * Routine: board_init
526  * Description: Early hardware init.
527  *****************************************/
528 int board_init(void)
529 {
530         unsigned int v;
531
532         /*
533          * If the ROM has started the OTG stuff, stop it and
534          * make it look as if uninitialized for Linux or U-Boot
535          */
536
537         /* hold OTG phy in reset */
538
539         v = __raw_readl(OMAP44XX_GPIO_BASE2 + 0x134);
540         __raw_writel((v & ~(0x01 << 30)), OMAP44XX_GPIO_BASE2 + 0x134);
541
542         v = __raw_readl(OMAP44XX_GPIO_BASE2 + 0x13c);
543         __raw_writel((v & ~(0x01 << 30)), OMAP44XX_GPIO_BASE2 + 0x13c);
544
545         /* kill USB PLL */
546
547         v = __raw_readl(0x4a008100 + 0x80);
548         __raw_writel((v & ~(7 << 0)) | 1, 0x4a008100 + 0x80);
549
550         return 0;
551 }
552
553 /*************************************************************
554  * Routine: get_mem_type(void) - returns the kind of memory connected
555  * to GPMC that we are trying to boot form. Uses SYS BOOT settings.
556  *************************************************************/
557 u32 get_mem_type(void)
558 {
559         /* no nand, so return GPMC_NONE */
560         return GPMC_NONE;
561 }
562
563 /*****************************************
564  * Routine: secure_unlock
565  * Description: Setup security registers for access
566  * (GP Device only)
567  *****************************************/
568 void secure_unlock_mem(void)
569 {
570         /* Permission values for registers -Full fledged permissions to all */
571         #define UNLOCK_1 0xFFFFFFFF
572         #define UNLOCK_2 0x00000000
573         #define UNLOCK_3 0x0000FFFF
574
575         /* Protection Module Register Target APE (PM_RT)*/
576         __raw_writel(UNLOCK_1, RT_REQ_INFO_PERMISSION_1);
577         __raw_writel(UNLOCK_1, RT_READ_PERMISSION_0);
578         __raw_writel(UNLOCK_1, RT_WRITE_PERMISSION_0);
579         __raw_writel(UNLOCK_2, RT_ADDR_MATCH_1);
580
581         __raw_writel(UNLOCK_3, GPMC_REQ_INFO_PERMISSION_0);
582         __raw_writel(UNLOCK_3, GPMC_READ_PERMISSION_0);
583         __raw_writel(UNLOCK_3, GPMC_WRITE_PERMISSION_0);
584
585         __raw_writel(UNLOCK_3, OCM_REQ_INFO_PERMISSION_0);
586         __raw_writel(UNLOCK_3, OCM_READ_PERMISSION_0);
587         __raw_writel(UNLOCK_3, OCM_WRITE_PERMISSION_0);
588         __raw_writel(UNLOCK_2, OCM_ADDR_MATCH_2);
589
590         /* IVA Changes */
591         __raw_writel(UNLOCK_3, IVA2_REQ_INFO_PERMISSION_0);
592         __raw_writel(UNLOCK_3, IVA2_READ_PERMISSION_0);
593         __raw_writel(UNLOCK_3, IVA2_WRITE_PERMISSION_0);
594
595         __raw_writel(UNLOCK_1, SMS_RG_ATT0); /* SDRC region 0 public */
596 }
597
598 /**********************************************************
599  * Routine: try_unlock_sram()
600  * Description: If chip is GP/EMU(special) type, unlock the SRAM for
601  *  general use.
602  ***********************************************************/
603 void try_unlock_memory(void)
604 {
605         /* if GP device unlock device SRAM for general use */
606         /* secure code breaks for Secure/Emulation device - HS/E/T*/
607 }
608
609
610 #if defined(CONFIG_MPU_600) || defined(CONFIG_MPU_1000)
611 static int scale_vcores(void)
612 {
613         unsigned int rev = omap_revision();
614         /* For VC bypass only VCOREx_CGF_FORCE  is necessary and
615          * VCOREx_CFG_VOLTAGE  changes can be discarded
616          */
617         /* PRM_VC_CFG_I2C_MODE */
618         __raw_writel(0, 0x4A307BA8);
619
620         /* PRM_VC_CFG_I2C_CLK */
621         __raw_writel(0x6026, 0x4A307BAC);
622
623         /* set VCORE1 force VSEL */
624         /* PRM_VC_VAL_BYPASS) */
625         if (rev == OMAP4430_ES1_0)
626                 __raw_writel(0x3B5512, 0x4A307BA0);
627         else
628                 __raw_writel(0x3A5512, 0x4A307BA0);
629
630         __raw_writel(__raw_readl(0x4A307BA0) | 0x1000000, 0x4A307BA0);
631         while (__raw_readl(0x4A307BA0) & 0x1000000)
632                 ;
633
634         /* PRM_IRQSTATUS_MPU */
635         __raw_writel(__raw_readl(0x4A306010), 0x4A306010);
636
637         /* FIXME: set VCORE2 force VSEL, Check the reset value */
638         /* PRM_VC_VAL_BYPASS) */
639         if (rev == OMAP4430_ES1_0)
640                 __raw_writel(0x315B12, 0x4A307BA0);
641         else
642                 __raw_writel(0x295B12, 0x4A307BA0);
643
644         __raw_writel(__raw_readl(0x4A307BA0) | 0x1000000, 0x4A307BA0);
645         while (__raw_readl(0x4A307BA0) & 0x1000000)
646                 ;
647
648         /* PRM_IRQSTATUS_MPU */
649         __raw_writel(__raw_readl(0x4A306010), 0x4A306010);
650
651         /*/set VCORE3 force VSEL */
652         /* PRM_VC_VAL_BYPASS */
653         switch (rev) {
654         case OMAP4430_ES1_0:
655                 __raw_writel(0x316112, 0x4A307BA0);
656                 break;
657         case OMAP4430_ES2_0:
658                 __raw_writel(0x296112, 0x4A307BA0);
659                 break;
660         case OMAP4430_ES2_1:
661                 __raw_writel(0x2A6112, 0x4A307BA0);
662                 break;
663         }
664         __raw_writel(__raw_readl(0x4A307BA0) | 0x1000000, 0x4A307BA0);
665         while (__raw_readl(0x4A307BA0) & 0x1000000)
666                 ;
667
668         /* PRM_IRQSTATUS_MPU */
669         __raw_writel(__raw_readl(0x4A306010), 0x4A306010);
670
671         return 0;
672 }
673 #endif
674
675 /**********************************************************
676  * Routine: s_init
677  * Description: Does early system init of muxing and clocks.
678  * - Called path is with SRAM stack.
679  **********************************************************/
680
681 void s_init(void)
682 {
683         unsigned int rev = omap_revision();
684
685         /*
686          * this is required to survive the muxconf in the case the ROM
687          * started up USB OTG
688          */
689         prcm_init();
690
691         set_muxconf_regs();
692
693         delay(100);
694
695         /* Writing to AuxCR in U-boot using SMI for GP/EMU DEV */
696         /* Currently SMI in Kernel on ES2 devices seems to have an isse
697          * Once that is resolved, we can postpone this config to kernel
698          */
699         /* setup_auxcr(get_device_type(), external_boot); */
700
701         ddr_init();
702
703 /* Set VCORE1 = 1.3 V, VCORE2 = VCORE3 = 1.21V */
704 #if defined(CONFIG_MPU_600) || defined(CONFIG_MPU_1000)
705         scale_vcores();
706 #endif
707
708         if (rev != OMAP4430_ES1_0) {
709                 if (__raw_readl(0x4805D138) & (1<<22)) {
710                         /* enable software ioreq */
711                         sr32(0x4A30a31C, 8, 1, 0x1);
712                         /* set for sys_clk (38.4MHz) */
713                         sr32(0x4A30a31C, 1, 2, 0x0);
714                         /* set divisor to 2 */
715                         sr32(0x4A30a31C, 16, 4, 0x1);
716                         /* set the clock source to active */
717                         sr32(0x4A30a110, 0, 1, 0x1);
718                         /* enable clocks */
719                         sr32(0x4A30a110, 2, 2, 0x3);
720                 } else {
721                         /* enable software ioreq */
722                         sr32(0x4A30a314, 8, 1, 0x1);
723                         /* set for PER_DPLL */
724                         sr32(0x4A30a314, 1, 2, 0x2);
725                         /* set divisor to 16 */
726                         sr32(0x4A30a314, 16, 4, 0xf);
727                         /* set the clock source to active */
728                         sr32(0x4A30a110, 0, 1, 0x1);
729                         /* enable clocks */
730                         sr32(0x4A30a110, 2, 2, 0x3);
731                 }
732         }
733 }
734
735 /*******************************************************
736  * Routine: misc_init_r
737  * Description: Init ethernet (done here so udelay works)
738  ********************************************************/
739 int misc_init_r(void)
740 {
741         return 0;
742 }
743
744 /******************************************************
745  * Routine: wait_for_command_complete
746  * Description: Wait for posting to finish on watchdog
747  ******************************************************/
748 void wait_for_command_complete(unsigned int wd_base)
749 {
750         int pending = 1;
751         do {
752                 pending = __raw_readl(wd_base + WWPS);
753         } while (pending);
754 }
755
756 /*******************************************************************
757  * Routine:ether_init
758  * Description: take the Ethernet controller out of reset and wait
759  *                 for the EEPROM load to complete.
760  ******************************************************************/
761
762 /**********************************************
763  * Routine: dram_init
764  * Description: sets uboots idea of sdram size
765  **********************************************/
766 int dram_init(void)
767 {
768         return 0;
769 }
770
771 #define OMAP44XX_WKUP_CTRL_BASE 0x4A31E000
772
773 #if 1
774 #define M0_SAFE M0
775 #define M1_SAFE M1
776 #define M2_SAFE M2
777 #define M4_SAFE M4
778 #define M7_SAFE M7
779 #define M3_SAFE M3
780 #define M5_SAFE M5
781 #define M6_SAFE M6
782 #else
783 #define M0_SAFE M7
784 #define M1_SAFE M7
785 #define M2_SAFE M7
786 #define M4_SAFE M7
787 #define M7_SAFE M7
788 #define M3_SAFE M7
789 #define M5_SAFE M7
790 #define M6_SAFE M7
791 #endif
792 #define         MV(OFFSET, VALUE) \
793                         __raw_writew((VALUE), OMAP44XX_CTRL_BASE + (OFFSET));
794 #define         MV1(OFFSET, VALUE) \
795                       __raw_writew((VALUE), OMAP44XX_WKUP_CTRL_BASE + (OFFSET));
796
797 #define         CP(x)   (CONTROL_PADCONF_##x)
798 #define         WK(x)   (CONTROL_WKUP_##x)
799 /*
800  * IEN  - Input Enable
801  * IDIS - Input Disable
802  * PTD  - Pull type Down
803  * PTU  - Pull type Up
804  * DIS  - Pull type selection is inactive
805  * EN   - Pull type selection is active
806  * M0   - Mode 0
807  * The commented string gives the final mux configuration for that pin
808  */
809
810 struct omap4panda_mux {
811         unsigned int ads;
812         unsigned int value;
813 };
814
815 static const struct omap4panda_mux omap4panda_mux[] = {
816         { OMAP44XX_CTRL_BASE + CP(GPMC_AD0),
817                  PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1  /* sdmmc2_dat0 */ },
818         { OMAP44XX_CTRL_BASE + CP(GPMC_AD1),
819                  PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1  /* sdmmc2_dat1 */ },
820         { OMAP44XX_CTRL_BASE + CP(GPMC_AD2),
821                  PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1  /* sdmmc2_dat2 */ },
822         { OMAP44XX_CTRL_BASE + CP(GPMC_AD3),
823                  PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1  /* sdmmc2_dat3 */ },
824         { OMAP44XX_CTRL_BASE + CP(GPMC_AD4),
825                  PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1  /* sdmmc2_dat4 */ },
826         { OMAP44XX_CTRL_BASE + CP(GPMC_AD5),
827                  PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1  /* sdmmc2_dat5 */ },
828         { OMAP44XX_CTRL_BASE + CP(GPMC_AD6),
829                  PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1  /* sdmmc2_dat6 */ },
830         { OMAP44XX_CTRL_BASE + CP(GPMC_AD7),
831                  PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1  /* sdmmc2_dat7 */ },
832         { OMAP44XX_CTRL_BASE + CP(GPMC_AD8),
833                      PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M3  /* gpio_32 */ },
834         { OMAP44XX_CTRL_BASE + CP(GPMC_AD9),
835                                                 PTU | IEN | M3  /* gpio_33 */ },
836         { OMAP44XX_CTRL_BASE + CP(GPMC_AD10),
837                                                 PTU | IEN | M3  /* gpio_34 */ },
838         { OMAP44XX_CTRL_BASE + CP(GPMC_AD11),
839                                                 PTU | IEN | M3  /* gpio_35 */ },
840         { OMAP44XX_CTRL_BASE + CP(GPMC_AD12),
841                                                 PTU | IEN | M3  /* gpio_36 */ },
842         { OMAP44XX_CTRL_BASE + CP(GPMC_AD13),
843                       PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3  /* gpio_37 */ },
844         { OMAP44XX_CTRL_BASE + CP(GPMC_AD14),
845                       PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3  /* gpio_38 */ },
846         { OMAP44XX_CTRL_BASE + CP(GPMC_AD15),
847                       PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3  /* gpio_39 */ },
848         { OMAP44XX_CTRL_BASE + CP(GPMC_A16), M3  /* gpio_40 */ },
849         { OMAP44XX_CTRL_BASE + CP(GPMC_A17), PTD | M3  /* gpio_41 */ },
850         { OMAP44XX_CTRL_BASE + CP(GPMC_A18),
851                     PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1  /* kpd_row6 */ },
852         { OMAP44XX_CTRL_BASE + CP(GPMC_A19),
853                     PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1  /* kpd_row7 */ },
854         { OMAP44XX_CTRL_BASE + CP(GPMC_A20),
855                                                       IEN | M3  /* gpio_44 */ },
856         { OMAP44XX_CTRL_BASE + CP(GPMC_A21), M3  /* gpio_45 */ },
857         { OMAP44XX_CTRL_BASE + CP(GPMC_A22), M3  /* gpio_46 */ },
858         { OMAP44XX_CTRL_BASE + CP(GPMC_A23),
859                                 OFF_EN | OFF_PD | OFF_IN | M1  /* kpd_col7 */ },
860         { OMAP44XX_CTRL_BASE + CP(GPMC_A24), PTD | M3  /* gpio_48 */ },
861         { OMAP44XX_CTRL_BASE + CP(GPMC_A25), PTD | M3  /* gpio_49 */ },
862         { OMAP44XX_CTRL_BASE + CP(GPMC_NCS0), M3  /* gpio_50 */ },
863         { OMAP44XX_CTRL_BASE + CP(GPMC_NCS1), IEN | M3  /* gpio_51 */ },
864         { OMAP44XX_CTRL_BASE + CP(GPMC_NCS2), IEN | M3  /* gpio_52 */ },
865         { OMAP44XX_CTRL_BASE + CP(GPMC_NCS3), IEN | M3  /* gpio_53 */ },
866         { OMAP44XX_CTRL_BASE + CP(GPMC_NWP), M3  /* gpio_54 */ },
867         { OMAP44XX_CTRL_BASE + CP(GPMC_CLK), PTD | M3  /* gpio_55 */ },
868         { OMAP44XX_CTRL_BASE + CP(GPMC_NADV_ALE), M3  /* gpio_56 */ },
869         { OMAP44XX_CTRL_BASE + CP(GPMC_NOE),
870                       PTU | IEN | OFF_EN | OFF_OUT_PTD | M1  /* sdmmc2_clk */ },
871         { OMAP44XX_CTRL_BASE + CP(GPMC_NWE),
872                   PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1  /* sdmmc2_cmd */ },
873         { OMAP44XX_CTRL_BASE + CP(GPMC_NBE0_CLE), M3  /* gpio_59 */ },
874         { OMAP44XX_CTRL_BASE + CP(GPMC_NBE1), PTD | M3  /* gpio_60 */ },
875         { OMAP44XX_CTRL_BASE + CP(GPMC_WAIT0), PTU | IEN | M3  /* gpio_61 */ },
876         { OMAP44XX_CTRL_BASE + CP(GPMC_WAIT1),
877                        PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3 /* gpio_62 */ },
878         { OMAP44XX_CTRL_BASE + CP(C2C_DATA11), PTD | M3  /* gpio_100 */ },
879         { OMAP44XX_CTRL_BASE + CP(C2C_DATA12), PTD | IEN | M3  /* gpio_101 */ },
880         { OMAP44XX_CTRL_BASE + CP(C2C_DATA13), PTD | M3  /* gpio_102 */ },
881         { OMAP44XX_CTRL_BASE + CP(C2C_DATA14), M1  /* dsi2_te0 */ },
882         { OMAP44XX_CTRL_BASE + CP(C2C_DATA15), PTD | M3  /* gpio_104 */ },
883         { OMAP44XX_CTRL_BASE + CP(HDMI_HPD), M0  /* hdmi_hpd */ },
884         { OMAP44XX_CTRL_BASE + CP(HDMI_CEC), M0  /* hdmi_cec */ },
885         { OMAP44XX_CTRL_BASE + CP(HDMI_DDC_SCL), PTU | M0  /* hdmi_ddc_scl */ },
886         { OMAP44XX_CTRL_BASE + CP(HDMI_DDC_SDA),
887                                            PTU | IEN | M0  /* hdmi_ddc_sda */ },
888         { OMAP44XX_CTRL_BASE + CP(CSI21_DX0), IEN | M0  /* csi21_dx0 */ },
889         { OMAP44XX_CTRL_BASE + CP(CSI21_DY0), IEN | M0  /* csi21_dy0 */ },
890         { OMAP44XX_CTRL_BASE + CP(CSI21_DX1), IEN | M0  /* csi21_dx1 */ },
891         { OMAP44XX_CTRL_BASE + CP(CSI21_DY1), IEN | M0  /* csi21_dy1 */ },
892         { OMAP44XX_CTRL_BASE + CP(CSI21_DX2), IEN | M0  /* csi21_dx2 */ },
893         { OMAP44XX_CTRL_BASE + CP(CSI21_DY2), IEN | M0  /* csi21_dy2 */ },
894         { OMAP44XX_CTRL_BASE + CP(CSI21_DX3), PTD | M7  /* csi21_dx3 */ },
895         { OMAP44XX_CTRL_BASE + CP(CSI21_DY3), PTD | M7  /* csi21_dy3 */ },
896         { OMAP44XX_CTRL_BASE + CP(CSI21_DX4),
897                          PTD | OFF_EN | OFF_PD | OFF_IN | M7  /* csi21_dx4 */ },
898         { OMAP44XX_CTRL_BASE + CP(CSI21_DY4),
899                          PTD | OFF_EN | OFF_PD | OFF_IN | M7  /* csi21_dy4 */ },
900         { OMAP44XX_CTRL_BASE + CP(CSI22_DX0), IEN | M0  /* csi22_dx0 */ },
901         { OMAP44XX_CTRL_BASE + CP(CSI22_DY0), IEN | M0  /* csi22_dy0 */ },
902         { OMAP44XX_CTRL_BASE + CP(CSI22_DX1), IEN | M0  /* csi22_dx1 */ },
903         { OMAP44XX_CTRL_BASE + CP(CSI22_DY1), IEN | M0  /* csi22_dy1 */ },
904         { OMAP44XX_CTRL_BASE + CP(CAM_SHUTTER),
905                         OFF_EN | OFF_PD | OFF_OUT_PTD | M0  /* cam_shutter */ },
906         { OMAP44XX_CTRL_BASE + CP(CAM_STROBE),
907                          OFF_EN | OFF_PD | OFF_OUT_PTD | M0  /* cam_strobe */ },
908         { OMAP44XX_CTRL_BASE + CP(CAM_GLOBALRESET),
909                       PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M3  /* gpio_83 */ },
910         { OMAP44XX_CTRL_BASE + CP(USBB1_ULPITLL_CLK),
911            PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M4  /* usbb1_ulpiphy_clk */ },
912         { OMAP44XX_CTRL_BASE + CP(USBB1_ULPITLL_STP),
913                            OFF_EN | OFF_OUT_PTD | M4  /* usbb1_ulpiphy_stp */ },
914         { OMAP44XX_CTRL_BASE + CP(USBB1_ULPITLL_DIR),
915                  IEN | OFF_EN | OFF_PD | OFF_IN | M4  /* usbb1_ulpiphy_dir */ },
916         { OMAP44XX_CTRL_BASE + CP(USBB1_ULPITLL_NXT),
917                  IEN | OFF_EN | OFF_PD | OFF_IN | M4  /* usbb1_ulpiphy_nxt */ },
918         { OMAP44XX_CTRL_BASE + CP(USBB1_ULPITLL_DAT0),
919                 IEN | OFF_EN | OFF_PD | OFF_IN | M4  /* usbb1_ulpiphy_dat0 */ },
920         { OMAP44XX_CTRL_BASE + CP(USBB1_ULPITLL_DAT1),
921                 IEN | OFF_EN | OFF_PD | OFF_IN | M4  /* usbb1_ulpiphy_dat1 */ },
922         { OMAP44XX_CTRL_BASE + CP(USBB1_ULPITLL_DAT2),
923                 IEN | OFF_EN | OFF_PD | OFF_IN | M4  /* usbb1_ulpiphy_dat2 */ },
924         { OMAP44XX_CTRL_BASE + CP(USBB1_ULPITLL_DAT3),
925                 IEN | OFF_EN | OFF_PD | OFF_IN | M4  /* usbb1_ulpiphy_dat3 */ },
926         { OMAP44XX_CTRL_BASE + CP(USBB1_ULPITLL_DAT4),
927                 IEN | OFF_EN | OFF_PD | OFF_IN | M4  /* usbb1_ulpiphy_dat4 */ },
928         { OMAP44XX_CTRL_BASE + CP(USBB1_ULPITLL_DAT5),
929                 IEN | OFF_EN | OFF_PD | OFF_IN | M4  /* usbb1_ulpiphy_dat5 */ },
930         { OMAP44XX_CTRL_BASE + CP(USBB1_ULPITLL_DAT6),
931                 IEN | OFF_EN | OFF_PD | OFF_IN | M4  /* usbb1_ulpiphy_dat6 */ },
932         { OMAP44XX_CTRL_BASE + CP(USBB1_ULPITLL_DAT7),
933                 IEN | OFF_EN | OFF_PD | OFF_IN | M4  /* usbb1_ulpiphy_dat7 */ },
934         { OMAP44XX_CTRL_BASE + CP(USBB1_HSIC_DATA),
935                    IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* usbb1_hsic_data */ },
936         { OMAP44XX_CTRL_BASE + CP(USBB1_HSIC_STROBE),
937                  IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* usbb1_hsic_strobe */ },
938         { OMAP44XX_CTRL_BASE + CP(USBC1_ICUSB_DP),
939                                                IEN | M0  /* usbc1_icusb_dp */ },
940         { OMAP44XX_CTRL_BASE + CP(USBC1_ICUSB_DM),
941                                                IEN | M0  /* usbc1_icusb_dm */ },
942         { OMAP44XX_CTRL_BASE + CP(SDMMC1_CLK),
943                             PTU | OFF_EN | OFF_OUT_PTD | M0  /* sdmmc1_clk */ },
944         { OMAP44XX_CTRL_BASE + CP(SDMMC1_CMD),
945                   PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* sdmmc1_cmd */ },
946         { OMAP44XX_CTRL_BASE + CP(SDMMC1_DAT0),
947                  PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* sdmmc1_dat0 */ },
948         { OMAP44XX_CTRL_BASE + CP(SDMMC1_DAT1),
949                  PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* sdmmc1_dat1 */ },
950         { OMAP44XX_CTRL_BASE + CP(SDMMC1_DAT2),
951                  PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* sdmmc1_dat2 */ },
952         { OMAP44XX_CTRL_BASE + CP(SDMMC1_DAT3),
953                  PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* sdmmc1_dat3 */ },
954         { OMAP44XX_CTRL_BASE + CP(SDMMC1_DAT4),
955                  PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* sdmmc1_dat4 */ },
956         { OMAP44XX_CTRL_BASE + CP(SDMMC1_DAT5),
957                  PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* sdmmc1_dat5 */ },
958         { OMAP44XX_CTRL_BASE + CP(SDMMC1_DAT6),
959                  PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* sdmmc1_dat6 */ },
960         { OMAP44XX_CTRL_BASE + CP(SDMMC1_DAT7),
961                  PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* sdmmc1_dat7 */ },
962         { OMAP44XX_CTRL_BASE + CP(ABE_MCBSP2_CLKX),
963                    IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* abe_mcbsp2_clkx */ },
964         { OMAP44XX_CTRL_BASE + CP(ABE_MCBSP2_DR),
965                          IEN | OFF_EN | OFF_OUT_PTD | M0  /* abe_mcbsp2_dr */ },
966         { OMAP44XX_CTRL_BASE + CP(ABE_MCBSP2_DX),
967                                OFF_EN | OFF_OUT_PTD | M0  /* abe_mcbsp2_dx */ },
968         { OMAP44XX_CTRL_BASE + CP(ABE_MCBSP2_FSX),
969                     IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* abe_mcbsp2_fsx */ },
970         { OMAP44XX_CTRL_BASE + CP(ABE_MCBSP1_CLKX),
971                                            IEN | M1  /* abe_slimbus1_clock */ },
972         { OMAP44XX_CTRL_BASE + CP(ABE_MCBSP1_DR),
973                                             IEN | M1  /* abe_slimbus1_data */ },
974         { OMAP44XX_CTRL_BASE + CP(ABE_MCBSP1_DX),
975                                OFF_EN | OFF_OUT_PTD | M0  /* abe_mcbsp1_dx */ },
976         { OMAP44XX_CTRL_BASE + CP(ABE_MCBSP1_FSX),
977                     IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* abe_mcbsp1_fsx */ },
978         { OMAP44XX_CTRL_BASE + CP(ABE_PDM_UL_DATA),
979              PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* abe_pdm_ul_data */ },
980         { OMAP44XX_CTRL_BASE + CP(ABE_PDM_DL_DATA),
981              PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* abe_pdm_dl_data */ },
982         { OMAP44XX_CTRL_BASE + CP(ABE_PDM_FRAME),
983                PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* abe_pdm_frame */ },
984         { OMAP44XX_CTRL_BASE + CP(ABE_PDM_LB_CLK),
985               PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* abe_pdm_lb_clk */ },
986         { OMAP44XX_CTRL_BASE + CP(ABE_CLKS),
987                     PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* abe_clks */ },
988         { OMAP44XX_CTRL_BASE + CP(ABE_DMIC_CLK1), M0  /* abe_dmic_clk1 */ },
989         { OMAP44XX_CTRL_BASE + CP(ABE_DMIC_DIN1),
990                                                 IEN | M0  /* abe_dmic_din1 */ },
991         { OMAP44XX_CTRL_BASE + CP(ABE_DMIC_DIN2),
992                                                 IEN | M0  /* abe_dmic_din2 */ },
993         { OMAP44XX_CTRL_BASE + CP(ABE_DMIC_DIN3),
994                                                 IEN | M0  /* abe_dmic_din3 */ },
995         { OMAP44XX_CTRL_BASE + CP(UART2_CTS), PTU | IEN | M0  /* uart2_cts */ },
996         { OMAP44XX_CTRL_BASE + CP(UART2_RTS), M0  /* uart2_rts */ },
997         { OMAP44XX_CTRL_BASE + CP(UART2_RX), PTU | IEN | M0  /* uart2_rx */ },
998         { OMAP44XX_CTRL_BASE + CP(UART2_TX), M0  /* uart2_tx */ },
999         { OMAP44XX_CTRL_BASE + CP(HDQ_SIO), M3  /* gpio_127 */ },
1000         { OMAP44XX_CTRL_BASE + CP(I2C1_SCL), PTU | IEN | M0  /* i2c1_scl */ },
1001         { OMAP44XX_CTRL_BASE + CP(I2C1_SDA), PTU | IEN | M0  /* i2c1_sda */ },
1002         { OMAP44XX_CTRL_BASE + CP(I2C2_SCL), PTU | IEN | M0  /* i2c2_scl */ },
1003         { OMAP44XX_CTRL_BASE + CP(I2C2_SDA), PTU | IEN | M0  /* i2c2_sda */ },
1004         { OMAP44XX_CTRL_BASE + CP(I2C3_SCL), PTU | IEN | M0  /* i2c3_scl */ },
1005         { OMAP44XX_CTRL_BASE + CP(I2C3_SDA), PTU | IEN | M0  /* i2c3_sda */ },
1006         { OMAP44XX_CTRL_BASE + CP(I2C4_SCL), PTU | IEN | M0  /* i2c4_scl */ },
1007         { OMAP44XX_CTRL_BASE + CP(I2C4_SDA), PTU | IEN | M0  /* i2c4_sda */ },
1008         { OMAP44XX_CTRL_BASE + CP(MCSPI1_CLK),
1009                         IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* mcspi1_clk */ },
1010         { OMAP44XX_CTRL_BASE + CP(MCSPI1_SOMI),
1011                        IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* mcspi1_somi */ },
1012         { OMAP44XX_CTRL_BASE + CP(MCSPI1_SIMO),
1013                        IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* mcspi1_simo */ },
1014         { OMAP44XX_CTRL_BASE + CP(MCSPI1_CS0),
1015                   PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* mcspi1_cs0 */ },
1016         { OMAP44XX_CTRL_BASE + CP(MCSPI1_CS1),
1017                   PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M3  /* mcspi1_cs1 */ },
1018         { OMAP44XX_CTRL_BASE + CP(MCSPI1_CS2),
1019                               PTU | OFF_EN | OFF_OUT_PTU | M3  /* gpio_139 */ },
1020         { OMAP44XX_CTRL_BASE + CP(MCSPI1_CS3), PTU | IEN | M3  /* gpio_140 */ },
1021         { OMAP44XX_CTRL_BASE + CP(UART3_CTS_RCTX),
1022                                                PTU | IEN | M0  /* uart3_tx */ },
1023         { OMAP44XX_CTRL_BASE + CP(UART3_RTS_SD), M0  /* uart3_rts_sd */ },
1024         { OMAP44XX_CTRL_BASE + CP(UART3_RX_IRRX), IEN | M0  /* uart3_rx */ },
1025         { OMAP44XX_CTRL_BASE + CP(UART3_TX_IRTX), M0  /* uart3_tx */ },
1026         { OMAP44XX_CTRL_BASE + CP(SDMMC5_CLK),
1027                       PTU | IEN | OFF_EN | OFF_OUT_PTD | M0  /* sdmmc5_clk */ },
1028         { OMAP44XX_CTRL_BASE + CP(SDMMC5_CMD),
1029                   PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* sdmmc5_cmd */ },
1030         { OMAP44XX_CTRL_BASE + CP(SDMMC5_DAT0),
1031                  PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* sdmmc5_dat0 */ },
1032         { OMAP44XX_CTRL_BASE + CP(SDMMC5_DAT1),
1033                  PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* sdmmc5_dat1 */ },
1034         { OMAP44XX_CTRL_BASE + CP(SDMMC5_DAT2),
1035                  PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* sdmmc5_dat2 */ },
1036         { OMAP44XX_CTRL_BASE + CP(SDMMC5_DAT3),
1037                  PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* sdmmc5_dat3 */ },
1038         { OMAP44XX_CTRL_BASE + CP(MCSPI4_CLK),
1039                         IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* mcspi4_clk */ },
1040         { OMAP44XX_CTRL_BASE + CP(MCSPI4_SIMO),
1041                        IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* mcspi4_simo */ },
1042         { OMAP44XX_CTRL_BASE + CP(MCSPI4_SOMI),
1043                        IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* mcspi4_somi */ },
1044         { OMAP44XX_CTRL_BASE + CP(MCSPI4_CS0),
1045                   PTD | IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* mcspi4_cs0 */ },
1046         { OMAP44XX_CTRL_BASE + CP(UART4_RX), IEN | M0  /* uart4_rx */ },
1047         { OMAP44XX_CTRL_BASE + CP(UART4_TX), M0  /* uart4_tx */ },
1048         { OMAP44XX_CTRL_BASE + CP(USBB2_ULPITLL_CLK),
1049                                                      IEN | M3  /* gpio_157 */ },
1050         { OMAP44XX_CTRL_BASE + CP(USBB2_ULPITLL_STP),
1051                                                 IEN | M5  /* dispc2_data23 */ },
1052         { OMAP44XX_CTRL_BASE + CP(USBB2_ULPITLL_DIR),
1053                                                 IEN | M5  /* dispc2_data22 */ },
1054         { OMAP44XX_CTRL_BASE + CP(USBB2_ULPITLL_NXT),
1055                                                 IEN | M5  /* dispc2_data21 */ },
1056         { OMAP44XX_CTRL_BASE + CP(USBB2_ULPITLL_DAT0),
1057                                                 IEN | M5  /* dispc2_data20 */ },
1058         { OMAP44XX_CTRL_BASE + CP(USBB2_ULPITLL_DAT1),
1059                                                 IEN | M5  /* dispc2_data19 */ },
1060         { OMAP44XX_CTRL_BASE + CP(USBB2_ULPITLL_DAT2),
1061                                                 IEN | M5  /* dispc2_data18 */ },
1062         { OMAP44XX_CTRL_BASE + CP(USBB2_ULPITLL_DAT3),
1063                                                 IEN | M5  /* dispc2_data15 */ },
1064         { OMAP44XX_CTRL_BASE + CP(USBB2_ULPITLL_DAT4),
1065                                                 IEN | M5  /* dispc2_data14 */ },
1066         { OMAP44XX_CTRL_BASE + CP(USBB2_ULPITLL_DAT5),
1067                                                 IEN | M5  /* dispc2_data13 */ },
1068         { OMAP44XX_CTRL_BASE + CP(USBB2_ULPITLL_DAT6),
1069                                                 IEN | M5  /* dispc2_data12 */ },
1070         { OMAP44XX_CTRL_BASE + CP(USBB2_ULPITLL_DAT7),
1071                                                 IEN | M5  /* dispc2_data11 */ },
1072         { OMAP44XX_CTRL_BASE + CP(USBB2_HSIC_DATA),
1073                               PTD | OFF_EN | OFF_OUT_PTU | M3  /* gpio_169 */ },
1074         { OMAP44XX_CTRL_BASE + CP(USBB2_HSIC_STROBE),
1075                               PTD | OFF_EN | OFF_OUT_PTU | M3  /* gpio_170 */ },
1076         { OMAP44XX_CTRL_BASE + CP(UNIPRO_TX0), PTD | IEN | M3  /* gpio_171 */ },
1077         { OMAP44XX_CTRL_BASE + CP(UNIPRO_TY0),
1078                                 OFF_EN | OFF_PD | OFF_IN | M1  /* kpd_col1 */ },
1079         { OMAP44XX_CTRL_BASE + CP(UNIPRO_TX1),
1080                                 OFF_EN | OFF_PD | OFF_IN | M1  /* kpd_col2 */ },
1081         { OMAP44XX_CTRL_BASE + CP(UNIPRO_TY1),
1082                                 OFF_EN | OFF_PD | OFF_IN | M1  /* kpd_col3 */ },
1083         { OMAP44XX_CTRL_BASE + CP(UNIPRO_TX2), PTU | IEN | M3  /* gpio_0 */ },
1084         { OMAP44XX_CTRL_BASE + CP(UNIPRO_TY2), PTU | IEN | M3  /* gpio_1 */ },
1085         { OMAP44XX_CTRL_BASE + CP(UNIPRO_RX0),
1086                     PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1  /* kpd_row0 */ },
1087         { OMAP44XX_CTRL_BASE + CP(UNIPRO_RY0),
1088                     PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1  /* kpd_row1 */ },
1089         { OMAP44XX_CTRL_BASE + CP(UNIPRO_RX1),
1090                     PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1  /* kpd_row2 */ },
1091         { OMAP44XX_CTRL_BASE + CP(UNIPRO_RY1),
1092                     PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1  /* kpd_row3 */ },
1093         { OMAP44XX_CTRL_BASE + CP(UNIPRO_RX2),
1094                     PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1  /* kpd_row4 */ },
1095         { OMAP44XX_CTRL_BASE + CP(UNIPRO_RY2),
1096                     PTU | IEN | OFF_EN | OFF_PD | OFF_IN | M1  /* kpd_row5 */ },
1097         { OMAP44XX_CTRL_BASE + CP(USBA0_OTG_CE),
1098                  PTD | OFF_EN | OFF_PD | OFF_OUT_PTD | M0  /* usba0_otg_ce */ },
1099         { OMAP44XX_CTRL_BASE + CP(USBA0_OTG_DP),
1100                       IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* usba0_otg_dp */ },
1101         { OMAP44XX_CTRL_BASE + CP(USBA0_OTG_DM),
1102                       IEN | OFF_EN | OFF_PD | OFF_IN | M0  /* usba0_otg_dm */ },
1103         { OMAP44XX_CTRL_BASE + CP(FREF_CLK1_OUT), M0  /* fref_clk1_out */ },
1104         { OMAP44XX_CTRL_BASE + CP(FREF_CLK2_OUT),
1105                                                PTD | IEN | M3  /* gpio_182 */ },
1106         { OMAP44XX_CTRL_BASE + CP(SYS_NIRQ1), PTU | IEN | M0  /* sys_nirq1 */ },
1107         { OMAP44XX_CTRL_BASE + CP(SYS_NIRQ2), PTU | IEN | M0  /* sys_nirq2 */ },
1108         { OMAP44XX_CTRL_BASE + CP(SYS_BOOT0), PTU | IEN | M3  /* gpio_184 */ },
1109         { OMAP44XX_CTRL_BASE + CP(SYS_BOOT1), M3  /* gpio_185 */ },
1110         { OMAP44XX_CTRL_BASE + CP(SYS_BOOT2), PTD | IEN | M3  /* gpio_186 */ },
1111         { OMAP44XX_CTRL_BASE + CP(SYS_BOOT3), M3  /* gpio_187 */ },
1112         { OMAP44XX_CTRL_BASE + CP(SYS_BOOT4), M3  /* gpio_188 */ },
1113         { OMAP44XX_CTRL_BASE + CP(SYS_BOOT5), PTD | IEN | M3  /* gpio_189 */ },
1114         { OMAP44XX_CTRL_BASE + CP(DPM_EMU0), IEN | M0  /* dpm_emu0 */ },
1115         { OMAP44XX_CTRL_BASE + CP(DPM_EMU1), IEN | M0  /* dpm_emu1 */ },
1116         { OMAP44XX_CTRL_BASE + CP(DPM_EMU2), IEN | M0  /* dpm_emu2 */ },
1117         { OMAP44XX_CTRL_BASE + CP(DPM_EMU3), IEN | M5  /* dispc2_data10 */ },
1118         { OMAP44XX_CTRL_BASE + CP(DPM_EMU4), IEN | M5  /* dispc2_data9 */ },
1119         { OMAP44XX_CTRL_BASE + CP(DPM_EMU5), IEN | M5  /* dispc2_data16 */ },
1120         { OMAP44XX_CTRL_BASE + CP(DPM_EMU6), IEN | M5  /* dispc2_data17 */ },
1121         { OMAP44XX_CTRL_BASE + CP(DPM_EMU7), IEN | M5  /* dispc2_hsync */ },
1122         { OMAP44XX_CTRL_BASE + CP(DPM_EMU8), IEN | M5  /* dispc2_pclk */ },
1123         { OMAP44XX_CTRL_BASE + CP(DPM_EMU9), IEN | M5  /* dispc2_vsync */ },
1124         { OMAP44XX_CTRL_BASE + CP(DPM_EMU10), IEN | M5  /* dispc2_de */ },
1125         { OMAP44XX_CTRL_BASE + CP(DPM_EMU11), IEN | M5  /* dispc2_data8 */ },
1126         { OMAP44XX_CTRL_BASE + CP(DPM_EMU12), IEN | M5  /* dispc2_data7 */ },
1127         { OMAP44XX_CTRL_BASE + CP(DPM_EMU13), IEN | M5  /* dispc2_data6 */ },
1128         { OMAP44XX_CTRL_BASE + CP(DPM_EMU14), IEN | M5  /* dispc2_data5 */ },
1129         { OMAP44XX_CTRL_BASE + CP(DPM_EMU15), IEN | M5  /* dispc2_data4 */ },
1130         { OMAP44XX_CTRL_BASE + CP(DPM_EMU16), M3  /* gpio_27 */ },
1131         { OMAP44XX_CTRL_BASE + CP(DPM_EMU17), IEN | M5  /* dispc2_data2 */ },
1132         { OMAP44XX_CTRL_BASE + CP(DPM_EMU18), IEN | M5  /* dispc2_data1 */ },
1133         { OMAP44XX_CTRL_BASE + CP(DPM_EMU19), IEN | M5  /* dispc2_data0 */ },
1134         { OMAP44XX_WKUP_CTRL_BASE + WK(PAD0_SIM_IO), IEN | M0  /* sim_io */ },
1135         { OMAP44XX_WKUP_CTRL_BASE + WK(PAD1_SIM_CLK), M0  /* sim_clk */ },
1136         { OMAP44XX_WKUP_CTRL_BASE + WK(PAD0_SIM_RESET), M0  /* sim_reset */ },
1137         { OMAP44XX_WKUP_CTRL_BASE + WK(PAD1_SIM_CD),
1138                                                  PTU | IEN | M0  /* sim_cd */ },
1139         { OMAP44XX_WKUP_CTRL_BASE + WK(PAD0_SIM_PWRCTRL),
1140                                                         M0  /* sim_pwrctrl */ },
1141         { OMAP44XX_WKUP_CTRL_BASE + WK(PAD1_SR_SCL),
1142                                                  PTU | IEN | M0  /* sr_scl */ },
1143         { OMAP44XX_WKUP_CTRL_BASE + WK(PAD0_SR_SDA),
1144                                                  PTU | IEN | M0  /* sr_sda */ },
1145         { OMAP44XX_WKUP_CTRL_BASE + WK(PAD1_FREF_XTAL_IN), M0  /* # */ },
1146         { OMAP44XX_WKUP_CTRL_BASE + WK(PAD0_FREF_SLICER_IN),
1147                                                      M0  /* fref_slicer_in */ },
1148         { OMAP44XX_WKUP_CTRL_BASE + WK(PAD1_FREF_CLK_IOREQ),
1149                                                      M0  /* fref_clk_ioreq */ },
1150         { OMAP44XX_WKUP_CTRL_BASE + WK(PAD0_FREF_CLK0_OUT),
1151                                                     M2  /* sys_drm_msecure */ },
1152         { OMAP44XX_WKUP_CTRL_BASE + WK(PAD1_FREF_CLK3_REQ),
1153                                                       PTU | IEN | M0  /* # */ },
1154         { OMAP44XX_WKUP_CTRL_BASE + WK(PAD0_FREF_CLK3_OUT),
1155                                                       M0  /* fref_clk3_out */ },
1156         { OMAP44XX_WKUP_CTRL_BASE + WK(PAD1_FREF_CLK4_REQ),
1157                                                       PTU | IEN | M0  /* # */ },
1158         { OMAP44XX_WKUP_CTRL_BASE + WK(PAD0_FREF_CLK4_OUT), M0  /* # */ },
1159         { OMAP44XX_WKUP_CTRL_BASE + WK(PAD1_SYS_32K), IEN | M0  /* sys_32k */ },
1160         { OMAP44XX_WKUP_CTRL_BASE + WK(PAD0_SYS_NRESPWRON),
1161                                                       M0  /* sys_nrespwron */ },
1162         { OMAP44XX_WKUP_CTRL_BASE + WK(PAD1_SYS_NRESWARM),
1163                                                        M0  /* sys_nreswarm */ },
1164         { OMAP44XX_WKUP_CTRL_BASE + WK(PAD0_SYS_PWR_REQ),
1165                                                   PTU | M0  /* sys_pwr_req */ },
1166         { OMAP44XX_WKUP_CTRL_BASE + WK(PAD1_SYS_PWRON_RESET),
1167                                                           M3  /* gpio_wk29 */ },
1168         { OMAP44XX_WKUP_CTRL_BASE + WK(PAD0_SYS_BOOT6),
1169                                                      IEN | M3  /* gpio_wk9 */ },
1170         { OMAP44XX_WKUP_CTRL_BASE + WK(PAD1_SYS_BOOT7),
1171                                                     IEN | M3  /* gpio_wk10 */ },
1172         { OMAP44XX_WKUP_CTRL_BASE + WK(PAD1_FREF_CLK3_REQ),
1173                                                            M3 /* gpio_wk30 */ },
1174         { OMAP44XX_WKUP_CTRL_BASE + WK(PAD1_FREF_CLK4_REQ), M3 /* gpio_wk7 */ },
1175         { OMAP44XX_WKUP_CTRL_BASE + WK(PAD0_FREF_CLK4_OUT), M3 /* gpio_wk8 */ },
1176 };
1177
1178 /**********************************************************
1179  * Routine: set_muxconf_regs
1180  * Description: Setting up the configuration Mux registers
1181  *              specific to the hardware. Many pins need
1182  *              to be moved from protect to primary mode.
1183  *********************************************************/
1184 void set_muxconf_regs(void)
1185 {
1186         int n;
1187
1188         for (n = 0; n < sizeof omap4panda_mux / sizeof omap4panda_mux[0]; n++)
1189                 __raw_writew(omap4panda_mux[n].value, omap4panda_mux[n].ads);
1190 }
1191
1192 /******************************************************************************
1193  * Routine: update_mux()
1194  * Description:Update balls which are different between boards.  All should be
1195  *             updated to match functionality.  However, I'm only updating ones
1196  *             which I'll be using for now.  When power comes into play they
1197  *             all need updating.
1198  *****************************************************************************/
1199 void update_mux(u32 btype, u32 mtype)
1200 {
1201         /* REVISIT  */
1202 }
1203
1204 /* optionally do something like blinking LED */
1205 void board_hang(void)
1206 {
1207         while (1)
1208                 ;
1209 }
1210
1211 int nand_init(void)
1212 {
1213         return 0;
1214 }