]> git.ipfire.org Git - people/ms/u-boot.git/blob - board/mx31ads/mx31ads.c
Merge branch 'master' of git://www.denx.de/git/u-boot-fdt
[people/ms/u-boot.git] / board / mx31ads / mx31ads.c
1 /*
2 * Copyright (C) 2008, Guennadi Liakhovetski <lg@denx.de>
3 *
4 * See file CREDITS for list of people who contributed to this
5 * project.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 * MA 02111-1307 USA
21 */
22
23 #include <common.h>
24 #include <asm/io.h>
25 #include <asm/arch/mx31.h>
26 #include <asm/arch/mx31-regs.h>
27
28 DECLARE_GLOBAL_DATA_PTR;
29
30 int dram_init(void)
31 {
32 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
33 gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
34
35 return 0;
36 }
37
38 int board_init(void)
39 {
40 int i;
41 #if 0
42 /* CS0: Nor Flash */
43 /*
44 * These are values from the RedBoot sources by Freescale. However,
45 * under U-Boot with this configuration 32-bit accesses don't work,
46 * lower 16 bits of data are read twice for each 32-bit read.
47 */
48 __REG(CSCR_U(0)) = 0x23524E80;
49 __REG(CSCR_L(0)) = 0x10000D03; /* WRAP bit (1) is suspicious here, but
50 * disabling it doesn't help either */
51 __REG(CSCR_A(0)) = 0x00720900;
52 #endif
53
54 /* setup pins for UART1 */
55 mx31_gpio_mux(MUX_RXD1__UART1_RXD_MUX);
56 mx31_gpio_mux(MUX_TXD1__UART1_TXD_MUX);
57 mx31_gpio_mux(MUX_RTS1__UART1_RTS_B);
58 mx31_gpio_mux(MUX_RTS1__UART1_CTS_B);
59
60 /* PBC setup */
61 /* Enable UART transceivers also reset the Ethernet/external UART */
62 readw(CS4_BASE + 4);
63
64 writew(0x8023, CS4_BASE + 4);
65
66 /* RedBoot also has an empty loop with 100000 iterations here -
67 * clock doesn't run yet */
68 for (i = 0; i < 100000; i++)
69 ;
70
71 /* Clear the reset, toggle the LEDs */
72 writew(0xDF, CS4_BASE + 6);
73
74 /* clock still doesn't run */
75 for (i = 0; i < 100000; i++)
76 ;
77
78 /* See 1.5.4 in IMX31ADSE_PERI_BUS_CNTRL_CPLD_RM.pdf */
79 readb(CS4_BASE + 8);
80 readb(CS4_BASE + 7);
81 readb(CS4_BASE + 8);
82 readb(CS4_BASE + 7);
83
84 gd->bd->bi_arch_number = 447; /* board id for linux */
85 gd->bd->bi_boot_params = 0x80000100; /* adress of boot parameters */
86
87 return 0;
88 }
89
90 int checkboard(void)
91 {
92 printf("Board: MX31ADS\n");
93 return 0;
94 }