blob: b93e880886b2dab8ede11e01e77d895dba796965 [file] [log] [blame]
Peter Pearseba348b52007-11-09 15:24:26 +00001/*
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>
Nishanth Menonee1c20f2009-10-16 00:06:37 -050027#include <netdev.h>
Peter Pearseba348b52007-11-09 15:24:26 +000028#include <asm/arch/omap2420.h>
29#include <asm/io.h>
30#include <asm/arch/bits.h>
31#include <asm/arch/mux.h>
32#include <asm/arch/sys_proto.h>
33#include <asm/arch/sys_info.h>
34#include <asm/arch/mem.h>
Peter Pearseba348b52007-11-09 15:24:26 +000035#include <asm/mach-types.h>
36
37void wait_for_command_complete(unsigned int wd_base);
38
Peter Pearsed82a83f2007-11-15 08:45:13 +000039DECLARE_GLOBAL_DATA_PTR;
40
41#define write_config_reg(reg, value) \
42do { \
43 writeb(value, reg); \
44} while (0)
45
46#define mask_config_reg(reg, mask) \
47do { \
48 char value = readb(reg) & ~(mask); \
49 writeb(value, reg); \
50} while (0)
51
Peter Pearseba348b52007-11-09 15:24:26 +000052/*******************************************************
53 * Routine: delay
54 * Description: spinning delay to use before udelay works
Peter Pearsed82a83f2007-11-15 08:45:13 +000055 ******************************************************/
56static inline void delay(unsigned long loops)
57{
58 __asm__("1:\n" "subs %0, %1, #1\n"
59 "bne 1b":"=r" (loops):"0"(loops));
60}
Peter Pearseba348b52007-11-09 15:24:26 +000061
62/*****************************************
63 * Routine: board_init
64 * Description: Early hardware init.
65 *****************************************/
66int board_init(void)
67{
Peter Pearseba348b52007-11-09 15:24:26 +000068 gpmc_init(); /* in SRAM or SDRM, finish GPMC */
69
70 gd->bd->bi_arch_number = 919;
71 /* adress of boot parameters */
72 gd->bd->bi_boot_params = (OMAP2420_SDRC_CS0 + 0x100);
73
74 return 0;
75}
76
77/**********************************************************
78 * Routine: s_init
79 * Description: Does early system init of muxing and clocks.
80 * - Called path is with sram stack.
81 **********************************************************/
82void s_init(void)
83{
Peter Pearseba348b52007-11-09 15:24:26 +000084 watchdog_init();
85 set_muxconf_regs();
86 delay(100);
87
88 peripheral_enable();
89 icache_enable();
90}
91
92/*******************************************************
93 * Routine: misc_init_r
94 * Description: Init ethernet (done here so udelay works)
Peter Pearsed82a83f2007-11-15 08:45:13 +000095 ********************************************************/
Peter Pearseba348b52007-11-09 15:24:26 +000096int misc_init_r(void)
97{
98 ether_init(); /* better done here so timers are init'ed */
99 return (0);
100}
101
102/****************************************
103 * Routine: watchdog_init
104 * Description: Shut down watch dogs
105 *****************************************/
106void watchdog_init(void)
107{
108 /* There are 4 watch dogs. 1 secure, and 3 general purpose.
109 * The ROM takes care of the secure one. Of the 3 GP ones,
110 * 1 can reset us directly, the other 2 only generate MPU interrupts.
111 */
112 __raw_writel(WD_UNLOCK1, WD2_BASE + WSPR);
113 wait_for_command_complete(WD2_BASE);
114 __raw_writel(WD_UNLOCK2, WD2_BASE + WSPR);
115
116#define MPU_WD_CLOCKED 1
Peter Pearsed82a83f2007-11-15 08:45:13 +0000117#if MPU_WD_CLOCKED
118 /* value 0x10 stick on aptix, BIT4 polarity seems oppsite */
Peter Pearseba348b52007-11-09 15:24:26 +0000119 __raw_writel(WD_UNLOCK1, WD3_BASE + WSPR);
120 wait_for_command_complete(WD3_BASE);
121 __raw_writel(WD_UNLOCK2, WD3_BASE + WSPR);
122
123 __raw_writel(WD_UNLOCK1, WD4_BASE + WSPR);
124 wait_for_command_complete(WD4_BASE);
Peter Pearsed82a83f2007-11-15 08:45:13 +0000125 __raw_writel(WD_UNLOCK2, WD4_BASE + WSPR);
126#endif
Peter Pearseba348b52007-11-09 15:24:26 +0000127}
128
129/******************************************************
130 * Routine: wait_for_command_complete
131 * Description: Wait for posting to finish on watchdog
Peter Pearsed82a83f2007-11-15 08:45:13 +0000132 ******************************************************/
133void wait_for_command_complete(unsigned int wd_base)
134{
Peter Pearseba348b52007-11-09 15:24:26 +0000135 int pending = 1;
136 do {
137 pending = __raw_readl(wd_base + WWPS);
138 } while (pending);
139}
140
141/*******************************************************************
Nishanth Menonee1c20f2009-10-16 00:06:37 -0500142 * Routine:board_eth_init
Peter Pearseba348b52007-11-09 15:24:26 +0000143 * Description: take the Ethernet controller out of reset and wait
Wolfgang Denka1be4762008-05-20 16:00:29 +0200144 * for the EEPROM load to complete.
Peter Pearseba348b52007-11-09 15:24:26 +0000145 ******************************************************************/
Nishanth Menonee1c20f2009-10-16 00:06:37 -0500146int board_eth_init(bd_t *bis)
Peter Pearseba348b52007-11-09 15:24:26 +0000147{
Nishanth Menonee1c20f2009-10-16 00:06:37 -0500148 int rc = 0;
149#ifdef CONFIG_LAN91C96
Peter Pearseba348b52007-11-09 15:24:26 +0000150 int cnt = 20;
151
152 __raw_writeb(0x03, OMAP2420_CTRL_BASE + 0x0f2); /*protect->gpio74 */
153
154 __raw_writew(0x0, LAN_RESET_REGISTER);
155 do {
156 __raw_writew(0x1, LAN_RESET_REGISTER);
157 udelay(100);
Kyungmin Park16fc0a72008-07-08 09:08:40 +0900158 if (cnt == 0)
Peter Pearseba348b52007-11-09 15:24:26 +0000159 goto eth_reset_err_out;
Peter Pearseba348b52007-11-09 15:24:26 +0000160 --cnt;
161 } while (__raw_readw(LAN_RESET_REGISTER) != 0x1);
162
163 cnt = 20;
164
165 do {
166 __raw_writew(0x0, LAN_RESET_REGISTER);
167 udelay(100);
Kyungmin Park16fc0a72008-07-08 09:08:40 +0900168 if (cnt == 0)
Peter Pearseba348b52007-11-09 15:24:26 +0000169 goto eth_reset_err_out;
Peter Pearseba348b52007-11-09 15:24:26 +0000170 --cnt;
171 } while (__raw_readw(LAN_RESET_REGISTER) != 0x0000);
172 udelay(1000);
173
Peter Pearsed82a83f2007-11-15 08:45:13 +0000174 mask_config_reg(ETH_CONTROL_REG, 0x01);
Peter Pearseba348b52007-11-09 15:24:26 +0000175 udelay(1000);
Nishanth Menonee1c20f2009-10-16 00:06:37 -0500176 rc = lan91c96_initialize(0, CONFIG_LAN91C96_BASE);
Peter Pearseba348b52007-11-09 15:24:26 +0000177eth_reset_err_out:
Peter Pearseba348b52007-11-09 15:24:26 +0000178#endif
Nishanth Menonee1c20f2009-10-16 00:06:37 -0500179 return rc;
Peter Pearseba348b52007-11-09 15:24:26 +0000180}
181
182/**********************************************
183 * Routine: dram_init
184 * Description: sets uboots idea of sdram size
Peter Pearsed82a83f2007-11-15 08:45:13 +0000185 **********************************************/
Peter Pearseba348b52007-11-09 15:24:26 +0000186int dram_init(void)
187{
Peter Pearseba348b52007-11-09 15:24:26 +0000188 unsigned int size0 = 0, size1 = 0;
189 u32 mtype, btype, rev = 0, cpu = 0;
190#define NOT_EARLY 0
191
192 btype = get_board_type();
193 mtype = get_mem_type();
194 rev = get_cpu_rev();
195 cpu = get_cpu_type();
196
197 display_board_info(btype);
198
199 if ((mtype == DDR_COMBO) || (mtype == DDR_STACKED)) {
Peter Pearsed82a83f2007-11-15 08:45:13 +0000200 /* init other chip select */
201 do_sdrc_init(SDRC_CS1_OSET, NOT_EARLY);
Peter Pearseba348b52007-11-09 15:24:26 +0000202 }
203
204 size0 = get_sdr_cs_size(SDRC_CS0_OSET);
205 size1 = get_sdr_cs_size(SDRC_CS1_OSET);
206
207 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
208 gd->bd->bi_dram[0].size = size0;
209#if CONFIG_NR_DRAM_BANKS > 1
210 gd->bd->bi_dram[1].start = PHYS_SDRAM_1 + size0;
211 gd->bd->bi_dram[1].size = size1;
212#endif
213
214 return 0;
215}
216
217/**********************************************************
218 * Routine: set_muxconf_regs
219 * Description: Setting up the configuration Mux registers
220 * specific to the hardware
221 *********************************************************/
222void set_muxconf_regs(void)
223{
224 muxSetupSDRC();
225 muxSetupGPMC();
226 muxSetupUsb0(); /* USB Device */
227 muxSetupUsbHost(); /* USB Host */
228 muxSetupUART1();
229 muxSetupLCD();
230 muxSetupMMCSD();
231 muxSetupTouchScreen();
232}
233
234/*****************************************************************
235 * Routine: peripheral_enable
236 * Description: Enable the clks & power for perifs (GPT2, UART1,...)
Peter Pearsed82a83f2007-11-15 08:45:13 +0000237 ******************************************************************/
Peter Pearseba348b52007-11-09 15:24:26 +0000238void peripheral_enable(void)
239{
240 unsigned int v, if_clks = 0, func_clks = 0;
241
242 /* Enable GP2 timer. */
243 if_clks |= BIT4 | BIT3;
244 func_clks |= BIT4 | BIT3;
Peter Pearsed82a83f2007-11-15 08:45:13 +0000245 /* Sys_clk input OMAP2420_GPT2 */
246 v = __raw_readl(CM_CLKSEL2_CORE) | 0x4 | 0x2;
Peter Pearseba348b52007-11-09 15:24:26 +0000247 __raw_writel(v, CM_CLKSEL2_CORE);
248 __raw_writel(0x1, CM_CLKSEL_WKUP);
249
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200250#ifdef CONFIG_SYS_NS16550
Peter Pearseba348b52007-11-09 15:24:26 +0000251 /* Enable UART1 clock */
252 func_clks |= BIT21;
253 if_clks |= BIT21;
254#endif
Peter Pearsed82a83f2007-11-15 08:45:13 +0000255 /* Interface clocks on */
256 v = __raw_readl(CM_ICLKEN1_CORE) | if_clks;
Peter Pearseba348b52007-11-09 15:24:26 +0000257 __raw_writel(v, CM_ICLKEN1_CORE);
Peter Pearsed82a83f2007-11-15 08:45:13 +0000258 /* Functional Clocks on */
259 v = __raw_readl(CM_FCLKEN1_CORE) | func_clks;
Peter Pearseba348b52007-11-09 15:24:26 +0000260 __raw_writel(v, CM_FCLKEN1_CORE);
261 delay(1000);
262
263#ifndef KERNEL_UPDATED
264 {
265#define V1 0xffffffff
266#define V2 0x00000007
267
268 __raw_writel(V1, CM_FCLKEN1_CORE);
269 __raw_writel(V2, CM_FCLKEN2_CORE);
270 __raw_writel(V1, CM_ICLKEN1_CORE);
271 __raw_writel(V1, CM_ICLKEN2_CORE);
272 }
273#endif
274}
275
276/****************************************
Peter Pearsed82a83f2007-11-15 08:45:13 +0000277 * Routine: muxSetupUsb0 (ostboot)
Peter Pearseba348b52007-11-09 15:24:26 +0000278 * Description: Setup usb muxing
279 *****************************************/
280void muxSetupUsb0(void)
281{
Peter Pearsed82a83f2007-11-15 08:45:13 +0000282 mask_config_reg(CONTROL_PADCONF_USB0_PUEN, 0x1f);
283 mask_config_reg(CONTROL_PADCONF_USB0_VP, 0x1f);
284 mask_config_reg(CONTROL_PADCONF_USB0_VM, 0x1f);
285 mask_config_reg(CONTROL_PADCONF_USB0_RCV, 0x1f);
286 mask_config_reg(CONTROL_PADCONF_USB0_TXEN, 0x1f);
287 mask_config_reg(CONTROL_PADCONF_USB0_SE0, 0x1f);
288 mask_config_reg(CONTROL_PADCONF_USB0_DAT, 0x1f);
Peter Pearseba348b52007-11-09 15:24:26 +0000289}
290
Peter Pearseba348b52007-11-09 15:24:26 +0000291/****************************************
Peter Pearsed82a83f2007-11-15 08:45:13 +0000292 * Routine: muxSetupUSBHost (ostboot)
Peter Pearseba348b52007-11-09 15:24:26 +0000293 * Description: Setup USB Host muxing
294 *****************************************/
295void muxSetupUsbHost(void)
296{
Peter Pearseba348b52007-11-09 15:24:26 +0000297 /* V19 */
Peter Pearsed82a83f2007-11-15 08:45:13 +0000298 write_config_reg(CONTROL_PADCONF_USB1_RCV, 1);
Peter Pearseba348b52007-11-09 15:24:26 +0000299 /* W20 */
Peter Pearsed82a83f2007-11-15 08:45:13 +0000300 write_config_reg(CONTROL_PADCONF_USB1_TXEN, 1);
Peter Pearseba348b52007-11-09 15:24:26 +0000301 /* N14 */
Peter Pearsed82a83f2007-11-15 08:45:13 +0000302 write_config_reg(CONTROL_PADCONF_GPIO69, 3);
Peter Pearseba348b52007-11-09 15:24:26 +0000303 /* P15 */
Peter Pearsed82a83f2007-11-15 08:45:13 +0000304 write_config_reg(CONTROL_PADCONF_GPIO70, 3);
Peter Pearseba348b52007-11-09 15:24:26 +0000305 /* L18 */
Peter Pearsed82a83f2007-11-15 08:45:13 +0000306 write_config_reg(CONTROL_PADCONF_GPIO102, 3);
Peter Pearseba348b52007-11-09 15:24:26 +0000307 /* L19 */
Peter Pearsed82a83f2007-11-15 08:45:13 +0000308 write_config_reg(CONTROL_PADCONF_GPIO103, 3);
Peter Pearseba348b52007-11-09 15:24:26 +0000309 /* K15 */
Peter Pearsed82a83f2007-11-15 08:45:13 +0000310 write_config_reg(CONTROL_PADCONF_GPIO104, 3);
Peter Pearseba348b52007-11-09 15:24:26 +0000311 /* K14 */
Peter Pearsed82a83f2007-11-15 08:45:13 +0000312 write_config_reg(CONTROL_PADCONF_GPIO105, 3);
Peter Pearseba348b52007-11-09 15:24:26 +0000313}
314
315/****************************************
Peter Pearsed82a83f2007-11-15 08:45:13 +0000316 * Routine: muxSetupUART1 (ostboot)
Peter Pearseba348b52007-11-09 15:24:26 +0000317 * Description: Set up uart1 muxing
318 *****************************************/
319void muxSetupUART1(void)
320{
Peter Pearsed82a83f2007-11-15 08:45:13 +0000321 /* UART1_CTS pin configuration, PIN = D21, Mode = 0, PUPD=Disabled */
322 write_config_reg(CONTROL_PADCONF_UART1_CTS, 0);
323 /* UART1_RTS pin configuration, PIN = H21, Mode = 0, PUPD=Disabled */
324 write_config_reg(CONTROL_PADCONF_UART1_RTS, 0);
325 /* UART1_TX pin configuration, PIN = L20, Mode = 0, PUPD=Disabled */
326 write_config_reg(CONTROL_PADCONF_UART1_TX, 0);
327 /* UART1_RX pin configuration, PIN = T21, Mode = 0, PUPD=Disabled */
328 write_config_reg(CONTROL_PADCONF_UART1_RX, 0);
Peter Pearseba348b52007-11-09 15:24:26 +0000329}
330
331/****************************************
Peter Pearsed82a83f2007-11-15 08:45:13 +0000332 * Routine: muxSetupLCD (ostboot)
Peter Pearseba348b52007-11-09 15:24:26 +0000333 * Description: Setup lcd muxing
334 *****************************************/
335void muxSetupLCD(void)
336{
Peter Pearsed82a83f2007-11-15 08:45:13 +0000337 /* LCD_D0 pin configuration, PIN = Y7, Mode = 0, PUPD=Disabled */
338 write_config_reg(CONTROL_PADCONF_DSS_D0, 0);
339 /* LCD_D1 pin configuration, PIN = P10 , Mode = 0, PUPD=Disabled */
340 write_config_reg(CONTROL_PADCONF_DSS_D1, 0);
341 /* LCD_D2 pin configuration, PIN = V8, Mode = 0, PUPD=Disabled */
342 write_config_reg(CONTROL_PADCONF_DSS_D2, 0);
343 /* LCD_D3 pin configuration, PIN = Y8, Mode = 0, PUPD=Disabled */
344 write_config_reg(CONTROL_PADCONF_DSS_D3, 0);
345 /* LCD_D4 pin configuration, PIN = W8, Mode = 0, PUPD=Disabled */
346 write_config_reg(CONTROL_PADCONF_DSS_D4, 0);
347 /* LCD_D5 pin configuration, PIN = R10, Mode = 0, PUPD=Disabled */
348 write_config_reg(CONTROL_PADCONF_DSS_D5, 0);
349 /* LCD_D6 pin configuration, PIN = Y9, Mode = 0, PUPD=Disabled */
350 write_config_reg(CONTROL_PADCONF_DSS_D6, 0);
351 /* LCD_D7 pin configuration, PIN = V9, Mode = 0, PUPD=Disabled */
352 write_config_reg(CONTROL_PADCONF_DSS_D7, 0);
353 /* LCD_D8 pin configuration, PIN = W9, Mode = 0, PUPD=Disabled */
354 write_config_reg(CONTROL_PADCONF_DSS_D8, 0);
355 /* LCD_D9 pin configuration, PIN = P11, Mode = 0, PUPD=Disabled */
356 write_config_reg(CONTROL_PADCONF_DSS_D9, 0);
357 /* LCD_D10 pin configuration, PIN = V10, Mode = 0, PUPD=Disabled */
358 write_config_reg(CONTROL_PADCONF_DSS_D10, 0);
359 /* LCD_D11 pin configuration, PIN = Y10, Mode = 0, PUPD=Disabled */
360 write_config_reg(CONTROL_PADCONF_DSS_D11, 0);
361 /* LCD_D12 pin configuration, PIN = W10, Mode = 0, PUPD=Disabled */
362 write_config_reg(CONTROL_PADCONF_DSS_D12, 0);
363 /* LCD_D13 pin configuration, PIN = R11, Mode = 0, PUPD=Disabled */
364 write_config_reg(CONTROL_PADCONF_DSS_D13, 0);
365 /* LCD_D14 pin configuration, PIN = V11, Mode = 0, PUPD=Disabled */
366 write_config_reg(CONTROL_PADCONF_DSS_D14, 0);
367 /* LCD_D15 pin configuration, PIN = W11, Mode = 0, PUPD=Disabled */
368 write_config_reg(CONTROL_PADCONF_DSS_D15, 0);
369 /* LCD_D16 pin configuration, PIN = P12, Mode = 0, PUPD=Disabled */
370 write_config_reg(CONTROL_PADCONF_DSS_D16, 0);
371 /* LCD_D17 pin configuration, PIN = R12, Mode = 0, PUPD=Disabled */
372 write_config_reg(CONTROL_PADCONF_DSS_D17, 0);
373 /* LCD_PCLK pin configuration, PIN = W6, Mode = 0, PUPD=Disabled */
374 write_config_reg(CONTROL_PADCONF_DSS_PCLK, 0);
375 /* LCD_VSYNC pin configuration, PIN = V7, Mode = 0, PUPD=Disabled */
376 write_config_reg(CONTROL_PADCONF_DSS_VSYNC, 0);
377 /* LCD_HSYNC pin configuration, PIN = Y6, Mode = 0, PUPD=Disabled */
378 write_config_reg(CONTROL_PADCONF_DSS_HSYNC, 0);
379 /* LCD_ACBIAS pin configuration, PIN = W7, Mode = 0, PUPD=Disabled */
380 write_config_reg(CONTROL_PADCONF_DSS_ACBIAS, 0);
Peter Pearseba348b52007-11-09 15:24:26 +0000381}
382
383/****************************************
384 * Routine: muxSetupMMCSD (ostboot)
385 * Description: set up MMC muxing
386 *****************************************/
387void muxSetupMMCSD(void)
388{
Peter Pearsed82a83f2007-11-15 08:45:13 +0000389 /* SDMMC_CLKI pin configuration, PIN = H15, Mode = 0, PUPD=Disabled */
390 write_config_reg(CONTROL_PADCONF_MMC_CLKI, 0);
391 /* SDMMC_CLKO pin configuration, PIN = G19, Mode = 0, PUPD=Disabled */
392 write_config_reg(CONTROL_PADCONF_MMC_CLKO, 0);
393 /* SDMMC_CMD pin configuration, PIN = H18, Mode = 0, PUPD=Disabled */
394 write_config_reg(CONTROL_PADCONF_MMC_CMD, 0);
395 /* SDMMC_DAT0 pin configuration, PIN = F20, Mode = 0, PUPD=Disabled */
396 write_config_reg(CONTROL_PADCONF_MMC_DAT0, 0);
397 /* SDMMC_DAT1 pin configuration, PIN = H14, Mode = 0, PUPD=Disabled */
398 write_config_reg(CONTROL_PADCONF_MMC_DAT1, 0);
399 /* SDMMC_DAT2 pin configuration, PIN = E19, Mode = 0, PUPD=Disabled */
400 write_config_reg(CONTROL_PADCONF_MMC_DAT2, 0);
401 /* SDMMC_DAT3 pin configuration, PIN = D19, Mode = 0, PUPD=Disabled */
402 write_config_reg(CONTROL_PADCONF_MMC_DAT3, 0);
403 /* SDMMC_DDIR0 pin configuration, PIN = F19, Mode = 0, PUPD=Disabled */
404 write_config_reg(CONTROL_PADCONF_MMC_DAT_DIR0, 0);
405 /* SDMMC_DDIR1 pin configuration, PIN = E20, Mode = 0, PUPD=Disabled */
406 write_config_reg(CONTROL_PADCONF_MMC_DAT_DIR1, 0);
407 /* SDMMC_DDIR2 pin configuration, PIN = F18, Mode = 0, PUPD=Disabled */
408 write_config_reg(CONTROL_PADCONF_MMC_DAT_DIR2, 0);
409 /* SDMMC_DDIR3 pin configuration, PIN = E18, Mode = 0, PUPD=Disabled */
410 write_config_reg(CONTROL_PADCONF_MMC_DAT_DIR3, 0);
411 /* SDMMC_CDIR pin configuration, PIN = G18, Mode = 0, PUPD=Disabled */
412 write_config_reg(CONTROL_PADCONF_MMC_CMD_DIR, 0);
Peter Pearseba348b52007-11-09 15:24:26 +0000413}
414
415/******************************************
416 * Routine: muxSetupTouchScreen (ostboot)
Peter Pearsed82a83f2007-11-15 08:45:13 +0000417 * Description: Set up touch screen muxing
418 *******************************************/
Peter Pearseba348b52007-11-09 15:24:26 +0000419void muxSetupTouchScreen(void)
420{
Peter Pearsed82a83f2007-11-15 08:45:13 +0000421 /* SPI1_CLK pin configuration, PIN = U18, Mode = 0, PUPD=Disabled */
422 write_config_reg(CONTROL_PADCONF_SPI1_CLK, 0);
423 /* SPI1_MOSI pin configuration, PIN = V20, Mode = 0, PUPD=Disabled */
424 write_config_reg(CONTROL_PADCONF_SPI1_SIMO, 0);
425 /* SPI1_MISO pin configuration, PIN = T18, Mode = 0, PUPD=Disabled */
426 write_config_reg(CONTROL_PADCONF_SPI1_SOMI, 0);
427 /* SPI1_nCS0 pin configuration, PIN = U19, Mode = 0, PUPD=Disabled */
428 write_config_reg(CONTROL_PADCONF_SPI1_NCS0, 0);
Peter Pearseba348b52007-11-09 15:24:26 +0000429#define CONTROL_PADCONF_GPIO85 CONTROL_PADCONF_SPI1_NCS1
Peter Pearsed82a83f2007-11-15 08:45:13 +0000430 /* PEN_IRQ pin configuration, PIN = N15, Mode = 3, PUPD=Disabled */
431 write_config_reg(CONTROL_PADCONF_GPIO85, 3);
Peter Pearseba348b52007-11-09 15:24:26 +0000432}
433
434/***************************************************************
435 * Routine: muxSetupGPMC (ostboot)
436 * Description: Configures balls which cam up in protected mode
Peter Pearsed82a83f2007-11-15 08:45:13 +0000437 ***************************************************************/
Peter Pearseba348b52007-11-09 15:24:26 +0000438void muxSetupGPMC(void)
439{
Peter Pearsed82a83f2007-11-15 08:45:13 +0000440 /* gpmc_io_dir, MCR */
Kyungmin Park33174212008-01-17 16:43:25 +0900441 volatile unsigned int *MCR = (unsigned int *) 0x4800008C;
442 *MCR = 0x19000000;
Peter Pearseba348b52007-11-09 15:24:26 +0000443
444 /* NOR FLASH CS0 */
Peter Pearsed82a83f2007-11-15 08:45:13 +0000445 /* signal - Gpmc_clk; pin - J4; offset - 0x0088; mode 0; Byte-3 */
446 write_config_reg(CONTROL_PADCONF_GPMC_D2_BYTE3, 0);
Peter Pearseba348b52007-11-09 15:24:26 +0000447 /* MPDB(Multi Port Debug Port) CS1 */
Peter Pearsed82a83f2007-11-15 08:45:13 +0000448 /* signal - gpmc_ncs1; pin - N8; offset - 0x008D; mode 0; Byte-1 */
449 write_config_reg(CONTROL_PADCONF_GPMC_NCS0_BYTE1, 0);
450 /* signal - Gpmc_ncs2; pin - E2; offset - 0x008E; mode 0; Byte-2 */
451 write_config_reg(CONTROL_PADCONF_GPMC_NCS0_BYTE2, 0);
452 /* signal - Gpmc_ncs3; pin - N2; offset - 0x008F; mode 0; Byte-3 */
453 write_config_reg(CONTROL_PADCONF_GPMC_NCS0_BYTE3, 0);
454 /* signal - Gpmc_ncs4; pin - ??; offset - 0x0090; mode 0; Byte-4 */
455 write_config_reg(CONTROL_PADCONF_GPMC_NCS0_BYTE4, 0);
456 /* signal - Gpmc_ncs5; pin - ??; offset - 0x0091; mode 0; Byte-5 */
457 write_config_reg(CONTROL_PADCONF_GPMC_NCS0_BYTE5, 0);
458 /* signal - Gpmc_ncs6; pin - ??; offset - 0x0092; mode 0; Byte-6 */
459 write_config_reg(CONTROL_PADCONF_GPMC_NCS0_BYTE6, 0);
460 /* signal - Gpmc_ncs7; pin - ??; offset - 0x0093; mode 0; Byte-7 */
461 write_config_reg(CONTROL_PADCONF_GPMC_NCS0_BYTE7, 0);
Peter Pearseba348b52007-11-09 15:24:26 +0000462}
463
464/****************************************************************
Peter Pearsed82a83f2007-11-15 08:45:13 +0000465 * Routine: muxSetupSDRC (ostboot)
Peter Pearseba348b52007-11-09 15:24:26 +0000466 * Description: Configures balls which come up in protected mode
Peter Pearsed82a83f2007-11-15 08:45:13 +0000467 ****************************************************************/
Peter Pearseba348b52007-11-09 15:24:26 +0000468void muxSetupSDRC(void)
469{
470 /* It's set by IPL */
471}