blob: 0176d9c2c336abd6dd53d0e0107ae8bea0d12b94 [file] [log] [blame]
wdenk43d96162003-03-06 00:02:04 +00001/*
2 * (C) Copyright 2002
3 * Robert Schwebel, Pengutronix, r.schwebel@pengutronix.de
4 * Kyle Harris, Nexus Technologies, Inc., kharris@nexus-tech.net
5 * Marius Groeger, Sysgo Real-Time Solutions GmbH, mgroeger@sysgo.de
6 *
7 * See file CREDITS for list of people who contributed to this
8 * project.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23 * MA 02111-1307 USA
24 */
25
26#include <common.h>
27#include <asm/arch/pxa-regs.h>
wdenk47cd00f2003-03-06 13:39:27 +000028#include <asm/mach-types.h>
wdenk43d96162003-03-06 00:02:04 +000029
30#ifdef CONFIG_SHOW_BOOT_PROGRESS
31# define SHOW_BOOT_PROGRESS(arg) show_boot_progress(arg)
32#else
33# define SHOW_BOOT_PROGRESS(arg)
34#endif
35
wdenk47cd00f2003-03-06 13:39:27 +000036/**
37 * i2c_init_board - reset i2c bus. When the board is powercycled during a
38 * bus transfer it might hang; for details see doc/I2C_Edge_Conditions.
39 * The Innokom board has GPIO70 connected to SCLK which can be toggled
40 * until all chips think that their current cycles are finished.
wdenk43d96162003-03-06 00:02:04 +000041 */
wdenk06d01db2003-03-14 20:47:52 +000042void i2c_init_board(void)
wdenk47cd00f2003-03-06 13:39:27 +000043{
44 int i;
45
46 /* set gpio pin to output */
47 GPDR(70) |= GPIO_bit(70);
48 for (i = 0; i < 11; i++) {
49 GPCR(70) = GPIO_bit(70);
50 udelay(10);
51 GPSR(70) = GPIO_bit(70);
52 udelay(10);
53 }
54 /* set gpio pin to input */
55 GPDR(70) &= ~GPIO_bit(70);
wdenk47cd00f2003-03-06 13:39:27 +000056}
57
58
59/**
60 * misc_init_r: - misc initialisation routines
61 */
62
63int misc_init_r(void)
64{
65 uchar *str;
66
67 /* determine if the software update key is pressed during startup */
68 if (GPLR0 & 0x00000800) {
69 printf("using bootcmd_normal (sw-update button not pressed)\n");
70 str = getenv("bootcmd_normal");
71 } else {
72 printf("using bootcmd_update (sw-update button pressed)\n");
73 str = getenv("bootcmd_update");
74 }
75
76 setenv("bootcmd",str);
77
78 return 0;
79}
wdenk43d96162003-03-06 00:02:04 +000080
81
82/**
83 * board_init: - setup some data structures
84 *
85 * @return: 0 in case of success
86 */
87
88int board_init (void)
89{
90 DECLARE_GLOBAL_DATA_PTR;
91
92 /* memory and cpu-speed are setup before relocation */
93 /* so we do _nothing_ here */
94
95 /* arch number of Innokom board */
wdenk47cd00f2003-03-06 13:39:27 +000096 gd->bd->bi_arch_number = MACH_TYPE_INNOKOM;
wdenk43d96162003-03-06 00:02:04 +000097
98 /* adress of boot parameters */
99 gd->bd->bi_boot_params = 0xa0000100;
100
101 return 0;
102}
103
104
105/**
106 * dram_init: - setup dynamic RAM
107 *
108 * @return: 0 in case of success
109 */
110
111int dram_init (void)
112{
113 DECLARE_GLOBAL_DATA_PTR;
114
115 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
116 gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
117
118 return 0;
119}
120
121
122/**
123 * innokom_set_led: - switch LEDs on or off
124 *
125 * @param led: LED to switch (0,1,2)
126 * @param state: switch on (1) or off (0)
127 */
128
129void innokom_set_led(int led, int state)
130{
131 switch(led) {
132/*
133 case 0: if (state==1) {
134 GPCR0 |= CSB226_USER_LED0;
135 } else if (state==0) {
136 GPSR0 |= CSB226_USER_LED0;
137 }
138 break;
139
140 case 1: if (state==1) {
141 GPCR0 |= CSB226_USER_LED1;
142 } else if (state==0) {
143 GPSR0 |= CSB226_USER_LED1;
144 }
145 break;
146
147 case 2: if (state==1) {
148 GPCR0 |= CSB226_USER_LED2;
149 } else if (state==0) {
150 GPSR0 |= CSB226_USER_LED2;
151 }
152 break;
153*/
154 }
155
156 return;
157}
158
159
160/**
161 * show_boot_progress: - indicate state of the boot process
162 *
163 * @param status: Status number - see README for details.
164 *
165 * The CSB226 does only have 3 LEDs, so we switch them on at the most
166 * important states (1, 5, 15).
167 */
168
169void show_boot_progress (int status)
170{
171 switch(status) {
172/*
173 case 1: csb226_set_led(0,1); break;
174 case 5: csb226_set_led(1,1); break;
175 case 15: csb226_set_led(2,1); break;
176*/
177 }
178
179 return;
180}
181