apollon.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  1. /*
  2. * (C) Copyright 2005-2007
  3. * Samsung Electronics.
  4. * Kyungmin Park <kyungmin.park@samsung.com>
  5. *
  6. * Derived from omap2420
  7. *
  8. * See file CREDITS for list of people who contributed to this
  9. * project.
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License as
  13. * published by the Free Software Foundation; either version 2 of
  14. * the License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  24. * MA 02111-1307 USA
  25. */
  26. #include <common.h>
  27. #include <asm/arch/omap2420.h>
  28. #include <asm/io.h>
  29. #include <asm/arch/bits.h>
  30. #include <asm/arch/mux.h>
  31. #include <asm/arch/sys_proto.h>
  32. #include <asm/arch/sys_info.h>
  33. #include <asm/arch/mem.h>
  34. #include <i2c.h>
  35. #include <asm/mach-types.h>
  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. __asm__ volatile ("1:\n" "subs %0, %1, #1\n"
  43. "bne 1b":"=r" (loops):"0"(loops)); }
  44. /*****************************************
  45. * Routine: board_init
  46. * Description: Early hardware init.
  47. *****************************************/
  48. int board_init(void)
  49. {
  50. DECLARE_GLOBAL_DATA_PTR;
  51. gpmc_init(); /* in SRAM or SDRM, finish GPMC */
  52. gd->bd->bi_arch_number = 919;
  53. /* adress of boot parameters */
  54. gd->bd->bi_boot_params = (OMAP2420_SDRC_CS0 + 0x100);
  55. return 0;
  56. }
  57. /**********************************************************
  58. * Routine: s_init
  59. * Description: Does early system init of muxing and clocks.
  60. * - Called path is with sram stack.
  61. **********************************************************/
  62. void s_init(void)
  63. {
  64. watchdog_init();
  65. set_muxconf_regs();
  66. delay(100);
  67. peripheral_enable();
  68. icache_enable();
  69. }
  70. /*******************************************************
  71. * Routine: misc_init_r
  72. * Description: Init ethernet (done here so udelay works)
  73. ********************************************************/
  74. int misc_init_r(void)
  75. {
  76. ether_init(); /* better done here so timers are init'ed */
  77. return (0);
  78. }
  79. /****************************************
  80. * Routine: watchdog_init
  81. * Description: Shut down watch dogs
  82. *****************************************/
  83. void watchdog_init(void)
  84. {
  85. /* There are 4 watch dogs. 1 secure, and 3 general purpose.
  86. * The ROM takes care of the secure one. Of the 3 GP ones,
  87. * 1 can reset us directly, the other 2 only generate MPU interrupts.
  88. */
  89. __raw_writel(WD_UNLOCK1, WD2_BASE + WSPR);
  90. wait_for_command_complete(WD2_BASE);
  91. __raw_writel(WD_UNLOCK2, WD2_BASE + WSPR);
  92. #define MPU_WD_CLOCKED 1
  93. #if MPU_WD_CLOCKED /* value 0x10 stick on aptix, BIT4 polarity seems oppsite */
  94. __raw_writel(WD_UNLOCK1, WD3_BASE + WSPR);
  95. wait_for_command_complete(WD3_BASE);
  96. __raw_writel(WD_UNLOCK2, WD3_BASE + WSPR);
  97. __raw_writel(WD_UNLOCK1, WD4_BASE + WSPR);
  98. wait_for_command_complete(WD4_BASE);
  99. __raw_writel(WD_UNLOCK2, WD4_BASE + WSPR);
  100. #endif
  101. }
  102. /******************************************************
  103. * Routine: wait_for_command_complete
  104. * Description: Wait for posting to finish on watchdog
  105. ******************************************************/
  106. void wait_for_command_complete(unsigned int wd_base) {
  107. int pending = 1;
  108. do {
  109. pending = __raw_readl(wd_base + WWPS);
  110. } while (pending);
  111. }
  112. /*******************************************************************
  113. * Routine:ether_init
  114. * Description: take the Ethernet controller out of reset and wait
  115. * for the EEPROM load to complete.
  116. ******************************************************************/
  117. void ether_init(void)
  118. {
  119. #ifdef CONFIG_DRIVER_LAN91C96
  120. int cnt = 20;
  121. __raw_writeb(0x03, OMAP2420_CTRL_BASE + 0x0f2); /*protect->gpio74 */
  122. __raw_writew(0x0, LAN_RESET_REGISTER);
  123. do {
  124. __raw_writew(0x1, LAN_RESET_REGISTER);
  125. udelay(100);
  126. if (cnt == 0) {
  127. printf("1. eth reset err\n");
  128. goto eth_reset_err_out;
  129. }
  130. --cnt;
  131. } while (__raw_readw(LAN_RESET_REGISTER) != 0x1);
  132. cnt = 20;
  133. do {
  134. __raw_writew(0x0, LAN_RESET_REGISTER);
  135. udelay(100);
  136. if (cnt == 0) {
  137. printf("2. eth reset err\n");
  138. goto eth_reset_err_out;
  139. }
  140. --cnt;
  141. } while (__raw_readw(LAN_RESET_REGISTER) != 0x0000);
  142. udelay(1000);
  143. *((volatile unsigned char *)ETH_CONTROL_REG) &= ~0x01;
  144. udelay(1000);
  145. eth_reset_err_out:
  146. return;
  147. #endif
  148. }
  149. /**********************************************
  150. * Routine: dram_init
  151. * Description: sets uboots idea of sdram size
  152. **********************************************/
  153. int dram_init(void)
  154. {
  155. DECLARE_GLOBAL_DATA_PTR;
  156. unsigned int size0 = 0, size1 = 0;
  157. u32 mtype, btype, rev = 0, cpu = 0;
  158. #define NOT_EARLY 0
  159. btype = get_board_type();
  160. mtype = get_mem_type();
  161. rev = get_cpu_rev();
  162. cpu = get_cpu_type();
  163. display_board_info(btype);
  164. if ((mtype == DDR_COMBO) || (mtype == DDR_STACKED)) {
  165. printf("ddr combo\n");
  166. do_sdrc_init(SDRC_CS1_OSET, NOT_EARLY); /* init other chip select */
  167. }
  168. size0 = get_sdr_cs_size(SDRC_CS0_OSET);
  169. size1 = get_sdr_cs_size(SDRC_CS1_OSET);
  170. gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
  171. gd->bd->bi_dram[0].size = size0;
  172. #if CONFIG_NR_DRAM_BANKS > 1
  173. gd->bd->bi_dram[1].start = PHYS_SDRAM_1 + size0;
  174. gd->bd->bi_dram[1].size = size1;
  175. #endif
  176. return 0;
  177. }
  178. /**********************************************************
  179. * Routine: set_muxconf_regs
  180. * Description: Setting up the configuration Mux registers
  181. * specific to the hardware
  182. *********************************************************/
  183. void set_muxconf_regs(void)
  184. {
  185. muxSetupSDRC();
  186. muxSetupGPMC();
  187. muxSetupUsb0(); /* USB Device */
  188. muxSetupUsbHost(); /* USB Host */
  189. muxSetupUART1();
  190. muxSetupLCD();
  191. muxSetupMMCSD();
  192. muxSetupTouchScreen();
  193. }
  194. /*****************************************************************
  195. * Routine: peripheral_enable
  196. * Description: Enable the clks & power for perifs (GPT2, UART1,...)
  197. ******************************************************************/
  198. void peripheral_enable(void)
  199. {
  200. unsigned int v, if_clks = 0, func_clks = 0;
  201. /* Enable GP2 timer. */
  202. if_clks |= BIT4 | BIT3;
  203. func_clks |= BIT4 | BIT3;
  204. v = __raw_readl(CM_CLKSEL2_CORE) | 0x4 | 0x2; /* Sys_clk input OMAP2420_GPT2 */
  205. __raw_writel(v, CM_CLKSEL2_CORE);
  206. __raw_writel(0x1, CM_CLKSEL_WKUP);
  207. #ifdef CFG_NS16550
  208. /* Enable UART1 clock */
  209. func_clks |= BIT21;
  210. if_clks |= BIT21;
  211. #endif
  212. v = __raw_readl(CM_ICLKEN1_CORE) | if_clks; /* Interface clocks on */
  213. __raw_writel(v, CM_ICLKEN1_CORE);
  214. v = __raw_readl(CM_FCLKEN1_CORE) | func_clks; /* Functional Clocks on */
  215. __raw_writel(v, CM_FCLKEN1_CORE);
  216. delay(1000);
  217. #ifndef KERNEL_UPDATED
  218. {
  219. #define V1 0xffffffff
  220. #define V2 0x00000007
  221. __raw_writel(V1, CM_FCLKEN1_CORE);
  222. __raw_writel(V2, CM_FCLKEN2_CORE);
  223. __raw_writel(V1, CM_ICLKEN1_CORE);
  224. __raw_writel(V1, CM_ICLKEN2_CORE);
  225. }
  226. #endif
  227. }
  228. /****************************************
  229. * Routine: muxSetupUsb0 (ostboot)
  230. * Description: Setup usb muxing
  231. *****************************************/
  232. void muxSetupUsb0(void)
  233. {
  234. volatile uint8 *MuxConfigReg;
  235. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_PUEN;
  236. *MuxConfigReg &= (uint8) (~0x1F);
  237. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_VP;
  238. *MuxConfigReg &= (uint8) (~0x1F);
  239. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_VM;
  240. *MuxConfigReg &= (uint8) (~0x1F);
  241. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_RCV;
  242. *MuxConfigReg &= (uint8) (~0x1F);
  243. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_TXEN;
  244. *MuxConfigReg &= (uint8) (~0x1F);
  245. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_SE0;
  246. *MuxConfigReg &= (uint8) (~0x1F);
  247. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_DAT;
  248. *MuxConfigReg &= (uint8) (~0x1F);
  249. }
  250. #define CONTROL_PADCONF_USB1_RCV ((volatile uint8 *)0x480000EB)
  251. #define CONTROL_PADCONF_USB1_TXEN ((volatile uint8 *)0x480000EC)
  252. #define CONTROL_PADCONF_GPIO69 ((volatile uint8 *)0x480000ED)
  253. #define CONTROL_PADCONF_GPIO70 ((volatile uint8 *)0x480000EE)
  254. #define CONTROL_PADCONF_GPIO102 ((volatile uint8 *)0x48000116)
  255. #define CONTROL_PADCONF_GPIO103 ((volatile uint8 *)0x48000117)
  256. #define CONTROL_PADCONF_GPIO104 ((volatile uint8 *)0x48000118)
  257. #define CONTROL_PADCONF_GPIO105 ((volatile uint8 *)0x48000119)
  258. /****************************************
  259. * Routine: muxSetupUSBHost (ostboot)
  260. * Description: Setup USB Host muxing
  261. *****************************************/
  262. void muxSetupUsbHost(void)
  263. {
  264. volatile uint8 *MuxConfigReg;
  265. /* V19 */
  266. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB1_RCV;
  267. *MuxConfigReg = 1;
  268. /* W20 */
  269. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB1_TXEN;
  270. *MuxConfigReg = 1;
  271. /* N14 */
  272. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_GPIO69;
  273. *MuxConfigReg = 3;
  274. /* P15 */
  275. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_GPIO70;
  276. *MuxConfigReg = 3;
  277. /* L18 */
  278. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_GPIO102;
  279. *MuxConfigReg = 3;
  280. /* L19 */
  281. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_GPIO103;
  282. *MuxConfigReg = 3;
  283. /* K15 */
  284. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_GPIO104;
  285. *MuxConfigReg = 3;
  286. /* K14 */
  287. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_GPIO105;
  288. *MuxConfigReg = 3;
  289. }
  290. /****************************************
  291. * Routine: muxSetupUART1 (ostboot)
  292. * Description: Set up uart1 muxing
  293. *****************************************/
  294. void muxSetupUART1(void)
  295. {
  296. volatile unsigned char *MuxConfigReg;
  297. /* UART1_CTS pin configuration, PIN = D21 */
  298. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_UART1_CTS;
  299. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  300. /* UART1_RTS pin configuration, PIN = H21 */
  301. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_UART1_RTS;
  302. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  303. /* UART1_TX pin configuration, PIN = L20 */
  304. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_UART1_TX;
  305. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  306. /* UART1_RX pin configuration, PIN = T21 */
  307. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_UART1_RX;
  308. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  309. }
  310. /****************************************
  311. * Routine: muxSetupLCD (ostboot)
  312. * Description: Setup lcd muxing
  313. *****************************************/
  314. void muxSetupLCD(void)
  315. {
  316. volatile unsigned char *MuxConfigReg;
  317. /* LCD_D0 pin configuration, PIN = Y7 */
  318. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D0;
  319. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  320. /* LCD_D1 pin configuration, PIN = P10 */
  321. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D1;
  322. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  323. /* LCD_D2 pin configuration, PIN = V8 */
  324. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D2;
  325. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  326. /* LCD_D3 pin configuration, PIN = Y8 */
  327. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D3;
  328. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  329. /* LCD_D4 pin configuration, PIN = W8 */
  330. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D4;
  331. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  332. /* LCD_D5 pin configuration, PIN = R10 */
  333. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D5;
  334. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  335. /* LCD_D6 pin configuration, PIN = Y9 */
  336. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D6;
  337. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  338. /* LCD_D7 pin configuration, PIN = V9 */
  339. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D7;
  340. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  341. /* LCD_D8 pin configuration, PIN = W9 */
  342. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D8;
  343. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  344. /* LCD_D9 pin configuration, PIN = P11 */
  345. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D9;
  346. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  347. /* LCD_D10 pin configuration, PIN = V10 */
  348. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D10;
  349. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  350. /* LCD_D11 pin configuration, PIN = Y10 */
  351. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D11;
  352. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  353. /* LCD_D12 pin configuration, PIN = W10 */
  354. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D12;
  355. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  356. /* LCD_D13 pin configuration, PIN = R11 */
  357. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D13;
  358. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  359. /* LCD_D14 pin configuration, PIN = V11 */
  360. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D14;
  361. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  362. /* LCD_D15 pin configuration, PIN = W11 */
  363. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D15;
  364. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  365. /* LCD_D16 pin configuration, PIN = P12 */
  366. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D16;
  367. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  368. /* LCD_D17 pin configuration, PIN = R12 */
  369. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D17;
  370. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  371. /* LCD_PCLK pin configuration, PIN = W6 */
  372. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_PCLK;
  373. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  374. /* LCD_VSYNC pin configuration, PIN = V7 */
  375. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_VSYNC;
  376. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  377. /* LCD_HSYNC pin configuration, PIN = Y6 */
  378. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_HSYNC;
  379. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  380. /* LCD_ACBIAS pin configuration, PIN = W7 */
  381. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_ACBIAS;
  382. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  383. }
  384. /****************************************
  385. * Routine: muxSetupMMCSD (ostboot)
  386. * Description: set up MMC muxing
  387. *****************************************/
  388. void muxSetupMMCSD(void)
  389. {
  390. volatile unsigned char *MuxConfigReg;
  391. /* SDMMC_CLKI pin configuration, PIN = H15 */
  392. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_CLKI;
  393. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  394. /* SDMMC_CLKO pin configuration, PIN = G19 */
  395. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_CLKO;
  396. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  397. /* SDMMC_CMD pin configuration, PIN = H18 */
  398. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_CMD;
  399. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  400. /* External pull-ups are present. */
  401. /* *MuxConfigReg |= 0x18 ; #/ PullUDEnable=Enabled, PullTypeSel=PU */
  402. /* SDMMC_DAT0 pin configuration, PIN = F20 */
  403. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT0;
  404. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  405. /* External pull-ups are present. */
  406. /* *MuxConfigReg |= 0x18 ; #/ PullUDEnable=Enabled, PullTypeSel=PU */
  407. /* SDMMC_DAT1 pin configuration, PIN = H14 */
  408. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT1;
  409. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  410. /* External pull-ups are present. */
  411. /* *MuxConfigReg |= 0x18 ; #/ PullUDEnable=Enabled, PullTypeSel=PU */
  412. /* SDMMC_DAT2 pin configuration, PIN = E19 */
  413. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT2;
  414. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  415. /* External pull-ups are present. */
  416. /* *MuxConfigReg |= 0x18 ; #/ PullUDEnable=Enabled, PullTypeSel=PU */
  417. /* SDMMC_DAT3 pin configuration, PIN = D19 */
  418. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT3;
  419. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  420. /* External pull-ups are present. */
  421. /* *MuxConfigReg |= 0x18 ; #/ PullUDEnable=Enabled, PullTypeSel=PU */
  422. /* SDMMC_DDIR0 pin configuration, PIN = F19 */
  423. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT_DIR0;
  424. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  425. /* SDMMC_DDIR1 pin configuration, PIN = E20 */
  426. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT_DIR1;
  427. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  428. /* SDMMC_DDIR2 pin configuration, PIN = F18 */
  429. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT_DIR2;
  430. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  431. /* SDMMC_DDIR3 pin configuration, PIN = E18 */
  432. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT_DIR3;
  433. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  434. /* SDMMC_CDIR pin configuration, PIN = G18 */
  435. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_CMD_DIR;
  436. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  437. }
  438. /******************************************
  439. * Routine: muxSetupTouchScreen (ostboot)
  440. * Description: Set up touch screen muxing
  441. *******************************************/
  442. void muxSetupTouchScreen(void)
  443. {
  444. volatile unsigned char *MuxConfigReg;
  445. /* SPI1_CLK pin configuration, PIN = U18 */
  446. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_SPI1_CLK;
  447. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  448. /* SPI1_MOSI pin configuration, PIN = V20 */
  449. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_SPI1_SIMO;
  450. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  451. /* SPI1_MISO pin configuration, PIN = T18 */
  452. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_SPI1_SOMI;
  453. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  454. /* SPI1_nCS0 pin configuration, PIN = U19 */
  455. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_SPI1_NCS0;
  456. *MuxConfigReg = 0x00; /* Mode = 0, PUPD=Disabled */
  457. #define CONTROL_PADCONF_GPIO85 CONTROL_PADCONF_SPI1_NCS1
  458. /* PEN_IRQ pin configuration, PIN = N15 */
  459. MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_GPIO85;
  460. *MuxConfigReg = 0x03; /* Mode = 3, PUPD=Disabled */
  461. }
  462. /***************************************************************
  463. * Routine: muxSetupGPMC (ostboot)
  464. * Description: Configures balls which cam up in protected mode
  465. ***************************************************************/
  466. void muxSetupGPMC(void)
  467. {
  468. volatile uint8 *MuxConfigReg;
  469. volatile unsigned int *MCR = (volatile unsigned int *)0x4800008C;
  470. /* gpmc_io_dir */
  471. *MCR = 0x19000000;
  472. /* NOR FLASH CS0 */
  473. /* signal - Gpmc_clk;
  474. pin - J4; offset - 0x0088; mode - 0; Byte-3 Pull/up - N/A */
  475. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_GPMC_D2_BYTE3;
  476. *MuxConfigReg = 0x00;
  477. /* MPDB(Multi Port Debug Port) CS1 */
  478. /* signal - gpmc_ncs1;
  479. pin - N8; offset - 0x008C; mode - 0; Byte-1 Pull/up - N/A */
  480. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_GPMC_NCS0_BYTE1;
  481. *MuxConfigReg = 0x00;
  482. /* signal - Gpmc_ncs2;
  483. pin - E2; offset - 0x008C; mode - 0; Byte-2 Pull/up - N/A */
  484. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_GPMC_NCS0_BYTE2;
  485. *MuxConfigReg = 0x00;
  486. /* signal - Gpmc_ncs3;
  487. pin - N2; offset - 0x008C; mode - 0; Byte-3 Pull/up - N/A */
  488. MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_GPMC_NCS0_BYTE3;
  489. *MuxConfigReg = 0x00;
  490. MuxConfigReg = (volatile uint8 *)((volatile unsigned char *)0x48000090);
  491. *MuxConfigReg = 0x00;
  492. MuxConfigReg = (volatile uint8 *)((volatile unsigned char *)0x48000091);
  493. *MuxConfigReg = 0x00;
  494. MuxConfigReg = (volatile uint8 *)((volatile unsigned char *)0x48000092);
  495. *MuxConfigReg = 0x00;
  496. MuxConfigReg = (volatile uint8 *)((volatile unsigned char *)0x48000093);
  497. *MuxConfigReg = 0x00;
  498. }
  499. /****************************************************************
  500. * Routine: muxSetupSDRC (ostboot)
  501. * Description: Configures balls which come up in protected mode
  502. ****************************************************************/
  503. void muxSetupSDRC(void)
  504. {
  505. /* It's set by IPL */
  506. }