3 * Texas Instruments, <www.ti.com>
4 * Jian Zhang <jzhang@ti.com>
5 * Richard Woodruff <r-woodruff2@ti.com>
7 * Modified for the Pandora
8 * John Willis <source@distant-earth.com>
9 * GraÅžvydas Ignotas <notasas@gmail.com>
11 * See file CREDITS for list of people who contributed to this
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 2 of
17 * the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
32 #include <asm/arch/cpu.h>
33 #include <asm/arch/bits.h>
34 #include <asm/arch/mux.h>
35 #include <asm/arch/gpio.h>
36 #include <asm/arch/sys_proto.h>
37 #include <asm/arch/sys_info.h>
38 #include <asm/arch/clocks.h>
39 #include <asm/arch/mem.h>
44 #define __raw_readl(a) (*(volatile unsigned int *)(a))
45 #define __raw_writel(v, a) (*(volatile unsigned int *)(a) = (v))
46 #define __raw_readw(a) (*(volatile unsigned short *)(a))
47 #define __raw_writew(v, a) (*(volatile unsigned short *)(a) = (v))
49 /* slight RAM timing differencer,
50 * tCKE differs from beagle's Micron part */
51 #define MICRON_V_ACTIMB_200_2 (((MICRON_V_ACTIMB_200) & ~(7 << 12)) | (1 << 12))
53 /*******************************************************
55 * Description: spinning delay to use before udelay works
56 ******************************************************/
57 static inline void delay(unsigned long loops)
59 __asm__ volatile ("1:\n" "subs %0, %1, #1\n"
60 "bne 1b":"=r" (loops):"0"(loops));
63 void udelay (unsigned long usecs) {
67 /*****************************************
69 * Description: Early hardware init.
70 *****************************************/
73 #ifdef CONFIG_DRIVER_OMAP34XX_I2C
76 /* restore GPBR1 for charging to work -
77 * boot ROM or something clears it before us */
79 i2c_write(0x49, 0x91, 1, &byte, 1);
81 /* disable VSIM to prevent audio noise */
83 i2c_write(0x4B, 0x92, 1, &byte, 1);
86 /* do additional init to prevent trash being output on startup */
89 /* VAUX3 = 2.8V (AV connector) */
91 i2c_write(0x4B, 0x7A, 1, &byte, 1);
93 i2c_write(0x4B, 0x7D, 1, &byte, 1);
100 /*************************************************************
101 * Routine: get_mem_type(void) - returns the kind of memory connected
102 * to GPMC that we are trying to boot form. Uses SYS BOOT settings.
103 *************************************************************/
104 u32 get_mem_type(void)
106 u32 mem_type = get_sysboot_value();
148 static void early_nand_init(void)
150 /* global settings */
151 __raw_writel(0x10, GPMC_SYSCONFIG); /* smart idle */
152 __raw_writel(0x0, GPMC_IRQENABLE); /* isr's sources masked */
153 __raw_writel(0, GPMC_TIMEOUT_CONTROL); /* timeout disable */
155 /* Set the GPMC Vals, NAND is mapped at CS0, oneNAND at CS0.
156 * We configure only GPMC CS0 with required values. Configiring other devices
157 * at other CS is done in u-boot. So we don't have to bother doing it here.
159 __raw_writel(0 , GPMC_CONFIG7 + GPMC_CONFIG_CS0);
162 __raw_writel(M_NAND_GPMC_CONFIG1, GPMC_CONFIG1 + GPMC_CONFIG_CS0);
163 __raw_writel(M_NAND_GPMC_CONFIG2, GPMC_CONFIG2 + GPMC_CONFIG_CS0);
164 __raw_writel(M_NAND_GPMC_CONFIG3, GPMC_CONFIG3 + GPMC_CONFIG_CS0);
165 __raw_writel(M_NAND_GPMC_CONFIG4, GPMC_CONFIG4 + GPMC_CONFIG_CS0);
166 __raw_writel(M_NAND_GPMC_CONFIG5, GPMC_CONFIG5 + GPMC_CONFIG_CS0);
167 __raw_writel(M_NAND_GPMC_CONFIG6, GPMC_CONFIG6 + GPMC_CONFIG_CS0);
169 /* Enable the GPMC Mapping */
170 __raw_writel((((OMAP34XX_GPMC_CS0_SIZE & 0xF)<<8) |
171 ((NAND_BASE_ADR>>24) & 0x3F) |
172 (1<<6)), (GPMC_CONFIG7 + GPMC_CONFIG_CS0));
176 #ifdef CFG_3430SDRAM_DDR
177 static int strncmp(const char *s1, const char *s2, int n)
180 for (i = 0; i < n; i++)
182 return s1[i] - s2[i];
186 #define MICRON_128MB_166MHZ 0
187 #define MICRON_256MB_200MHZ 1
189 /*********************************************************************
190 * config_sdram_ddr() - Init DDR SDRAM
191 *********************************************************************/
192 static void config_sdram_ddr(u32 cpu_family)
194 unsigned char buf[64];
195 int ram_type = MICRON_128MB_166MHZ;
199 /* reset sdrc controller */
200 __raw_writel(SOFTRESET, SDRC_SYSCONFIG);
201 wait_on_value(BIT0, BIT0, SDRC_STATUS, 12000000);
202 __raw_writel(0, SDRC_SYSCONFIG);
204 /* setup sdrc to ball mux */
205 __raw_writel(SDP_SDRC_SHARING, SDRC_SHARING);
207 /* read NAND id to guess what RAM is attached */
209 ret = nand_readid(&mfr, &id);
210 if (ret == 0 && id == 0xb3) {
211 ram_type = MICRON_256MB_200MHZ;
213 /* others share the same id (bc), luckily NAND model differs */
214 ret = nand_read_param_page(buf, sizeof(buf));
216 if (strncmp((char *)buf + 44, "MT29F4G16ABBDA", 14) == 0)
217 ram_type = MICRON_256MB_200MHZ;
221 if (ram_type == MICRON_256MB_200MHZ) {
222 __raw_writel(0x2, SDRC_CS_CFG); /* 256MB/bank */
223 __raw_writel(SDP_SDRC_MDCFG_0_DDR_MICRON_XM, SDRC_MCFG_0);
224 __raw_writel(SDP_SDRC_MDCFG_0_DDR_MICRON_XM, SDRC_MCFG_1);
226 __raw_writel(0x1, SDRC_CS_CFG); /* 128MB/bank */
227 __raw_writel(SDP_SDRC_MDCFG_0_DDR, SDRC_MCFG_0);
228 __raw_writel(SDP_SDRC_MDCFG_0_DDR, SDRC_MCFG_1);
231 if (cpu_family == CPU_OMAP36XX && ram_type == MICRON_256MB_200MHZ) {
232 __raw_writel(MICRON_V_ACTIMA_200, SDRC_ACTIM_CTRLA_0);
233 __raw_writel(MICRON_V_ACTIMB_200_2, SDRC_ACTIM_CTRLB_0);
234 __raw_writel(MICRON_V_ACTIMA_200, SDRC_ACTIM_CTRLA_1);
235 __raw_writel(MICRON_V_ACTIMB_200_2, SDRC_ACTIM_CTRLB_1);
236 __raw_writel(SDP_3430_SDRC_RFR_CTRL_200MHz, SDRC_RFR_CTRL_0);
237 __raw_writel(SDP_3430_SDRC_RFR_CTRL_200MHz, SDRC_RFR_CTRL_1);
239 /* reprogram CORE DPLL to 400MHz */
240 sr32(CM_CLKEN_PLL, 0, 3, PLL_FAST_RELOCK_BYPASS);
241 wait_on_value(BIT0, 0, CM_IDLEST_CKGEN, LDELAY);
242 sr32(CM_CLKSEL1_PLL, 16, 11, 400); /* Set M */
243 sr32(CM_CLKSEL1_PLL, 8, 7, N_13); /* Set N */
244 sr32(CM_CLKEN_PLL, 0, 3, PLL_LOCK); /* lock mode */
245 wait_on_value(BIT0, 1, CM_IDLEST_CKGEN, LDELAY);
247 __raw_writel(MICRON_V_ACTIMA_165, SDRC_ACTIM_CTRLA_0);
248 __raw_writel(MICRON_V_ACTIMB_165, SDRC_ACTIM_CTRLB_0);
249 __raw_writel(MICRON_V_ACTIMA_165, SDRC_ACTIM_CTRLA_1);
250 __raw_writel(MICRON_V_ACTIMB_165, SDRC_ACTIM_CTRLB_1);
251 __raw_writel(SDP_3430_SDRC_RFR_CTRL_165MHz, SDRC_RFR_CTRL_0);
252 __raw_writel(SDP_3430_SDRC_RFR_CTRL_165MHz, SDRC_RFR_CTRL_1);
255 __raw_writel(SDP_SDRC_POWER_POP, SDRC_POWER);
257 /* init sequence for mDDR/mSDR using manual commands (DDR is different) */
258 __raw_writel(CMD_NOP, SDRC_MANUAL_0);
259 __raw_writel(CMD_NOP, SDRC_MANUAL_1);
263 __raw_writel(CMD_PRECHARGE, SDRC_MANUAL_0);
264 __raw_writel(CMD_PRECHARGE, SDRC_MANUAL_1);
266 __raw_writel(CMD_AUTOREFRESH, SDRC_MANUAL_0);
267 __raw_writel(CMD_AUTOREFRESH, SDRC_MANUAL_1);
269 __raw_writel(CMD_AUTOREFRESH, SDRC_MANUAL_0);
270 __raw_writel(CMD_AUTOREFRESH, SDRC_MANUAL_1);
273 __raw_writel(SDP_SDRC_MR_0_DDR, SDRC_MR_0);
274 __raw_writel(SDP_SDRC_MR_0_DDR, SDRC_MR_1);
277 __raw_writel(SDP_SDRC_DLLAB_CTRL, SDRC_DLLA_CTRL);
278 delay(0x2000); /* give time to lock */
280 #endif /* CFG_3430SDRAM_DDR */
282 /*************************************************************
283 * get_sys_clk_speed - determine reference oscillator speed
284 * based on known 32kHz clock and gptimer.
285 *************************************************************/
286 u32 get_osc_clk_speed(void)
288 u32 start, cstart, cend, cdiff, cdiv, val;
290 val = __raw_readl(PRM_CLKSRC_CTRL);
292 if (val & SYSCLKDIV_2)
298 val = __raw_readl(CM_CLKSEL_WKUP) | BIT0;
299 __raw_writel(val, CM_CLKSEL_WKUP); /* select sys_clk for GPT1 */
301 /* Enable I and F Clocks for GPT1 */
302 val = __raw_readl(CM_ICLKEN_WKUP) | BIT0 | BIT2;
303 __raw_writel(val, CM_ICLKEN_WKUP);
304 val = __raw_readl(CM_FCLKEN_WKUP) | BIT0;
305 __raw_writel(val, CM_FCLKEN_WKUP);
307 __raw_writel(0, OMAP34XX_GPT1 + TLDR); /* start counting at 0 */
308 __raw_writel(GPT_EN, OMAP34XX_GPT1 + TCLR); /* enable clock */
309 /* enable 32kHz source */
310 /* enabled out of reset */
311 /* determine sys_clk via gauging */
313 start = 20 + __raw_readl(S32K_CR); /* start time in 20 cycles */
314 while (__raw_readl(S32K_CR) < start) ; /* dead loop till start time */
315 cstart = __raw_readl(OMAP34XX_GPT1 + TCRR); /* get start sys_clk count */
316 while (__raw_readl(S32K_CR) < (start + 20)) ; /* wait for 40 cycles */
317 cend = __raw_readl(OMAP34XX_GPT1 + TCRR); /* get end sys_clk count */
318 cdiff = cend - cstart; /* get elapsed ticks */
321 /* based on number of ticks assign speed */
324 else if (cdiff > 15200)
326 else if (cdiff > 13000)
328 else if (cdiff > 9000)
330 else if (cdiff > 7600)
336 /******************************************************************************
337 * prcm_init() - inits clocks for PRCM as defined in clocks.h
338 * -- called from SRAM, or Flash (using temp SRAM stack).
339 *****************************************************************************/
340 void prcm_init_(u32 cpu_family)
342 u32 osc_clk, sys_clkin_sel;
345 /* Gauge the input clock speed and find out the sys_clkin_sel
346 * value corresponding to the input clock.
348 osc_clk = get_osc_clk_speed();
349 get_sys_clkin_sel(osc_clk, &sys_clkin_sel);
351 sr32(PRM_CLKSEL, 0, 3, sys_clkin_sel); /* set input crystal speed */
353 /* If the input clock is greater than 19.2M always divide/2 */
354 m = (sys_clkin_sel > 2) ? 2 : 1;
355 sr32(PRM_CLKSRC_CTRL, 6, 2, m); /* input clock divider */
357 sr32(PRM_CLKSRC_CTRL, 0, 2, 0);/* Bypass mode: T2 inputs a square clock */
359 /* Unlock MPU DPLL (slows things down, and needed later) */
360 sr32(CM_CLKEN_PLL_MPU, 0, 3, PLL_LOW_POWER_BYPASS);
361 wait_on_value(BIT0, 0, CM_IDLEST_PLL_MPU, LDELAY);
364 /* sr32(CM_CLKSEL2_EMU) set override to work when asleep */
365 sr32(CM_CLKEN_PLL, 0, 3, PLL_FAST_RELOCK_BYPASS);
366 wait_on_value(BIT0, 0, CM_IDLEST_CKGEN, LDELAY);
368 /* *_13 because of 'input clock divider' above */
369 sr32(CM_CLKSEL1_EMU, 16, 5, CORE_M3X2); /* m3x2 */
370 sr32(CM_CLKSEL1_PLL, 27, 2, M2_13); /* Set M2 */
371 sr32(CM_CLKSEL1_PLL, 16, 11, M_13); /* Set M */
372 sr32(CM_CLKSEL1_PLL, 8, 7, N_13); /* Set N */
373 sr32(CM_CLKSEL1_PLL, 6, 1, 0); /* 96M Src */
374 sr32(CM_CLKSEL_CORE, 8, 4, CORE_SSI_DIV); /* ssi */
375 sr32(CM_CLKSEL_CORE, 4, 2, CORE_FUSB_DIV); /* fsusb */
376 sr32(CM_CLKSEL_CORE, 2, 2, CORE_L4_DIV); /* l4 */
377 sr32(CM_CLKSEL_CORE, 0, 2, CORE_L3_DIV); /* l3 */
378 sr32(CM_CLKSEL_WKUP, 1, 2, WKUP_RSM); /* reset mgr */
379 sr32(CM_CLKEN_PLL, 4, 4, FSEL_13); /* FREQSEL */
380 sr32(CM_CLKEN_PLL, 0, 3, PLL_LOCK); /* lock mode */
381 wait_on_value(BIT0, 1, CM_IDLEST_CKGEN, LDELAY);
384 m = (cpu_family == CPU_OMAP36XX) ? 0x360 : 0x1B0;
385 sr32(CM_CLKEN_PLL, 16, 3, PLL_STOP);
386 wait_on_value(BIT1, 0, CM_IDLEST_CKGEN, LDELAY);
387 sr32(CM_CLKSEL1_EMU, 24, 5, PER_M6X2); /* set M6 */
388 sr32(CM_CLKSEL_CAM, 0, 5, PER_M5X2); /* set M5 */
389 sr32(CM_CLKSEL_DSS, 0, 5, PER_M4X2); /* set M4 */
390 sr32(CM_CLKSEL_DSS, 8, 5, PER_M3X2); /* set M3 */
391 sr32(CM_CLKSEL3_PLL, 0, 5, 0x09); /* set M2 */
392 sr32(CM_CLKSEL2_PLL, 8, 11, m); /* set m */
393 sr32(CM_CLKSEL2_PLL, 0, 7, 0x0C); /* set n */
394 sr32(CM_CLKEN_PLL, 20, 4, 0x03); /* FREQSEL */
395 sr32(CM_CLKEN_PLL, 16, 3, PLL_LOCK); /* lock mode */
396 wait_on_value(BIT1, 2, CM_IDLEST_CKGEN, LDELAY);
398 /* MPU DPLL (unlocked already) */
399 m = (cpu_family == CPU_OMAP36XX) ? 600 : 500;
400 sr32(CM_CLKSEL2_PLL_MPU, 0, 5, 0x01); /* Set M2 */
401 sr32(CM_CLKSEL1_PLL_MPU, 8, 11, m); /* Set M */
402 sr32(CM_CLKSEL1_PLL_MPU, 0, 7, 0x0C); /* Set N */
403 sr32(CM_CLKEN_PLL_MPU, 4, 4, 0x03); /* FREQSEL */
404 sr32(CM_CLKEN_PLL_MPU, 0, 3, PLL_LOCK); /* lock mode */
405 wait_on_value(BIT0, 1, CM_IDLEST_PLL_MPU, LDELAY);
407 /* Set up GPTimers to sys_clk source only */
408 sr32(CM_CLKSEL_PER, 0, 8, 0xff);
409 sr32(CM_CLKSEL_WKUP, 0, 1, 1);
414 /**********************************************************
416 * Description: Does early system init of muxing and clocks.
417 * - Called at time when only stack is available.
418 **********************************************************/
430 cpu_family = get_cpu_family();
431 prcm_init_(cpu_family);
432 config_sdram_ddr(cpu_family);
435 /*******************************************************
436 * Routine: misc_init_r
437 ********************************************************/
438 int misc_init_r(void)
441 unsigned char buf[64];
445 printf("OpenPandora System\n");
449 ret = nand_read_param_page(buf, sizeof(buf));
451 for (i = 0; i < sizeof(nand_model) - 1; i++) {
452 if (buf[i + 44] == ' ')
454 nand_model[i] = buf[i + 44];
457 printf("NAND: %s\n", nand_model);
464 /******************************************************
465 * Routine: wait_for_command_complete
466 * Description: Wait for posting to finish on watchdog
467 ******************************************************/
468 void wait_for_command_complete(unsigned int wd_base)
472 pending = __raw_readl(wd_base + WWPS);
476 /****************************************
477 * Routine: watchdog_init
478 * Description: Shut down watch dogs
479 *****************************************/
480 void watchdog_init(void)
482 /* There are 3 watch dogs WD1=Secure, WD2=MPU, WD3=IVA. WD1 is
483 * either taken care of by ROM (HS/EMU) or not accessible (GP).
484 * We need to take care of WD2-MPU or take a PRCM reset. WD3
485 * should not be running and does not generate a PRCM reset.
487 sr32(CM_FCLKEN_WKUP, 5, 1, 1);
488 sr32(CM_ICLKEN_WKUP, 5, 1, 1);
489 wait_on_value(BIT5, 0x20, CM_IDLEST_WKUP, 5); /* some issue here */
491 __raw_writel(WD_UNLOCK1, WD2_BASE + WSPR);
492 wait_for_command_complete(WD2_BASE);
493 __raw_writel(WD_UNLOCK2, WD2_BASE + WSPR);
496 /**********************************************
498 * Description: sets uboots idea of sdram size
499 **********************************************/
505 /*****************************************************************
506 * Routine: peripheral_enable
507 * Description: Enable the clks & power for perifs (GPT2, UART1,...)
508 ******************************************************************/
509 void per_clocks_enable(void)
511 /* Enable GP2 timer. */
512 sr32(CM_CLKSEL_PER, 0, 1, 0x1); /* GPT2 = sys clk */
513 sr32(CM_ICLKEN_PER, 3, 1, 0x1); /* ICKen GPT2 */
514 sr32(CM_FCLKEN_PER, 3, 1, 0x1); /* FCKen GPT2 */
518 sr32(CM_FCLKEN1_CORE, 13, 1, 0x1);
519 sr32(CM_ICLKEN1_CORE, 13, 1, 0x1);
522 sr32(CM_FCLKEN_PER, 11, 1, 0x1);
523 sr32(CM_ICLKEN_PER, 11, 1, 0x1);
526 #ifdef CONFIG_DRIVER_OMAP34XX_I2C
527 /* Turn on all 3 I2C clocks */
528 sr32(CM_FCLKEN1_CORE, 15, 3, 0x7);
529 sr32(CM_ICLKEN1_CORE, 15, 3, 0x7); /* I2C1,2,3 = on */
532 /* Enable the ICLK for 32K Sync Timer as its used in udelay */
533 sr32(CM_ICLKEN_WKUP, 2, 1, 0x1);
535 sr32(CM_FCLKEN_IVA2, 0, 32, FCK_IVA2_ON);
536 sr32(CM_FCLKEN1_CORE, 0, 32, FCK_CORE1_ON);
537 sr32(CM_ICLKEN1_CORE, 0, 32, ICK_CORE1_ON);
538 sr32(CM_ICLKEN2_CORE, 0, 32, ICK_CORE2_ON);
539 sr32(CM_FCLKEN_WKUP, 0, 32, FCK_WKUP_ON);
540 sr32(CM_ICLKEN_WKUP, 0, 32, ICK_WKUP_ON);
541 sr32(CM_FCLKEN_DSS, 0, 32, FCK_DSS_ON);
542 sr32(CM_ICLKEN_DSS, 0, 32, ICK_DSS_ON);
543 sr32(CM_FCLKEN_CAM, 0, 32, FCK_CAM_ON);
544 sr32(CM_ICLKEN_CAM, 0, 32, ICK_CAM_ON);
545 sr32(CM_FCLKEN_PER, 0, 32, FCK_PER_ON);
546 sr32(CM_ICLKEN_PER, 0, 32, ICK_PER_ON);
548 /* Enable GPIO5 clocks for blinky LEDs */
549 sr32(CM_FCLKEN_PER, 16, 1, 0x1); /* FCKen GPIO5 */
550 sr32(CM_ICLKEN_PER, 16, 1, 0x1); /* ICKen GPIO5 */
555 /* Set MUX for UART, GPMC, SDRC, GPIO */
557 #define MUX_VAL(OFFSET,VALUE)\
558 __raw_writew((VALUE), OMAP34XX_CTRL_BASE + (OFFSET));
560 #define CP(x) (CONTROL_PADCONF_##x)
563 * IDIS - Input Disable
564 * PTD - Pull type Down
566 * DIS - Pull type selection is inactive
567 * EN - Pull type selection is active
569 * The commented string gives the final mux configuration for that pin
571 #define MUX_DEFAULT()\
573 MUX_VAL(CP(SDRC_D0), (IEN | PTD | DIS | M0)) /*SDRC_D0*/\
574 MUX_VAL(CP(SDRC_D1), (IEN | PTD | DIS | M0)) /*SDRC_D1*/\
575 MUX_VAL(CP(SDRC_D2), (IEN | PTD | DIS | M0)) /*SDRC_D2*/\
576 MUX_VAL(CP(SDRC_D3), (IEN | PTD | DIS | M0)) /*SDRC_D3*/\
577 MUX_VAL(CP(SDRC_D4), (IEN | PTD | DIS | M0)) /*SDRC_D4*/\
578 MUX_VAL(CP(SDRC_D5), (IEN | PTD | DIS | M0)) /*SDRC_D5*/\
579 MUX_VAL(CP(SDRC_D6), (IEN | PTD | DIS | M0)) /*SDRC_D6*/\
580 MUX_VAL(CP(SDRC_D7), (IEN | PTD | DIS | M0)) /*SDRC_D7*/\
581 MUX_VAL(CP(SDRC_D8), (IEN | PTD | DIS | M0)) /*SDRC_D8*/\
582 MUX_VAL(CP(SDRC_D9), (IEN | PTD | DIS | M0)) /*SDRC_D9*/\
583 MUX_VAL(CP(SDRC_D10), (IEN | PTD | DIS | M0)) /*SDRC_D10*/\
584 MUX_VAL(CP(SDRC_D11), (IEN | PTD | DIS | M0)) /*SDRC_D11*/\
585 MUX_VAL(CP(SDRC_D12), (IEN | PTD | DIS | M0)) /*SDRC_D12*/\
586 MUX_VAL(CP(SDRC_D13), (IEN | PTD | DIS | M0)) /*SDRC_D13*/\
587 MUX_VAL(CP(SDRC_D14), (IEN | PTD | DIS | M0)) /*SDRC_D14*/\
588 MUX_VAL(CP(SDRC_D15), (IEN | PTD | DIS | M0)) /*SDRC_D15*/\
589 MUX_VAL(CP(SDRC_D16), (IEN | PTD | DIS | M0)) /*SDRC_D16*/\
590 MUX_VAL(CP(SDRC_D17), (IEN | PTD | DIS | M0)) /*SDRC_D17*/\
591 MUX_VAL(CP(SDRC_D18), (IEN | PTD | DIS | M0)) /*SDRC_D18*/\
592 MUX_VAL(CP(SDRC_D19), (IEN | PTD | DIS | M0)) /*SDRC_D19*/\
593 MUX_VAL(CP(SDRC_D20), (IEN | PTD | DIS | M0)) /*SDRC_D20*/\
594 MUX_VAL(CP(SDRC_D21), (IEN | PTD | DIS | M0)) /*SDRC_D21*/\
595 MUX_VAL(CP(SDRC_D22), (IEN | PTD | DIS | M0)) /*SDRC_D22*/\
596 MUX_VAL(CP(SDRC_D23), (IEN | PTD | DIS | M0)) /*SDRC_D23*/\
597 MUX_VAL(CP(SDRC_D24), (IEN | PTD | DIS | M0)) /*SDRC_D24*/\
598 MUX_VAL(CP(SDRC_D25), (IEN | PTD | DIS | M0)) /*SDRC_D25*/\
599 MUX_VAL(CP(SDRC_D26), (IEN | PTD | DIS | M0)) /*SDRC_D26*/\
600 MUX_VAL(CP(SDRC_D27), (IEN | PTD | DIS | M0)) /*SDRC_D27*/\
601 MUX_VAL(CP(SDRC_D28), (IEN | PTD | DIS | M0)) /*SDRC_D28*/\
602 MUX_VAL(CP(SDRC_D29), (IEN | PTD | DIS | M0)) /*SDRC_D29*/\
603 MUX_VAL(CP(SDRC_D30), (IEN | PTD | DIS | M0)) /*SDRC_D30*/\
604 MUX_VAL(CP(SDRC_D31), (IEN | PTD | DIS | M0)) /*SDRC_D31*/\
605 MUX_VAL(CP(SDRC_CLK), (IEN | PTD | DIS | M0)) /*SDRC_CLK*/\
606 MUX_VAL(CP(SDRC_DQS0), (IEN | PTD | DIS | M0)) /*SDRC_DQS0*/\
607 MUX_VAL(CP(SDRC_DQS1), (IEN | PTD | DIS | M0)) /*SDRC_DQS1*/\
608 MUX_VAL(CP(SDRC_DQS2), (IEN | PTD | DIS | M0)) /*SDRC_DQS2*/\
609 MUX_VAL(CP(SDRC_DQS3), (IEN | PTD | DIS | M0)) /*SDRC_DQS3*/\
611 MUX_VAL(CP(GPMC_A1), (IDIS | PTD | DIS | M0)) /*GPMC_A1*/\
612 MUX_VAL(CP(GPMC_A2), (IDIS | PTD | DIS | M0)) /*GPMC_A2*/\
613 MUX_VAL(CP(GPMC_A3), (IDIS | PTD | DIS | M0)) /*GPMC_A3*/\
614 MUX_VAL(CP(GPMC_A4), (IDIS | PTD | DIS | M0)) /*GPMC_A4*/\
615 MUX_VAL(CP(GPMC_A5), (IDIS | PTD | DIS | M0)) /*GPMC_A5*/\
616 MUX_VAL(CP(GPMC_A6), (IDIS | PTD | DIS | M0)) /*GPMC_A6*/\
617 MUX_VAL(CP(GPMC_A7), (IDIS | PTD | DIS | M0)) /*GPMC_A7*/\
618 MUX_VAL(CP(GPMC_A8), (IDIS | PTD | DIS | M0)) /*GPMC_A8*/\
619 MUX_VAL(CP(GPMC_A9), (IDIS | PTD | DIS | M0)) /*GPMC_A9*/\
620 MUX_VAL(CP(GPMC_A10), (IDIS | PTD | DIS | M0)) /*GPMC_A10*/\
621 MUX_VAL(CP(GPMC_D0), (IEN | PTD | DIS | M0)) /*GPMC_D0*/\
622 MUX_VAL(CP(GPMC_D1), (IEN | PTD | DIS | M0)) /*GPMC_D1*/\
623 MUX_VAL(CP(GPMC_D2), (IEN | PTD | DIS | M0)) /*GPMC_D2*/\
624 MUX_VAL(CP(GPMC_D3), (IEN | PTD | DIS | M0)) /*GPMC_D3*/\
625 MUX_VAL(CP(GPMC_D4), (IEN | PTD | DIS | M0)) /*GPMC_D4*/\
626 MUX_VAL(CP(GPMC_D5), (IEN | PTD | DIS | M0)) /*GPMC_D5*/\
627 MUX_VAL(CP(GPMC_D6), (IEN | PTD | DIS | M0)) /*GPMC_D6*/\
628 MUX_VAL(CP(GPMC_D7), (IEN | PTD | DIS | M0)) /*GPMC_D7*/\
629 MUX_VAL(CP(GPMC_D8), (IEN | PTD | DIS | M0)) /*GPMC_D8*/\
630 MUX_VAL(CP(GPMC_D9), (IEN | PTD | DIS | M0)) /*GPMC_D9*/\
631 MUX_VAL(CP(GPMC_D10), (IEN | PTD | DIS | M0)) /*GPMC_D10*/\
632 MUX_VAL(CP(GPMC_D11), (IEN | PTD | DIS | M0)) /*GPMC_D11*/\
633 MUX_VAL(CP(GPMC_D12), (IEN | PTD | DIS | M0)) /*GPMC_D12*/\
634 MUX_VAL(CP(GPMC_D13), (IEN | PTD | DIS | M0)) /*GPMC_D13*/\
635 MUX_VAL(CP(GPMC_D14), (IEN | PTD | DIS | M0)) /*GPMC_D14*/\
636 MUX_VAL(CP(GPMC_D15), (IEN | PTD | DIS | M0)) /*GPMC_D15*/\
637 MUX_VAL(CP(GPMC_nCS0), (IDIS | PTU | EN | M0)) /*GPMC_nCS0*/\
638 MUX_VAL(CP(GPMC_nCS1), (IDIS | PTU | EN | M0)) /*GPMC_nCS1*/\
639 MUX_VAL(CP(GPMC_CLK), (IDIS | PTD | DIS | M0)) /*GPMC_CLK*/\
640 MUX_VAL(CP(GPMC_nADV_ALE), (IDIS | PTD | DIS | M0)) /*GPMC_nADV_ALE*/\
641 MUX_VAL(CP(GPMC_nOE), (IDIS | PTD | DIS | M0)) /*GPMC_nOE*/\
642 MUX_VAL(CP(GPMC_nWE), (IDIS | PTD | DIS | M0)) /*GPMC_nWE*/\
643 MUX_VAL(CP(GPMC_nBE0_CLE), (IDIS | PTD | DIS | M0)) /*GPMC_nBE0_CLE*/\
644 MUX_VAL(CP(GPMC_nWP), (IEN | PTD | DIS | M0)) /*GPMC_nWP*/\
645 MUX_VAL(CP(GPMC_WAIT0), (IEN | PTU | EN | M0)) /*GPMC_WAIT0*/\
646 MUX_VAL(CP(GPMC_WAIT1), (IEN | PTU | EN | M0)) /*GPMC_WAIT1*/\
647 /*Serial Interface (Peripheral boot, Linux console)*/\
648 MUX_VAL(CP(UART3_RX_IRRX), (IEN | PTU | EN | M0)) /*UART3_RX*/\
649 MUX_VAL(CP(UART3_TX_IRTX), (IDIS | PTD | DIS | M0)) /*UART3_TX*/\
651 MUX_VAL(CP(I2C1_SCL), (IEN | PTU | EN | M0)) /*I2C1_SCL*/\
652 MUX_VAL(CP(I2C1_SDA), (IEN | PTU | EN | M0)) /*I2C1_SDA*/\
653 /*LEDs (Controlled by OMAP)*/\
654 MUX_VAL(CP(MMC1_DAT6), (IDIS | PTD | DIS | M4)) /*GPIO_128*/\
655 MUX_VAL(CP(MMC1_DAT7), (IDIS | PTD | DIS | M4)) /*GPIO_129*/\
656 /*enable pulldowns for peripheral enable until u-boot loads*/\
657 MUX_VAL(CP(ETK_D0_ES2), (IDIS | PTD | EN | M4)) /*GPIO_14*/\
658 MUX_VAL(CP(McBSP2_DR), (IDIS | PTD | EN | M4)) /*GPIO_118*/\
659 MUX_VAL(CP(McBSP1_FSR), (IDIS | PTD | EN | M4)) /*GPIO_157*/\
661 /**********************************************************
662 * Routine: set_muxconf_regs
663 * Description: Setting up the configuration Mux registers
664 * specific to the hardware. Many pins need
665 * to be moved from protect to primary mode.
666 *********************************************************/
667 void set_muxconf_regs(void)
672 /**********************************************************
673 * Routine: nand+_init
674 * Description: Set up nand for nand and jffs2 commands
675 *********************************************************/
678 /* init already done in early_nand_init */
680 if (get_mem_type() != GPMC_NAND && get_mem_type() != MMC_NAND) {
682 printf("Unsupported flash chip!\n");
689 printf("Unsupported NAND Chip!\n");
697 #define DEBUG_LED1 128 /* gpio - SD Slot 1 */
698 #define DEBUG_LED2 129 /* gpio - SD Slot 2 */
700 static void blinkLEDs(void)
704 /* Alternately turn the LEDs on and off */
705 p = (unsigned long *)OMAP34XX_GPIO5_BASE;
707 /* turn LED1 on and LED2 off */
708 *(unsigned long *)(p + 0x94) = 1 << (DEBUG_LED1 % 32);
709 *(unsigned long *)(p + 0x90) = 1 << (DEBUG_LED2 % 32);
711 /* delay for a while */
714 /* turn LED1 off and LED2 on */
715 *(unsigned long *)(p + 0x90) = 1 << (DEBUG_LED1 % 32);
716 *(unsigned long *)(p + 0x94) = 1 << (DEBUG_LED2 % 32);
718 /* delay for a while */
723 /* optionally do something like blinking LED */
724 void board_hang(void)
730 /******************************************************************************
731 * Dummy function to handle errors for EABI incompatibility
732 *****************************************************************************/
737 /******************************************************************************
738 * Dummy function to handle errors for EABI incompatibility
739 *****************************************************************************/