omap2420h4.c 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856
  1. /*
  2. * (C) Copyright 2004
  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 as
  11. * published by the Free Software Foundation; either version 2 of
  12. * the License, or (at your option) any later version.
  13. *
  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.
  18. *
  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,
  22. * MA 02111-1307 USA
  23. */
  24. #include <common.h>
  25. #include <netdev.h>
  26. #include <asm/arch/omap2420.h>
  27. #include <asm/io.h>
  28. #include <asm/arch/bits.h>
  29. #include <asm/arch/mux.h>
  30. #include <asm/arch/sys_proto.h>
  31. #include <asm/arch/sys_info.h>
  32. #include <asm/arch/mem.h>
  33. #include <i2c.h>
  34. #include <asm/mach-types.h>
  35. DECLARE_GLOBAL_DATA_PTR;
  36. void wait_for_command_complete(unsigned int wd_base);
  37. /*******************************************************
  38. * Routine: delay
  39. * Description: spinning delay to use before udelay works
  40. ******************************************************/
  41. static inline void delay (unsigned long loops)
  42. {
  43. __asm__ volatile ("1:\n" "subs %0, %1, #1\n"
  44. "bne 1b":"=r" (loops):"0" (loops));
  45. }
  46. /*****************************************
  47. * Routine: board_init
  48. * Description: Early hardware init.
  49. *****************************************/
  50. int board_init (void)
  51. {
  52. gpmc_init(); /* in SRAM or SDRM, finish GPMC */
  53. gd->bd->bi_arch_number = MACH_TYPE_OMAP_H4; /* board id for linux */
  54. gd->bd->bi_boot_params = (OMAP2420_SDRC_CS0+0x100); /* adress of boot parameters */
  55. return 0;
  56. }
  57. /**********************************************************
  58. * Routine: try_unlock_sram()
  59. * Description: If chip is GP type, unlock the SRAM for
  60. * general use.
  61. ***********************************************************/
  62. void try_unlock_sram(void)
  63. {
  64. /* if GP device unlock device SRAM for general use */
  65. if (get_device_type() == GP_DEVICE) {
  66. __raw_writel(0xFF, A_REQINFOPERM0);
  67. __raw_writel(0xCFDE, A_READPERM0);
  68. __raw_writel(0xCFDE, A_WRITEPERM0);
  69. }
  70. }
  71. /**********************************************************
  72. * Routine: s_init
  73. * Description: Does early system init of muxing and clocks.
  74. * - Called path is with sram stack.
  75. **********************************************************/
  76. void s_init(void)
  77. {
  78. int in_sdram = running_in_sdram();
  79. watchdog_init();
  80. set_muxconf_regs();
  81. delay(100);
  82. try_unlock_sram();
  83. if(!in_sdram)
  84. prcm_init();
  85. peripheral_enable();
  86. icache_enable();
  87. if (!in_sdram)
  88. sdrc_init();
  89. }
  90. /*******************************************************
  91. * Routine: misc_init_r
  92. * Description: Init ethernet (done here so udelay works)
  93. ********************************************************/
  94. int misc_init_r (void)
  95. {
  96. ether_init(); /* better done here so timers are init'ed */
  97. return(0);
  98. }
  99. /****************************************
  100. * Routine: watchdog_init
  101. * Description: Shut down watch dogs
  102. *****************************************/
  103. void watchdog_init(void)
  104. {
  105. /* There are 4 watch dogs. 1 secure, and 3 general purpose.
  106. * The ROM takes care of the secure one. Of the 3 GP ones,
  107. * 1 can reset us directly, the other 2 only generate MPU interrupts.
  108. */
  109. __raw_writel(WD_UNLOCK1 ,WD2_BASE+WSPR);
  110. wait_for_command_complete(WD2_BASE);
  111. __raw_writel(WD_UNLOCK2 ,WD2_BASE+WSPR);
  112. #if MPU_WD_CLOCKED /* value 0x10 stick on aptix, BIT4 polarity seems oppsite*/
  113. __raw_writel(WD_UNLOCK1 ,WD3_BASE+WSPR);
  114. wait_for_command_complete(WD3_BASE);
  115. __raw_writel(WD_UNLOCK2 ,WD3_BASE+WSPR);
  116. __raw_writel(WD_UNLOCK1 ,WD4_BASE+WSPR);
  117. wait_for_command_complete(WD4_BASE);
  118. __raw_writel(WD_UNLOCK2 ,WD4_BASE+WSPR);
  119. #endif
  120. }
  121. /******************************************************
  122. * Routine: wait_for_command_complete
  123. * Description: Wait for posting to finish on watchdog
  124. ******************************************************/
  125. void wait_for_command_complete(unsigned int wd_base)
  126. {
  127. int pending = 1;
  128. do {
  129. pending = __raw_readl(wd_base+WWPS);
  130. } while (pending);
  131. }
  132. /*******************************************************************
  133. * Routine:ether_init
  134. * Description: take the Ethernet controller out of reset and wait
  135. * for the EEPROM load to complete.
  136. ******************************************************************/
  137. void ether_init (void)
  138. {
  139. #ifdef CONFIG_DRIVER_LAN91C96
  140. int cnt = 20;
  141. __raw_writeb(0x3,OMAP2420_CTRL_BASE+0x10a); /*protect->gpio95 */
  142. __raw_writew(0x0, LAN_RESET_REGISTER);
  143. do {
  144. __raw_writew(0x1, LAN_RESET_REGISTER);
  145. udelay (100);
  146. if (cnt == 0)
  147. goto h4reset_err_out;
  148. --cnt;
  149. } while (__raw_readw(LAN_RESET_REGISTER) != 0x1);
  150. cnt = 20;
  151. do {
  152. __raw_writew(0x0, LAN_RESET_REGISTER);
  153. udelay (100);
  154. if (cnt == 0)
  155. goto h4reset_err_out;
  156. --cnt;
  157. } while (__raw_readw(LAN_RESET_REGISTER) != 0x0000);
  158. udelay (1000);
  159. *((volatile unsigned char *) ETH_CONTROL_REG) &= ~0x01;
  160. udelay (1000);
  161. h4reset_err_out:
  162. return;
  163. #endif
  164. }
  165. /**********************************************
  166. * Routine: dram_init
  167. * Description: sets uboots idea of sdram size
  168. **********************************************/
  169. int dram_init (void)
  170. {
  171. unsigned int size0=0,size1=0;
  172. u32 mtype, btype, rev, cpu;
  173. u8 chg_on = 0x5; /* enable charge of back up battery */
  174. u8 vmode_on = 0x8C;
  175. #define NOT_EARLY 0
  176. i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); /* need this a bit early */
  177. btype = get_board_type();
  178. mtype = get_mem_type();
  179. rev = get_cpu_rev();
  180. cpu = get_cpu_type();
  181. display_board_info(btype);
  182. if (btype == BOARD_H4_MENELAUS){
  183. update_mux(btype,mtype); /* combo part on menelaus */
  184. i2c_write(I2C_MENELAUS, 0x20, 1, &chg_on, 1); /*fix POR reset bug */
  185. i2c_write(I2C_MENELAUS, 0x2, 1, &vmode_on, 1); /* VCORE change on VMODE */
  186. }
  187. if ((mtype == DDR_COMBO) || (mtype == DDR_STACKED)) {
  188. do_sdrc_init(SDRC_CS1_OSET, NOT_EARLY); /* init other chip select */
  189. }
  190. size0 = get_sdr_cs_size(SDRC_CS0_OSET);
  191. size1 = get_sdr_cs_size(SDRC_CS1_OSET);
  192. gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
  193. gd->bd->bi_dram[0].size = size0;
  194. if(rev == CPU_2420_2422_ES1) /* ES1's 128MB remap granularity isn't worth doing */
  195. gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
  196. else /* ES2 and above can remap at 32MB granularity */
  197. gd->bd->bi_dram[1].start = PHYS_SDRAM_1+size0;
  198. gd->bd->bi_dram[1].size = size1;
  199. return 0;
  200. }
  201. /**********************************************************
  202. * Routine: set_muxconf_regs
  203. * Description: Setting up the configuration Mux registers
  204. * specific to the hardware
  205. *********************************************************/
  206. void set_muxconf_regs (void)
  207. {
  208. muxSetupSDRC();
  209. muxSetupGPMC();
  210. muxSetupUsb0();
  211. muxSetupUart3();
  212. muxSetupI2C1();
  213. muxSetupUART1();
  214. muxSetupLCD();
  215. muxSetupCamera();
  216. muxSetupMMCSD();
  217. muxSetupTouchScreen();
  218. muxSetupHDQ();
  219. }
  220. /*****************************************************************
  221. * Routine: peripheral_enable
  222. * Description: Enable the clks & power for perifs (GPT2, UART1,...)
  223. ******************************************************************/
  224. void peripheral_enable(void)
  225. {
  226. unsigned int v, if_clks=0, func_clks=0;
  227. /* Enable GP2 timer.*/
  228. if_clks |= BIT4;
  229. func_clks |= BIT4;
  230. v = __raw_readl(CM_CLKSEL2_CORE) | 0x4; /* Sys_clk input OMAP2420_GPT2 */
  231. __raw_writel(v, CM_CLKSEL2_CORE);
  232. __raw_writel(0x1, CM_CLKSEL_WKUP);
  233. #ifdef CONFIG_SYS_NS16550
  234. /* Enable UART1 clock */
  235. func_clks |= BIT21;
  236. if_clks |= BIT21;
  237. #endif
  238. v = __raw_readl(CM_ICLKEN1_CORE) | if_clks; /* Interface clocks on */
  239. __raw_writel(v,CM_ICLKEN1_CORE );
  240. v = __raw_readl(CM_FCLKEN1_CORE) | func_clks; /* Functional Clocks on */
  241. __raw_writel(v, CM_FCLKEN1_CORE);
  242. delay(1000);
  243. #ifndef KERNEL_UPDATED
  244. {
  245. #define V1 0xffffffff
  246. #define V2 0x00000007
  247. __raw_writel(V1, CM_FCLKEN1_CORE);
  248. __raw_writel(V2, CM_FCLKEN2_CORE);
  249. __raw_writel(V1, CM_ICLKEN1_CORE);
  250. __raw_writel(V1, CM_ICLKEN2_CORE);
  251. }
  252. #endif
  253. }
  254. /****************************************
  255. * Routine: muxSetupUsb0 (ostboot)
  256. * Description: Setup usb muxing
  257. *****************************************/
  258. void muxSetupUsb0(void)
  259. {
  260. volatile uint8 *MuxConfigReg;
  261. volatile uint32 *otgCtrlReg;
  262. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_PUEN;
  263. *MuxConfigReg &= (uint8)(~0x1F);
  264. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_VP;
  265. *MuxConfigReg &= (uint8)(~0x1F);
  266. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_VM;
  267. *MuxConfigReg &= (uint8)(~0x1F);
  268. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_RCV;
  269. *MuxConfigReg &= (uint8)(~0x1F);
  270. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_TXEN;
  271. *MuxConfigReg &= (uint8)(~0x1F);
  272. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_SE0;
  273. *MuxConfigReg &= (uint8)(~0x1F);
  274. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_DAT;
  275. *MuxConfigReg &= (uint8)(~0x1F);
  276. /* setup for USB VBus detection */
  277. otgCtrlReg = (volatile uint32 *)USB_OTG_CTRL;
  278. *otgCtrlReg |= 0x00040000; /* bit 18 */
  279. }
  280. /****************************************
  281. * Routine: muxSetupUart3 (ostboot)
  282. * Description: Setup uart3 muxing
  283. *****************************************/
  284. void muxSetupUart3(void)
  285. {
  286. volatile uint8 *MuxConfigReg;
  287. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_UART3_TX_IRTX;
  288. *MuxConfigReg &= (uint8)(~0x1F);
  289. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_UART3_RX_IRRX;
  290. *MuxConfigReg &= (uint8)(~0x1F);
  291. }
  292. /****************************************
  293. * Routine: muxSetupI2C1 (ostboot)
  294. * Description: Setup i2c muxing
  295. *****************************************/
  296. void muxSetupI2C1(void)
  297. {
  298. volatile unsigned char *MuxConfigReg;
  299. /* I2C1 Clock pin configuration, PIN = M19 */
  300. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_I2C1_SCL;
  301. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  302. /* I2C1 Data pin configuration, PIN = L15 */
  303. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_I2C1_SDA;
  304. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  305. /* Pull-up required on data line */
  306. /* external pull-up already present. */
  307. /* *MuxConfigReg |= 0x18 ;*/ /* Mode = 0, PullTypeSel=PU, PullUDEnable=Enabled */
  308. }
  309. /****************************************
  310. * Routine: muxSetupUART1 (ostboot)
  311. * Description: Set up uart1 muxing
  312. *****************************************/
  313. void muxSetupUART1(void)
  314. {
  315. volatile unsigned char *MuxConfigReg;
  316. /* UART1_CTS pin configuration, PIN = D21 */
  317. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_UART1_CTS;
  318. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  319. /* UART1_RTS pin configuration, PIN = H21 */
  320. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_UART1_RTS;
  321. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  322. /* UART1_TX pin configuration, PIN = L20 */
  323. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_UART1_TX;
  324. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  325. /* UART1_RX pin configuration, PIN = T21 */
  326. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_UART1_RX;
  327. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  328. }
  329. /****************************************
  330. * Routine: muxSetupLCD (ostboot)
  331. * Description: Setup lcd muxing
  332. *****************************************/
  333. void muxSetupLCD(void)
  334. {
  335. volatile unsigned char *MuxConfigReg;
  336. /* LCD_D0 pin configuration, PIN = Y7 */
  337. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D0;
  338. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  339. /* LCD_D1 pin configuration, PIN = P10 */
  340. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D1;
  341. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  342. /* LCD_D2 pin configuration, PIN = V8 */
  343. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D2;
  344. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  345. /* LCD_D3 pin configuration, PIN = Y8 */
  346. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D3;
  347. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  348. /* LCD_D4 pin configuration, PIN = W8 */
  349. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D4;
  350. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  351. /* LCD_D5 pin configuration, PIN = R10 */
  352. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D5;
  353. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  354. /* LCD_D6 pin configuration, PIN = Y9 */
  355. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D6;
  356. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  357. /* LCD_D7 pin configuration, PIN = V9 */
  358. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D7;
  359. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  360. /* LCD_D8 pin configuration, PIN = W9 */
  361. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D8;
  362. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  363. /* LCD_D9 pin configuration, PIN = P11 */
  364. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D9;
  365. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  366. /* LCD_D10 pin configuration, PIN = V10 */
  367. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D10;
  368. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  369. /* LCD_D11 pin configuration, PIN = Y10 */
  370. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D11;
  371. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  372. /* LCD_D12 pin configuration, PIN = W10 */
  373. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D12;
  374. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  375. /* LCD_D13 pin configuration, PIN = R11 */
  376. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D13;
  377. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  378. /* LCD_D14 pin configuration, PIN = V11 */
  379. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D14;
  380. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  381. /* LCD_D15 pin configuration, PIN = W11 */
  382. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D15;
  383. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  384. /* LCD_D16 pin configuration, PIN = P12 */
  385. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D16;
  386. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  387. /* LCD_D17 pin configuration, PIN = R12 */
  388. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D17;
  389. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  390. /* LCD_PCLK pin configuration, PIN = W6 */
  391. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_PCLK;
  392. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  393. /* LCD_VSYNC pin configuration, PIN = V7 */
  394. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_VSYNC;
  395. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  396. /* LCD_HSYNC pin configuration, PIN = Y6 */
  397. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_HSYNC;
  398. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  399. /* LCD_ACBIAS pin configuration, PIN = W7 */
  400. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_ACBIAS;
  401. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  402. }
  403. /****************************************
  404. * Routine: muxSetupCamera (ostboot)
  405. * Description: Setup camera muxing
  406. *****************************************/
  407. void muxSetupCamera(void)
  408. {
  409. volatile unsigned char *MuxConfigReg;
  410. /* CAMERA_RSTZ pin configuration, PIN = Y16 */
  411. /* CAM_RST is connected through the I2C IO expander.*/
  412. /* MuxConfigReg = (volatile unsigned char *), CONTROL_PADCONF_SYS_NRESWARM*/
  413. /* *MuxConfigReg = 0x00 ; / * Mode = 0, PUPD=Disabled */
  414. /* CAMERA_XCLK pin configuration, PIN = U3 */
  415. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_XCLK;
  416. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  417. /* CAMERA_LCLK pin configuration, PIN = V5 */
  418. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_LCLK;
  419. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  420. /* CAMERA_VSYNC pin configuration, PIN = U2 */
  421. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_VS,
  422. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  423. /* CAMERA_HSYNC pin configuration, PIN = T3 */
  424. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_HS,
  425. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  426. /* CAMERA_DAT0 pin configuration, PIN = T4 */
  427. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D0,
  428. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  429. /* CAMERA_DAT1 pin configuration, PIN = V2 */
  430. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D1,
  431. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  432. /* CAMERA_DAT2 pin configuration, PIN = V3 */
  433. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D2,
  434. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  435. /* CAMERA_DAT3 pin configuration, PIN = U4 */
  436. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D3,
  437. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  438. /* CAMERA_DAT4 pin configuration, PIN = W2 */
  439. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D4,
  440. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  441. /* CAMERA_DAT5 pin configuration, PIN = V4 */
  442. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D5,
  443. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  444. /* CAMERA_DAT6 pin configuration, PIN = W3 */
  445. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D6,
  446. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  447. /* CAMERA_DAT7 pin configuration, PIN = Y2 */
  448. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D7,
  449. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  450. /* CAMERA_DAT8 pin configuration, PIN = Y4 */
  451. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D8,
  452. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  453. /* CAMERA_DAT9 pin configuration, PIN = V6 */
  454. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D9,
  455. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  456. }
  457. /****************************************
  458. * Routine: muxSetupMMCSD (ostboot)
  459. * Description: set up MMC muxing
  460. *****************************************/
  461. void muxSetupMMCSD(void)
  462. {
  463. volatile unsigned char *MuxConfigReg;
  464. /* SDMMC_CLKI pin configuration, PIN = H15 */
  465. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_CLKI,
  466. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  467. /* SDMMC_CLKO pin configuration, PIN = G19 */
  468. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_CLKO,
  469. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  470. /* SDMMC_CMD pin configuration, PIN = H18 */
  471. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_CMD,
  472. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  473. /* External pull-ups are present. */
  474. /* *MuxConfigReg |= 0x18 ; #/ PullUDEnable=Enabled, PullTypeSel=PU */
  475. /* SDMMC_DAT0 pin configuration, PIN = F20 */
  476. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT0,
  477. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  478. /* External pull-ups are present. */
  479. /* *MuxConfigReg |= 0x18 ; #/ PullUDEnable=Enabled, PullTypeSel=PU */
  480. /* SDMMC_DAT1 pin configuration, PIN = H14 */
  481. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT1,
  482. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  483. /* External pull-ups are present. */
  484. /* *MuxConfigReg |= 0x18 ; #/ PullUDEnable=Enabled, PullTypeSel=PU */
  485. /* SDMMC_DAT2 pin configuration, PIN = E19 */
  486. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT2,
  487. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  488. /* External pull-ups are present. */
  489. /* *MuxConfigReg |= 0x18 ; #/ PullUDEnable=Enabled, PullTypeSel=PU */
  490. /* SDMMC_DAT3 pin configuration, PIN = D19 */
  491. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT3,
  492. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  493. /* External pull-ups are present. */
  494. /* *MuxConfigReg |= 0x18 ; #/ PullUDEnable=Enabled, PullTypeSel=PU */
  495. /* SDMMC_DDIR0 pin configuration, PIN = F19 */
  496. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT_DIR0,
  497. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  498. /* SDMMC_DDIR1 pin configuration, PIN = E20 */
  499. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT_DIR1,
  500. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  501. /* SDMMC_DDIR2 pin configuration, PIN = F18 */
  502. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT_DIR2,
  503. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  504. /* SDMMC_DDIR3 pin configuration, PIN = E18 */
  505. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT_DIR3,
  506. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  507. /* SDMMC_CDIR pin configuration, PIN = G18 */
  508. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_CMD_DIR,
  509. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  510. /* MMC_CD pin configuration, PIN = B3 ---2420IP ONLY---*/
  511. /* MMC_CD for 2422IP=K1 */
  512. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_SDRC_A14,
  513. *MuxConfigReg = 0x03 ; /* Mode = 3, PUPD=Disabled */
  514. /* MMC_WP pin configuration, PIN = B4 */
  515. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_SDRC_A13,
  516. *MuxConfigReg = 0x03 ; /* Mode = 3, PUPD=Disabled */
  517. }
  518. /******************************************
  519. * Routine: muxSetupTouchScreen (ostboot)
  520. * Description: Set up touch screen muxing
  521. *******************************************/
  522. void muxSetupTouchScreen(void)
  523. {
  524. volatile unsigned char *MuxConfigReg;
  525. /* SPI1_CLK pin configuration, PIN = U18 */
  526. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_SPI1_CLK,
  527. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  528. /* SPI1_MOSI pin configuration, PIN = V20 */
  529. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_SPI1_SIMO,
  530. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  531. /* SPI1_MISO pin configuration, PIN = T18 */
  532. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_SPI1_SOMI,
  533. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  534. /* SPI1_nCS0 pin configuration, PIN = U19 */
  535. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_SPI1_NCS0,
  536. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  537. /* PEN_IRQ pin configuration, PIN = P20 */
  538. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MCBSP1_FSR,
  539. *MuxConfigReg = 0x03 ; /* Mode = 3, PUPD=Disabled */
  540. }
  541. /****************************************
  542. * Routine: muxSetupHDQ (ostboot)
  543. * Description: setup 1wire mux
  544. *****************************************/
  545. void muxSetupHDQ(void)
  546. {
  547. volatile unsigned char *MuxConfigReg;
  548. /* HDQ_SIO pin configuration, PIN = N18 */
  549. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_HDQ_SIO,
  550. *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */
  551. }
  552. /***************************************************************
  553. * Routine: muxSetupGPMC (ostboot)
  554. * Description: Configures balls which cam up in protected mode
  555. ***************************************************************/
  556. void muxSetupGPMC(void)
  557. {
  558. volatile uint8 *MuxConfigReg;
  559. volatile unsigned int *MCR = (volatile unsigned int *)0x4800008C;
  560. /* gpmc_io_dir */
  561. *MCR = 0x19000000;
  562. /* NOR FLASH CS0 */
  563. /* signal - Gpmc_clk; pin - J4; offset - 0x0088; mode - 0; Byte-3 Pull/up - N/A */
  564. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_GPMC_D2_BYTE3,
  565. *MuxConfigReg = 0x00 ;
  566. /* signal - Gpmc_iodir; pin - n2; offset - 0x008C; mode - 1; Byte-3 Pull/up - N/A */
  567. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_GPMC_NCS0_BYTE3,
  568. *MuxConfigReg = 0x01 ;
  569. /* MPDB(Multi Port Debug Port) CS1 */
  570. /* signal - gpmc_ncs1; pin - N8; offset - 0x008C; mode - 0; Byte-1 Pull/up - N/A */
  571. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_GPMC_NCS0_BYTE1,
  572. *MuxConfigReg = 0x00 ;
  573. /* signal - Gpmc_ncs2; pin - E2; offset - 0x008C; mode - 0; Byte-2 Pull/up - N/A */
  574. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_GPMC_NCS0_BYTE2,
  575. *MuxConfigReg = 0x00 ;
  576. }
  577. /****************************************************************
  578. * Routine: muxSetupSDRC (ostboot)
  579. * Description: Configures balls which come up in protected mode
  580. ****************************************************************/
  581. void muxSetupSDRC(void)
  582. {
  583. volatile uint8 *MuxConfigReg;
  584. /* signal - sdrc_ncs1; pin - C12; offset - 0x00A0; mode - 0; Byte-1 Pull/up - N/A */
  585. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_SDRC_NCS0_BYTE1,
  586. *MuxConfigReg = 0x00 ;
  587. /* signal - sdrc_a12; pin - D11; offset - 0x0030; mode - 0; Byte-2 Pull/up - N/A */
  588. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_SDRC_A14_BYTE2,
  589. *MuxConfigReg = 0x00 ;
  590. /* signal - sdrc_cke1; pin - B13; offset - 0x00A0; mode - 0; Byte-3 Pull/up - N/A */
  591. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_SDRC_NCS0_BYTE3,
  592. *MuxConfigReg = 0x00;
  593. if (get_cpu_type() == CPU_2422) {
  594. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_SDRC_A14_BYTE0,
  595. *MuxConfigReg = 0x1b;
  596. }
  597. }
  598. /*****************************************************************************
  599. * Routine: update_mux()
  600. * Description: Update balls which are different beween boards. All should be
  601. * updated to match functionaly. However, I'm only updating ones
  602. * which I'll be using for now. When power comes into play they
  603. * all need updating.
  604. *****************************************************************************/
  605. void update_mux(u32 btype,u32 mtype)
  606. {
  607. u32 cpu, base = OMAP2420_CTRL_BASE;
  608. cpu = get_cpu_type();
  609. if (btype == BOARD_H4_MENELAUS) {
  610. if (cpu == CPU_2420) {
  611. /* PIN = B3, GPIO.0->KBR5, mode 3, (pun?),-DO-*/
  612. __raw_writeb(0x3, base+0x30);
  613. /* PIN = B13, GPIO.38->KBC6, mode 3, (pun?)-DO-*/
  614. __raw_writeb(0x3, base+0xa3);
  615. /* PIN = F1, GPIO.25->HSUSBxx mode 3, (for external HS USB)*/
  616. /* PIN = H1, GPIO.26->HSUSBxx mode 3, (for external HS USB)*/
  617. /* PIN = K1, GPMC_ncs6 mode 0, (on board nand access)*/
  618. /* PIN = L2, GPMC_ncs67 mode 0, (for external HS USB)*/
  619. /* PIN = M1 (HSUSBOTG) */
  620. /* PIN = P1, GPIO.35->MEN_POK mode 3, (menelaus powerok)-DO-*/
  621. __raw_writeb(0x3, base+0x9d);
  622. /* PIN = U32, (WLAN_CLKREQ) */
  623. /* PIN = Y11, WLAN */
  624. /* PIN = AA4, GPIO.15->KBC2, mode 3, -DO- */
  625. __raw_writeb(0x3, base+0xe7);
  626. /* PIN = AA8, mDOC */
  627. /* PIN = AA10, BT */
  628. /* PIN = AA13, WLAN */
  629. /* PIN = M18 GPIO.96->MMC2_WP mode 3 -DO- */
  630. __raw_writeb(0x3, base+0x10e);
  631. /* PIN = N19 GPIO.98->WLAN_INT mode 3 -DO- */
  632. __raw_writeb(0x3, base+0x110);
  633. /* PIN = J15 HHUSB */
  634. /* PIN = H19 HSUSB */
  635. /* PIN = W13, P13, R13, W16 ... */
  636. /* PIN = V12 GPIO.25->I2C_CAMEN mode 3 -DO- */
  637. __raw_writeb(0x3, base+0xde);
  638. /* PIN = W19 sys_nirq->MENELAUS_INT mode 0 -DO- */
  639. __raw_writeb(0x0, base+0x12c);
  640. /* PIN = AA17->sys_clkreq mode 0 -DO- */
  641. __raw_writeb(0x0, base+0x136);
  642. } else if (cpu == CPU_2422) {
  643. /* PIN = B3, GPIO.0->nc, mode 3, set above (pun?)*/
  644. /* PIN = B13, GPIO.cke1->nc, mode 0, set above, (pun?)*/
  645. /* PIN = F1, GPIO.25->HSUSBxx mode 3, (for external HS USB)*/
  646. /* PIN = H1, GPIO.26->HSUSBxx mode 3, (for external HS USB)*/
  647. /* PIN = K1, GPMC_ncs6 mode 0, (on board nand access)*/
  648. __raw_writeb(0x0, base+0x92);
  649. /* PIN = L2, GPMC_ncs67 mode 0, (for external HS USB)*/
  650. /* PIN = M1 (HSUSBOTG) */
  651. /* PIN = P1, GPIO.35->MEN_POK mode 3, (menelaus powerok)-DO-*/
  652. __raw_writeb(0x3, base+0x10c);
  653. /* PIN = U32, (WLAN_CLKREQ) */
  654. /* PIN = AA4, GPIO.15->KBC2, mode 3, -DO- */
  655. __raw_writeb(0x3, base+0x30);
  656. /* PIN = AA8, mDOC */
  657. /* PIN = AA10, BT */
  658. /* PIN = AA12, WLAN */
  659. /* PIN = M18 GPIO.96->MMC2_WP mode 3 -DO- */
  660. __raw_writeb(0x3, base+0x10e);
  661. /* PIN = N19 GPIO.98->WLAN_INT mode 3 -DO- */
  662. __raw_writeb(0x3, base+0x110);
  663. /* PIN = J15 HHUSB */
  664. /* PIN = H19 HSUSB */
  665. /* PIN = W13, P13, R13, W16 ... */
  666. /* PIN = V12 GPIO.25->I2C_CAMEN mode 3 -DO- */
  667. __raw_writeb(0x3, base+0xde);
  668. /* PIN = W19 sys_nirq->MENELAUS_INT mode 0 -DO- */
  669. __raw_writeb(0x0, base+0x12c);
  670. /* PIN = AA17->sys_clkreq mode 0 -DO- */
  671. __raw_writeb(0x0, base+0x136);
  672. }
  673. } else if (btype == BOARD_H4_SDP) {
  674. if (cpu == CPU_2420) {
  675. /* PIN = B3, GPIO.0->nc mode 3, set above (pun?)*/
  676. /* PIN = B13, GPIO.cke1->nc, mode 0, set above, (pun?)*/
  677. /* Pin = Y11 VLNQ */
  678. /* Pin = AA4 VLNQ */
  679. /* Pin = AA6 VLNQ */
  680. /* Pin = AA8 VLNQ */
  681. /* Pin = AA10 VLNQ */
  682. /* Pin = AA12 VLNQ */
  683. /* PIN = M18 GPIO.96->KBR5 mode 3 -DO- */
  684. __raw_writeb(0x3, base+0x10e);
  685. /* PIN = N19 GPIO.98->KBC6 mode 3 -DO- */
  686. __raw_writeb(0x3, base+0x110);
  687. /* PIN = J15 MDOC_nDMAREQ */
  688. /* PIN = H19 GPIO.100->KBC2 mode 3 -DO- */
  689. __raw_writeb(0x3, base+0x114);
  690. /* PIN = W13, V12, P13, R13, W19, W16 ... */
  691. /* PIN = AA17 sys_clkreq->bt_clk_req mode 0 */
  692. } else if (cpu == CPU_2422) {
  693. /* PIN = B3, GPIO.0->MMC_CD, mode 3, set above */
  694. /* PIN = B13, GPIO.38->wlan_int, mode 3, (pun?)*/
  695. /* Pin = Y11 VLNQ */
  696. /* Pin = AA4 VLNQ */
  697. /* Pin = AA6 VLNQ */
  698. /* Pin = AA8 VLNQ */
  699. /* Pin = AA10 VLNQ */
  700. /* Pin = AA12 VLNQ */
  701. /* PIN = M18 GPIO.96->KBR5 mode 3 -DO- */
  702. __raw_writeb(0x3, base+0x10e);
  703. /* PIN = N19 GPIO.98->KBC6 mode 3 -DO- */
  704. __raw_writeb(0x3, base+0x110);
  705. /* PIN = J15 MDOC_nDMAREQ */
  706. /* PIN = H19 GPIO.100->KBC2 mode 3 -DO- */
  707. __raw_writeb(0x3, base+0x114);
  708. /* PIN = W13, V12, P13, R13, W19, W16 ... */
  709. /* PIN = AA17 sys_clkreq->bt_clk_req mode 0 */
  710. }
  711. }
  712. }
  713. #ifdef CONFIG_CMD_NET
  714. int board_eth_init(bd_t *bis)
  715. {
  716. int rc = 0;
  717. #ifdef CONFIG_LAN91C96
  718. rc = lan91c96_initialize(0, CONFIG_LAN91C96_BASE);
  719. #endif
  720. return rc;
  721. }
  722. #endif