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