3 * Texas Instruments, <www.ti.com>
4 * Richard Woodruff <r-woodruff2@ti.com>
6 * See file CREDITS for list of people who contributed to this
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 #include <asm/arch/omap2420.h>
27 #include <asm/arch/bits.h>
28 #include <asm/arch/mux.h>
29 #include <asm/arch/sys_proto.h>
30 #include <asm/arch/sys_info.h>
31 #include <asm/arch/mem.h>
33 #include <asm/mach-types.h>
34 #if (CONFIG_COMMANDS & CFG_CMD_NAND)
35 #include <linux/mtd/nand.h>
36 extern struct nand_chip nand_dev_desc[CFG_MAX_NAND_DEVICE];
40 static void wait_for_command_complete(unsigned int wd_base);
42 /*******************************************************
44 * Description: spinning delay to use before udelay works
45 ******************************************************/
46 static inline void delay (unsigned long loops)
48 __asm__ volatile ("1:\n" "subs %0, %1, #1\n"
49 "bne 1b":"=r" (loops):"0" (loops));
52 /*****************************************
54 * Description: Early hardware init.
55 *****************************************/
58 DECLARE_GLOBAL_DATA_PTR;
60 gpmc_init(); /* in SRAM or SDRM, finish GPMC */
62 gd->bd->bi_arch_number = MACH_TYPE_OMAP_H4; /* board id for linux */
63 gd->bd->bi_boot_params = (OMAP2420_SDRC_CS0+0x100); /* adress of boot parameters */
68 /**********************************************************
70 * Description: Does early system init of muxing and clocks.
71 * - Called path is with sram stack.
72 **********************************************************/
75 int in_sdram = running_in_sdram();
90 /*******************************************************
91 * Routine: misc_init_r
92 * Description: Init ethernet (done here so udelay works)
93 ********************************************************/
94 int misc_init_r (void)
96 ether_init(); /* better done here so timers are init'ed */
100 /****************************************
101 * Routine: watchdog_init
102 * Description: Shut down watch dogs
103 *****************************************/
104 void watchdog_init(void)
107 #define GP (BIT8|BIT9)
109 /* There are 4 watch dogs. 1 secure, and 3 general purpose.
110 * I would expect that the ROM takes care of the secure one,
111 * but we will try also. Of the 3 GP ones, 1 can reset us
112 * directly, the other 2 only generate MPU interrupts.
114 mode = (__raw_readl(CONTROL_STATUS) & (BIT8|BIT9));
116 __raw_writel(WD_UNLOCK1 ,WD1_BASE+WSPR);
117 wait_for_command_complete(WD1_BASE);
118 __raw_writel(WD_UNLOCK2 ,WD1_BASE+WSPR);
120 __raw_writel(WD_UNLOCK1 ,WD2_BASE+WSPR);
121 wait_for_command_complete(WD2_BASE);
122 __raw_writel(WD_UNLOCK2 ,WD2_BASE+WSPR);
124 #if MPU_WD_CLOCKED /* value 0x10 stick on aptix, BIT4 polarity seems oppsite*/
125 __raw_writel(WD_UNLOCK1 ,WD3_BASE+WSPR);
126 wait_for_command_complete(WD3_BASE);
127 __raw_writel(WD_UNLOCK2 ,WD3_BASE+WSPR);
129 __raw_writel(WD_UNLOCK1 ,WD4_BASE+WSPR);
130 wait_for_command_complete(WD4_BASE);
131 __raw_writel(WD_UNLOCK2 ,WD4_BASE+WSPR);
135 /******************************************************
136 * Routine: wait_for_command_complete
137 * Description: Wait for posting to finish on watchdog
138 ******************************************************/
139 static void wait_for_command_complete(unsigned int wd_base)
143 pending = __raw_readl(wd_base+WWPS);
147 /*******************************************************************
149 * Description: take the Ethernet controller out of reset and wait
150 * for the EEPROM load to complete.
151 ******************************************************************/
152 void ether_init (void)
154 #ifdef CONFIG_DRIVER_LAN91C96
157 __raw_writeb(0x3,OMAP2420_CTRL_BASE+0x10a); /*protect->gpio95 */
159 __raw_writew(0x0, LAN_RESET_REGISTER);
161 __raw_writew(0x1, LAN_RESET_REGISTER);
164 goto h4reset_err_out;
166 } while (__raw_readw(LAN_RESET_REGISTER) != 0x1);
171 __raw_writew(0x0, LAN_RESET_REGISTER);
174 goto h4reset_err_out;
176 } while (__raw_readw(LAN_RESET_REGISTER) != 0x0000);
179 *((volatile unsigned char *) ETH_CONTROL_REG) &= ~0x01;
187 /**********************************************
189 * Description: sets uboots idea of sdram size
190 **********************************************/
193 DECLARE_GLOBAL_DATA_PTR;
194 unsigned int size0=0,size1=0;
196 u8 chg_on = 0x5; /* enable charge of back up battery */
200 i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE); /* need this a bit early */
202 btype = get_board_type();
203 mtype = get_mem_type();
205 display_board_info(btype);
206 if (btype == BOARD_H4_MENELAUS){
207 update_mux(btype,mtype); /* combo part on menelaus */
208 i2c_write(I2C_MENELAUS, 0x20, 1, &chg_on, 1); /*fix POR reset bug */
209 i2c_write(I2C_MENELAUS, 0x2, 1, &vmode_on, 1); /* VCORE change on VMODE */
212 if ((mtype == DDR_COMBO) || (mtype == DDR_STACKED)) {
213 do_sdrc_init(SDRC_CS1_OSET, NOT_EARLY); /* init other chip select */
214 size0 = size1 = SZ_32M;
215 } else if (mtype == SDR_DISCRETE)
220 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
221 gd->bd->bi_dram[0].size = size0;
222 gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
223 gd->bd->bi_dram[1].size = size1;
228 /**********************************************************
229 * Routine: set_muxconf_regs
230 * Description: Setting up the configuration Mux registers
231 * specific to the hardware
232 *********************************************************/
233 void set_muxconf_regs (void)
244 muxSetupTouchScreen();
248 /*****************************************************************
249 * Routine: peripheral_enable
250 * Description: Enable the clks & power for perifs (GPT2, UART1,...)
251 ******************************************************************/
252 void peripheral_enable(void)
254 unsigned int v, if_clks=0, func_clks=0;
256 /* Enable GP2 timer.*/
259 v = __raw_readl(CM_CLKSEL2_CORE) | 0x4; /* Sys_clk input OMAP2420_GPT2 */
260 __raw_writel(v, CM_CLKSEL2_CORE);
261 __raw_writel(0x1, CM_CLKSEL_WKUP);
264 /* Enable UART1 clock */
268 v = __raw_readl(CM_ICLKEN1_CORE) | if_clks; /* Interface clocks on */
269 __raw_writel(v,CM_ICLKEN1_CORE );
270 v = __raw_readl(CM_FCLKEN1_CORE) | func_clks; /* Functional Clocks on */
271 __raw_writel(v, CM_FCLKEN1_CORE);
274 #ifndef KERNEL_UPDATED
276 #define V1 0xffffffff
277 #define V2 0x00000007
279 __raw_writel(V1, CM_FCLKEN1_CORE);
280 __raw_writel(V2, CM_FCLKEN2_CORE);
281 __raw_writel(V1, CM_ICLKEN1_CORE);
282 __raw_writel(V1, CM_ICLKEN2_CORE);
287 /****************************************
288 * Routine: muxSetupUsb0 (ostboot)
289 * Description: Setup usb muxing
290 *****************************************/
291 void muxSetupUsb0(void)
293 volatile uint8 *MuxConfigReg;
294 volatile uint32 *otgCtrlReg;
296 MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_PUEN;
297 *MuxConfigReg &= (uint8)(~0x1F);
299 MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_VP;
300 *MuxConfigReg &= (uint8)(~0x1F);
302 MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_VM;
303 *MuxConfigReg &= (uint8)(~0x1F);
305 MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_RCV;
306 *MuxConfigReg &= (uint8)(~0x1F);
308 MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_TXEN;
309 *MuxConfigReg &= (uint8)(~0x1F);
311 MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_SE0;
312 *MuxConfigReg &= (uint8)(~0x1F);
314 MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_DAT;
315 *MuxConfigReg &= (uint8)(~0x1F);
317 /* setup for USB VBus detection */
318 otgCtrlReg = (volatile uint32 *)USB_OTG_CTRL;
319 *otgCtrlReg |= 0x00040000; /* bit 18 */
322 /****************************************
323 * Routine: muxSetupUart3 (ostboot)
324 * Description: Setup uart3 muxing
325 *****************************************/
326 void muxSetupUart3(void)
328 volatile uint8 *MuxConfigReg;
330 MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_UART3_TX_IRTX;
331 *MuxConfigReg &= (uint8)(~0x1F);
333 MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_UART3_RX_IRRX;
334 *MuxConfigReg &= (uint8)(~0x1F);
337 /****************************************
338 * Routine: muxSetupI2C1 (ostboot)
339 * Description: Setup i2c muxing
340 *****************************************/
341 void muxSetupI2C1(void)
343 volatile unsigned char *MuxConfigReg;
345 /* I2C1 Clock pin configuration, PIN = M19 */
346 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_I2C1_SCL;
347 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
349 /* I2C1 Data pin configuration, PIN = L15 */
350 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_I2C1_SDA;
351 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
353 /* Pull-up required on data line */
354 /* external pull-up already present. */
355 /* *MuxConfigReg |= 0x18 ;*/ /* Mode = 0, PullTypeSel=PU, PullUDEnable=Enabled */
358 /****************************************
359 * Routine: muxSetupUART1 (ostboot)
360 * Description: Set up uart1 muxing
361 *****************************************/
362 void muxSetupUART1(void)
364 volatile unsigned char *MuxConfigReg;
366 /* UART1_CTS pin configuration, PIN = D21 */
367 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_UART1_CTS;
368 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
370 /* UART1_RTS pin configuration, PIN = H21 */
371 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_UART1_RTS;
372 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
374 /* UART1_TX pin configuration, PIN = L20 */
375 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_UART1_TX;
376 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
378 /* UART1_RX pin configuration, PIN = T21 */
379 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_UART1_RX;
380 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
383 /****************************************
384 * Routine: muxSetupLCD (ostboot)
385 * Description: Setup lcd muxing
386 *****************************************/
387 void muxSetupLCD(void)
389 volatile unsigned char *MuxConfigReg;
391 /* LCD_D0 pin configuration, PIN = Y7 */
392 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D0;
393 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
395 /* LCD_D1 pin configuration, PIN = P10 */
396 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D1;
397 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
399 /* LCD_D2 pin configuration, PIN = V8 */
400 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D2;
401 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
403 /* LCD_D3 pin configuration, PIN = Y8 */
404 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D3;
405 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
407 /* LCD_D4 pin configuration, PIN = W8 */
408 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D4;
409 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
411 /* LCD_D5 pin configuration, PIN = R10 */
412 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D5;
413 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
415 /* LCD_D6 pin configuration, PIN = Y9 */
416 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D6;
417 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
419 /* LCD_D7 pin configuration, PIN = V9 */
420 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D7;
421 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
423 /* LCD_D8 pin configuration, PIN = W9 */
424 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D8;
425 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
427 /* LCD_D9 pin configuration, PIN = P11 */
428 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D9;
429 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
431 /* LCD_D10 pin configuration, PIN = V10 */
432 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D10;
433 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
435 /* LCD_D11 pin configuration, PIN = Y10 */
436 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D11;
437 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
439 /* LCD_D12 pin configuration, PIN = W10 */
440 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D12;
441 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
443 /* LCD_D13 pin configuration, PIN = R11 */
444 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D13;
445 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
447 /* LCD_D14 pin configuration, PIN = V11 */
448 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D14;
449 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
451 /* LCD_D15 pin configuration, PIN = W11 */
452 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D15;
453 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
455 /* LCD_D16 pin configuration, PIN = P12 */
456 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D16;
457 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
459 /* LCD_D17 pin configuration, PIN = R12 */
460 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D17;
461 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
463 /* LCD_PCLK pin configuration, PIN = W6 */
464 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_PCLK;
465 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
467 /* LCD_VSYNC pin configuration, PIN = V7 */
468 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_VSYNC;
469 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
471 /* LCD_HSYNC pin configuration, PIN = Y6 */
472 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_HSYNC;
473 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
475 /* LCD_ACBIAS pin configuration, PIN = W7 */
476 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_ACBIAS;
477 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
480 /****************************************
481 * Routine: muxSetupCamera (ostboot)
482 * Description: Setup camera muxing
483 *****************************************/
484 void muxSetupCamera(void)
486 volatile unsigned char *MuxConfigReg;
488 /* CAMERA_RSTZ pin configuration, PIN = Y16 */
489 /* CAM_RST is connected through the I2C IO expander.*/
490 /* MuxConfigReg = (volatile unsigned char *), CONTROL_PADCONF_SYS_NRESWARM*/
491 /* *MuxConfigReg = 0x00 ; / * Mode = 0, PUPD=Disabled */
493 /* CAMERA_XCLK pin configuration, PIN = U3 */
494 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_XCLK;
495 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
497 /* CAMERA_LCLK pin configuration, PIN = V5 */
498 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_LCLK;
499 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
501 /* CAMERA_VSYNC pin configuration, PIN = U2 */
502 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_VS,
503 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
505 /* CAMERA_HSYNC pin configuration, PIN = T3 */
506 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_HS,
507 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
509 /* CAMERA_DAT0 pin configuration, PIN = T4 */
510 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D0,
511 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
513 /* CAMERA_DAT1 pin configuration, PIN = V2 */
514 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D1,
515 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
517 /* CAMERA_DAT2 pin configuration, PIN = V3 */
518 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D2,
519 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
521 /* CAMERA_DAT3 pin configuration, PIN = U4 */
522 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D3,
523 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
525 /* CAMERA_DAT4 pin configuration, PIN = W2 */
526 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D4,
527 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
529 /* CAMERA_DAT5 pin configuration, PIN = V4 */
530 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D5,
531 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
533 /* CAMERA_DAT6 pin configuration, PIN = W3 */
534 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D6,
535 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
537 /* CAMERA_DAT7 pin configuration, PIN = Y2 */
538 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D7,
539 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
541 /* CAMERA_DAT8 pin configuration, PIN = Y4 */
542 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D8,
543 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
545 /* CAMERA_DAT9 pin configuration, PIN = V6 */
546 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D9,
547 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
550 /****************************************
551 * Routine: muxSetupMMCSD (ostboot)
552 * Description: set up MMC muxing
553 *****************************************/
554 void muxSetupMMCSD(void)
556 volatile unsigned char *MuxConfigReg;
558 /* SDMMC_CLKI pin configuration, PIN = H15 */
559 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_CLKI,
560 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
562 /* SDMMC_CLKO pin configuration, PIN = G19 */
563 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_CLKO,
564 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
566 /* SDMMC_CMD pin configuration, PIN = H18 */
567 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_CMD,
568 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
569 /* External pull-ups are present. */
570 /* *MuxConfigReg |= 0x18 ; #/ PullUDEnable=Enabled, PullTypeSel=PU */
572 /* SDMMC_DAT0 pin configuration, PIN = F20 */
573 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT0,
574 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
575 /* External pull-ups are present. */
576 /* *MuxConfigReg |= 0x18 ; #/ PullUDEnable=Enabled, PullTypeSel=PU */
578 /* SDMMC_DAT1 pin configuration, PIN = H14 */
579 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT1,
580 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
581 /* External pull-ups are present. */
582 /* *MuxConfigReg |= 0x18 ; #/ PullUDEnable=Enabled, PullTypeSel=PU */
584 /* SDMMC_DAT2 pin configuration, PIN = E19 */
585 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT2,
586 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
587 /* External pull-ups are present. */
588 /* *MuxConfigReg |= 0x18 ; #/ PullUDEnable=Enabled, PullTypeSel=PU */
590 /* SDMMC_DAT3 pin configuration, PIN = D19 */
591 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT3,
592 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
593 /* External pull-ups are present. */
594 /* *MuxConfigReg |= 0x18 ; #/ PullUDEnable=Enabled, PullTypeSel=PU */
596 /* SDMMC_DDIR0 pin configuration, PIN = F19 */
597 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT_DIR0,
598 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
600 /* SDMMC_DDIR1 pin configuration, PIN = E20 */
601 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT_DIR1,
602 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
604 /* SDMMC_DDIR2 pin configuration, PIN = F18 */
605 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT_DIR2,
606 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
608 /* SDMMC_DDIR3 pin configuration, PIN = E18 */
609 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT_DIR3,
610 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
612 /* SDMMC_CDIR pin configuration, PIN = G18 */
613 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_CMD_DIR,
614 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
616 /* MMC_CD pin configuration, PIN = B3 ---2420IP ONLY---*/
617 /* MMC_CD for 2422IP=K1 */
618 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_SDRC_A14,
619 *MuxConfigReg = 0x03 ; /* Mode = 3, PUPD=Disabled */
621 /* MMC_WP pin configuration, PIN = B4 */
622 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_SDRC_A13,
623 *MuxConfigReg = 0x03 ; /* Mode = 3, PUPD=Disabled */
626 /******************************************
627 * Routine: muxSetupTouchScreen (ostboot)
628 * Description: Set up touch screen muxing
629 *******************************************/
630 void muxSetupTouchScreen(void)
632 volatile unsigned char *MuxConfigReg;
634 /* SPI1_CLK pin configuration, PIN = U18 */
635 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_SPI1_CLK,
636 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
638 /* SPI1_MOSI pin configuration, PIN = V20 */
639 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_SPI1_SIMO,
640 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
642 /* SPI1_MISO pin configuration, PIN = T18 */
643 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_SPI1_SOMI,
644 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
646 /* SPI1_nCS0 pin configuration, PIN = U19 */
647 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_SPI1_NCS0,
648 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
650 /* PEN_IRQ pin configuration, PIN = P20 */
651 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MCBSP1_FSR,
652 *MuxConfigReg = 0x03 ; /* Mode = 3, PUPD=Disabled */
655 /****************************************
656 * Routine: muxSetupHDQ (ostboot)
657 * Description: setup 1wire mux
658 *****************************************/
659 void muxSetupHDQ(void)
661 volatile unsigned char *MuxConfigReg;
663 /* HDQ_SIO pin configuration, PIN = N18 */
664 MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_HDQ_SIO,
665 *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
668 /***************************************************************
669 * Routine: muxSetupGPMC (ostboot)
670 * Description: Configures balls which cam up in protected mode
671 ***************************************************************/
672 void muxSetupGPMC(void)
674 volatile uint8 *MuxConfigReg;
675 volatile unsigned int *MCR = (volatile unsigned int *)0x4800008C;
681 /* signal - Gpmc_clk; pin - J4; offset - 0x0088; mode - 0; Byte-3 Pull/up - N/A */
682 MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_GPMC_D2_BYTE3,
683 *MuxConfigReg = 0x00 ;
685 /* signal - Gpmc_iodir; pin - n2; offset - 0x008C; mode - 1; Byte-3 Pull/up - N/A */
686 MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_GPMC_NCS0_BYTE3,
687 *MuxConfigReg = 0x01 ;
689 /* MPDB(Multi Port Debug Port) CS1 */
690 /* signal - gpmc_ncs1; pin - N8; offset - 0x008C; mode - 0; Byte-1 Pull/up - N/A */
691 MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_GPMC_NCS0_BYTE1,
692 *MuxConfigReg = 0x00 ;
694 /* signal - Gpmc_ncs2; pin - E2; offset - 0x008C; mode - 0; Byte-2 Pull/up - N/A */
695 MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_GPMC_NCS0_BYTE2,
696 *MuxConfigReg = 0x00 ;
701 /****************************************************************
702 * Routine: muxSetupSDRC (ostboot)
703 * Description: Configures balls which come up in protected mode
704 ****************************************************************/
705 void muxSetupSDRC(void)
707 volatile uint8 *MuxConfigReg;
709 /* signal - sdrc_ncs1; pin - C12; offset - 0x00A0; mode - 0; Byte-1 Pull/up - N/A */
710 MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_SDRC_NCS0_BYTE1,
711 *MuxConfigReg = 0x00 ;
713 /* signal - sdrc_a12; pin - D11; offset - 0x0030; mode - 0; Byte-2 Pull/up - N/A */
714 MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_SDRC_A14_BYTE2,
715 *MuxConfigReg = 0x00 ;
717 /* signal - sdrc_cke1; pin - B13; offset - 0x00A0; mode - 0; Byte-3 Pull/up - N/A */
718 MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_SDRC_NCS0_BYTE3,
719 *MuxConfigReg = 0x00;
721 if (get_cpu_type() == CPU_2422) {
722 MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_SDRC_A14_BYTE0,
723 *MuxConfigReg = 0x1b;
727 /*****************************************************************************
728 * Routine: update_mux()
729 * Description: Update balls which are different beween boards. All should be
730 * updated to match functionaly. However, I'm only updating ones
731 * which I'll be using for now. When power comes into play they
733 *****************************************************************************/
734 void update_mux(u32 btype,u32 mtype)
736 u32 cpu, base = OMAP2420_CTRL_BASE;
737 cpu = get_cpu_type();
739 if (btype == BOARD_H4_MENELAUS) {
740 if (cpu == CPU_2420) {
741 /* PIN = B3, GPIO.0->KBR5, mode 3, (pun?),-DO-*/
742 __raw_writeb(0x3, base+0x30);
743 /* PIN = B13, GPIO.38->KBC6, mode 3, (pun?)-DO-*/
744 __raw_writeb(0x3, base+0xa3);
745 /* PIN = F1, GPIO.25->HSUSBxx mode 3, (for external HS USB)*/
746 /* PIN = H1, GPIO.26->HSUSBxx mode 3, (for external HS USB)*/
747 /* PIN = K1, GPMC_ncs6 mode 0, (on board nand access)*/
748 /* PIN = L2, GPMC_ncs67 mode 0, (for external HS USB)*/
749 /* PIN = M1 (HSUSBOTG) */
750 /* PIN = P1, GPIO.35->MEN_POK mode 3, (menelaus powerok)-DO-*/
751 __raw_writeb(0x3, base+0x9d);
752 /* PIN = U32, (WLAN_CLKREQ) */
753 /* PIN = Y11, WLAN */
754 /* PIN = AA4, GPIO.15->KBC2, mode 3, -DO- */
755 __raw_writeb(0x3, base+0xe7);
756 /* PIN = AA8, mDOC */
758 /* PIN = AA13, WLAN */
759 /* PIN = M18 GPIO.96->MMC2_WP mode 3 -DO- */
760 __raw_writeb(0x3, base+0x10e);
761 /* PIN = N19 GPIO.98->WLAN_INT mode 3 -DO- */
762 __raw_writeb(0x3, base+0x110);
763 /* PIN = J15 HHUSB */
764 /* PIN = H19 HSUSB */
765 /* PIN = W13, P13, R13, W16 ... */
766 /* PIN = V12 GPIO.25->I2C_CAMEN mode 3 -DO- */
767 __raw_writeb(0x3, base+0xde);
768 /* PIN = W19 sys_nirq->MENELAUS_INT mode 0 -DO- */
769 __raw_writeb(0x0, base+0x12c);
770 /* PIN = AA17->sys_clkreq mode 0 -DO- */
771 __raw_writeb(0x0, base+0x136);
772 } else if (cpu == CPU_2422) {
773 /* PIN = B3, GPIO.0->nc, mode 3, set above (pun?)*/
774 /* PIN = B13, GPIO.cke1->nc, mode 0, set above, (pun?)*/
775 /* PIN = F1, GPIO.25->HSUSBxx mode 3, (for external HS USB)*/
776 /* PIN = H1, GPIO.26->HSUSBxx mode 3, (for external HS USB)*/
777 /* PIN = K1, GPMC_ncs6 mode 0, (on board nand access)*/
778 __raw_writeb(0x0, base+0x92);
779 /* PIN = L2, GPMC_ncs67 mode 0, (for external HS USB)*/
780 /* PIN = M1 (HSUSBOTG) */
781 /* PIN = P1, GPIO.35->MEN_POK mode 3, (menelaus powerok)-DO-*/
782 __raw_writeb(0x3, base+0x10c);
783 /* PIN = U32, (WLAN_CLKREQ) */
784 /* PIN = AA4, GPIO.15->KBC2, mode 3, -DO- */
785 __raw_writeb(0x3, base+0x30);
786 /* PIN = AA8, mDOC */
788 /* PIN = AA12, WLAN */
789 /* PIN = M18 GPIO.96->MMC2_WP mode 3 -DO- */
790 __raw_writeb(0x3, base+0x10e);
791 /* PIN = N19 GPIO.98->WLAN_INT mode 3 -DO- */
792 __raw_writeb(0x3, base+0x110);
793 /* PIN = J15 HHUSB */
794 /* PIN = H19 HSUSB */
795 /* PIN = W13, P13, R13, W16 ... */
796 /* PIN = V12 GPIO.25->I2C_CAMEN mode 3 -DO- */
797 __raw_writeb(0x3, base+0xde);
798 /* PIN = W19 sys_nirq->MENELAUS_INT mode 0 -DO- */
799 __raw_writeb(0x0, base+0x12c);
800 /* PIN = AA17->sys_clkreq mode 0 -DO- */
801 __raw_writeb(0x0, base+0x136);
804 } else if (btype == BOARD_H4_SDP) {
805 if (cpu == CPU_2420) {
806 /* PIN = B3, GPIO.0->nc mode 3, set above (pun?)*/
807 /* PIN = B13, GPIO.cke1->nc, mode 0, set above, (pun?)*/
812 /* Pin = AA10 VLNQ */
813 /* Pin = AA12 VLNQ */
814 /* PIN = M18 GPIO.96->KBR5 mode 3 -DO- */
815 __raw_writeb(0x3, base+0x10e);
816 /* PIN = N19 GPIO.98->KBC6 mode 3 -DO- */
817 __raw_writeb(0x3, base+0x110);
818 /* PIN = J15 MDOC_nDMAREQ */
819 /* PIN = H19 GPIO.100->KBC2 mode 3 -DO- */
820 __raw_writeb(0x3, base+0x114);
821 /* PIN = W13, V12, P13, R13, W19, W16 ... */
822 /* PIN = AA17 sys_clkreq->bt_clk_req mode 0 */
823 } else if (cpu == CPU_2422) {
824 /* PIN = B3, GPIO.0->MMC_CD, mode 3, set above */
825 /* PIN = B13, GPIO.38->wlan_int, mode 3, (pun?)*/
830 /* Pin = AA10 VLNQ */
831 /* Pin = AA12 VLNQ */
832 /* PIN = M18 GPIO.96->KBR5 mode 3 -DO- */
833 __raw_writeb(0x3, base+0x10e);
834 /* PIN = N19 GPIO.98->KBC6 mode 3 -DO- */
835 __raw_writeb(0x3, base+0x110);
836 /* PIN = J15 MDOC_nDMAREQ */
837 /* PIN = H19 GPIO.100->KBC2 mode 3 -DO- */
838 __raw_writeb(0x3, base+0x114);
839 /* PIN = W13, V12, P13, R13, W19, W16 ... */
840 /* PIN = AA17 sys_clkreq->bt_clk_req mode 0 */
845 #if (CONFIG_COMMANDS & CFG_CMD_NAND)
848 extern flash_info_t flash_info[];
850 nand_probe(CFG_NAND_ADDR);
851 if (nand_dev_desc[0].ChipID != NAND_ChipID_UNKNOWN) {
852 print_size(nand_dev_desc[0].totlen, "\n");
855 #ifdef CFG_JFFS2_MEM_NAND
856 flash_info[CFG_JFFS2_FIRST_BANK].flash_id = nand_dev_desc[0].id;
857 flash_info[CFG_JFFS2_FIRST_BANK].size = 1024*1024*2; /* only read kernel single meg partition */
858 flash_info[CFG_JFFS2_FIRST_BANK].sector_count = 1024; /* 1024 blocks in 16meg chip (use less for raw/copied partition) */
859 flash_info[CFG_JFFS2_FIRST_BANK].start[0] = 0x80200000; /* ?, ram for now, open question, copy to RAM or adapt for NAND */