Merge branch 'origin'
[platform/kernel/u-boot.git] / board / pxa255_idp / pxa_idp.c
1 /*
2  * (C) Copyright 2002
3  * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
4  *
5  * (C) Copyright 2002
6  * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
7  * Marius Groeger <mgroeger@sysgo.de>
8  *
9  * (C) Copyright 2004
10  * BEC Systems <http://bec-systems.com>
11  * Cliff Brake <cliff.brake@gmail.com>
12  * Support for Accelent/Vibren PXA255 IDP
13  *
14  * See file CREDITS for list of people who contributed to this
15  * project.
16  *
17  * This program is free software; you can redistribute it and/or
18  * modify it under the terms of the GNU General Public License as
19  * published by the Free Software Foundation; either version 2 of
20  * the License, or (at your option) any later version.
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25  * GNU General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with this program; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
30  * MA 02111-1307 USA
31  */
32
33 #include <common.h>
34 #include <command.h>
35
36 /* ------------------------------------------------------------------------- */
37
38
39 /*
40  * Miscelaneous platform dependent initialisations
41  */
42
43 int board_init (void)
44 {
45         DECLARE_GLOBAL_DATA_PTR;
46
47         /* memory and cpu-speed are setup before relocation */
48         /* so we do _nothing_ here */
49
50         /* arch number of Lubbock-Board */
51         gd->bd->bi_arch_number = MACH_TYPE_PXA_IDP;
52
53         /* adress of boot parameters */
54         gd->bd->bi_boot_params = 0xa0000100;
55
56         /* turn on serial ports */
57         *(volatile unsigned int *)(PXA_CS5_PHYS + 0x03C0002c) = 0x13;
58
59         /* set PWM for LCD */
60         /* a value that works is 60Hz, 77% duty cycle */
61         CKEN |= CKEN0_PWM0;
62         PWM_CTRL0 = 0x3f;
63         PWM_PERVAL0 = 0x3ff;
64         PWM_PWDUTY0 = 792;
65
66         /* clear reset to AC97 codec */
67         CKEN |= CKEN2_AC97;
68         GCR = GCR_COLD_RST;
69
70         /* enable LCD backlight */
71         /* *(volatile unsigned int *)(PXA_CS5_PHYS + 0x03C00030) = 0x7; */
72
73         /* test display */
74         /* lcd_puts("This is a test\nTest #2\n"); */
75
76         return 0;
77 }
78
79 int board_late_init(void)
80 {
81         setenv("stdout", "serial");
82         setenv("stderr", "serial");
83         return 0;
84 }
85
86
87 int dram_init (void)
88 {
89         DECLARE_GLOBAL_DATA_PTR;
90
91         gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
92         gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
93         gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
94         gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
95         gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
96         gd->bd->bi_dram[2].size = PHYS_SDRAM_3_SIZE;
97         gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
98         gd->bd->bi_dram[3].size = PHYS_SDRAM_4_SIZE;
99
100         return 0;
101 }
102
103
104 #ifdef DEBUG_BLINKC_ENABLE
105
106 void delay_c(void)
107 {
108         /* reset OSCR to 0 */
109         OSCR = 0;
110         while(OSCR > 0x10000)
111                 ;
112
113         while(OSCR < 0xd4000)
114                 ;
115 }
116
117 void blink_c(void)
118 {
119         int led_bit = (1<<10);
120
121         GPDR0 = led_bit;
122         GPCR0 = led_bit;
123         delay_c();
124         GPSR0 = led_bit;
125         delay_c();
126         GPCR0 = led_bit;
127 }
128
129 int do_idpcmd(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
130 {
131         printf("IDPCMD started\n");
132         return 0;
133 }
134
135 U_BOOT_CMD(idpcmd, CFG_MAXARGS, 0, do_idpcmd,
136            "idpcmd    - custom IDP command\n",
137            "no args at this time\n"
138 );
139
140 #endif